From e2f49fe23b2ae1a910ab7015167e5ed9a5e4988a Mon Sep 17 00:00:00 2001 From: Marcin Zelent Date: Mon, 23 Apr 2018 17:19:58 +0200 Subject: Added proper new observation layout with geolocation and bird choosing, added swipe refreshing. --- .../org/marcinzelent/liberavem/AllObservationsFragment.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'app/src/main/java/org/marcinzelent/liberavem/AllObservationsFragment.java') diff --git a/app/src/main/java/org/marcinzelent/liberavem/AllObservationsFragment.java b/app/src/main/java/org/marcinzelent/liberavem/AllObservationsFragment.java index a16e833..af4331a 100644 --- a/app/src/main/java/org/marcinzelent/liberavem/AllObservationsFragment.java +++ b/app/src/main/java/org/marcinzelent/liberavem/AllObservationsFragment.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; @@ -48,6 +49,17 @@ public class AllObservationsFragment extends Fragment { @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); + } + } + ); + DataKeeper.getInstance().downloadData(getActivity()); } -- cgit v1.2.3