diff options
Diffstat (limited to 'app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java')
-rw-r--r-- | app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java b/app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java index d0ad649..b83d7b4 100644 --- a/app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java +++ b/app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java @@ -4,6 +4,7 @@ package org.marcinzelent.liberavem; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; +import android.support.v4.widget.SwipeRefreshLayout; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -33,6 +34,20 @@ public class MyObservationsFragment extends Fragment { return rootView; } + @Override + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + final SwipeRefreshLayout sfl = view.findViewById(R.id.swiperefresh); + sfl.setOnRefreshListener( + new SwipeRefreshLayout.OnRefreshListener() { + @Override + public void onRefresh() { + DataKeeper.getInstance().downloadData(getActivity()); + sfl.setRefreshing(false); + } + } + ); + } + public void populateList(final Observation[] observations, final Bird[] birds) { final ListView observationsListView = getView().findViewById(R.id.observations_list_view); |