Skip to content

Commit

Permalink
app: comment code of activity, fragments
Browse files Browse the repository at this point in the history
  • Loading branch information
yannikmotzet committed Jan 20, 2021
1 parent e7f9cb2 commit 7bfbea3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 49 deletions.
21 changes: 5 additions & 16 deletions app/src/main/java/com/example/testbeacon/Home.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,22 @@
import android.view.View;
import android.view.ViewGroup;

/**
* A simple {@link Fragment} subclass.
* Use the {@link Home#newInstance} factory method to
* create an instance of this fragment.
*/
// Home Fragment (PreferenceFragment) which is embedded in MainActivity shows detected beacon
// on fragment swiperefreshlayout is places
public class Home extends Fragment {

// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";

// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;

public Home() {
// Required empty public constructor
}

/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment Home.
*/
// TODO: Rename and change types and number of parameters

public static Home newInstance(String param1, String param2) {
Home fragment = new Home();
Bundle args = new Bundle();
Expand All @@ -63,6 +50,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
return inflater.inflate(R.layout.fragment_home, container, false);
}

// this method is called after the fragment is created (user navigates to fragment)
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
// event listener of swipe refresh layout (home fragment) starts beacon scanning
Expand All @@ -71,6 +59,7 @@ public void onViewCreated(View view, Bundle savedInstanceState) {
@Override
public void onRefresh() {
((MainActivity)getActivity()).scanClicked(((MainActivity)getActivity()).findViewById(R.id.fragment_home));
// when beacon is detected refreshing animation will be stopped
//pullToRefresh.setRefreshing(false);
}
});
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/com/example/testbeacon/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@
import org.json.JSONException;
import org.json.JSONObject;


// Activity with Bottom Navigation View
// the App consists of this single Activity
// in the View of the Activity Fragments will be embedded
public class MainActivity extends AppCompatActivity implements BeaconConsumer, RangeNotifier {
protected static final String TAG = "MainActivity";
private static final int PERMISSION_REQUEST_FINE_LOCATION = 1;
Expand Down
17 changes: 1 addition & 16 deletions app/src/main/java/com/example/testbeacon/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,20 @@
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.SwitchPreference;

/**
* A simple {@link Fragment} subclass.
* Use the {@link Settings#newInstance} factory method to
* create an instance of this fragment.
*/
// Settings Fragment (PreferenceFragment) which is embedded in MainActivity
public class Settings extends PreferenceFragmentCompat {

// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";

// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;

public Settings() {
// Required empty public constructor
}

/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment settings.
*/
// TODO: Rename and change types and number of parameters
public static Settings newInstance(String param1, String param2) {
Settings fragment = new Settings();
Bundle args = new Bundle();
Expand Down
17 changes: 1 addition & 16 deletions app/src/main/java/com/example/testbeacon/UserProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,20 @@

import androidx.fragment.app.Fragment;

/**
* A simple {@link Fragment} subclass.
* Use the {@link UserProfile#newInstance} factory method to
* create an instance of this fragment.
*/
// User Fragment which is embedded in MainActivity
public class UserProfile extends Fragment {

// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";

// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;

public UserProfile() {
// Required empty public constructor
}

/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment user_profile.
*/
// TODO: Rename and change types and number of parameters
public static UserProfile newInstance(String param1, String param2) {
UserProfile fragment = new UserProfile();
Bundle args = new Bundle();
Expand Down

0 comments on commit 7bfbea3

Please sign in to comment.