From ce661ca32b4d672eb54c9e095ae9bfdff4b0efeb Mon Sep 17 00:00:00 2001 From: Distopico Vegan Date: Thu, 16 May 2019 23:52:25 -0500 Subject: [PATCH] fix(ui): increase distance on refreshable --- app/src/main/java/org/dystopia/email/FragmentMessages.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/dystopia/email/FragmentMessages.java b/app/src/main/java/org/dystopia/email/FragmentMessages.java index 6194b64b..cfb4ee32 100644 --- a/app/src/main/java/org/dystopia/email/FragmentMessages.java +++ b/app/src/main/java/org/dystopia/email/FragmentMessages.java @@ -29,6 +29,7 @@ import android.os.Bundle; import android.os.Handler; import android.preference.PreferenceManager; import android.text.TextUtils; +import android.util.DisplayMetrics; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; @@ -122,6 +123,7 @@ public class FragmentMessages extends FragmentEx { private static final int LOCAL_PAGE_SIZE = 50; private static final int REMOTE_PAGE_SIZE = 10; private static final int UNDO_TIMEOUT = 5000; // milliseconds + private static final int SWIPE_REFRESH_DISTANCE = 200; @Override public void onCreate(Bundle savedInstanceState) { @@ -176,9 +178,11 @@ public class FragmentMessages extends FragmentEx { fabMove = view.findViewById(R.id.fabMove); final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); + final DisplayMetrics metrics = getResources().getDisplayMetrics(); + final int mSpinnerDistance = (int) (SWIPE_REFRESH_DISTANCE * metrics.density); // Wire controls - + swipeRefresh.setDistanceToTriggerSync(mSpinnerDistance); swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() {