aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Zelent <zelent.marcin@gmail.com>2018-04-20 13:21:33 +0200
committerMarcin Zelent <zelent.marcin@gmail.com>2018-04-20 13:21:33 +0200
commite4fac53bb0e2a5234116caf8651e8d2c5a38a4f1 (patch)
tree52811c063c5a12903c29bd04a3f4a2ac88de0eb5 /app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java
parentc4db4c26bb531974ba10c62185fd931e723a6859 (diff)
Created proper MyObservations functionality
Diffstat (limited to 'app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java')
-rw-r--r--app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java15
1 files changed, 3 insertions, 12 deletions
diff --git a/app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java b/app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java
index 1d27e99..d0ad649 100644
--- a/app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java
+++ b/app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java
@@ -20,8 +20,6 @@ import java.util.ArrayList;
* A simple {@link Fragment} subclass.
*/
public class MyObservationsFragment extends Fragment {
- Observation[] observations;
- Bird[] birds;
public MyObservationsFragment() {
// Required empty public constructor
@@ -35,14 +33,8 @@ public class MyObservationsFragment extends Fragment {
return rootView;
}
- @Override
- public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
- String[] list = new String[] {
- "String 1",
- "String 2",
- "String 3"
- };
- ListView observationsListView = view.findViewById(R.id.observations_list_view);
+ public void populateList(final Observation[] observations, final Bird[] birds) {
+ final ListView observationsListView = getView().findViewById(R.id.observations_list_view);
observationsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
@@ -58,8 +50,7 @@ public class MyObservationsFragment extends Fragment {
startActivity(detailsIntent);
}
});
-
- ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_1, list);
+ final ObservationsListAdapter adapter = new ObservationsListAdapter(getActivity(), observations, birds);
observationsListView.setAdapter(adapter);
}
}