Fixed swipe refresh on fast scroll

pull/159/head
M66B 5 years ago
parent 456756efd3
commit ec59befb82

@ -31,7 +31,6 @@ For authorizing:
* A [bug in Android](https://issuetracker.google.com/issues/62427912) "*... ActivityRecord not found for ...*" sometimes causes a crash after updating FairEmail. Reinstalling ([source](https://stackoverflow.com/questions/46309428/android-activitythread-reportsizeconfigurations-causes-app-to-freeze-with-black)) migth fix the problem.
* Encryption with [YubiKey](https://www.yubico.com/) results into an infinite loop. FairEmail follows the latest version of the [OpenKeychain API](https://github.com/open-keychain/openpgp-api), so this is likely being caused by an external bug.
* A bug in the Nova Launcher lets FairEmail crash with a *java.lang.StackOverflowError* when the Nova Launcher has access to the accessibility service.
* Fast scrolling sometimes triggers a swipe refresh. Unfortunately, there is no way to detect that a fast scroll is in progress and to disable swipe refreshing.
## Planned features

@ -192,7 +192,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private boolean date;
private boolean threading;
private boolean pull;
private boolean swipenav;
private boolean autoscroll;
private boolean actionbar;
@ -309,11 +308,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
if (viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER)
pull = prefs.getBoolean("pull", true);
else
pull = false;
swipenav = prefs.getBoolean("swipenav", true);
autoscroll = (prefs.getBoolean("autoscroll", false) || viewType == AdapterMessage.ViewType.THREAD);
date = prefs.getBoolean("date", true);
@ -900,12 +894,24 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
fabMore.show();
else
fabMore.hide();
updateSwipeRefresh();
}
});
}
updateSwipeRefresh();
swipeRefresh.setOnChildScrollUpCallback(new SwipeRefreshLayout.OnChildScrollUpCallback() {
@Override
public boolean canChildScrollUp(@NonNull SwipeRefreshLayout parent, @Nullable View child) {
if (viewType != AdapterMessage.ViewType.UNIFIED && viewType != AdapterMessage.ViewType.FOLDER)
return true;
if (!prefs.getBoolean("pull", true))
return true;
if (swiping)
return true;
if (selectionTracker != null && selectionTracker.hasSelection())
return true;
return rvMessage.canScrollVertically(-1);
}
});
pgpService = new OpenPgpServiceConnection(getContext(), "org.sufficientlysecure.keychain");
pgpService.bindToService();
@ -946,10 +952,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
super.onDestroy();
}
private void updateSwipeRefresh() {
swipeRefresh.setEnabled(pull && !swiping && (selectionTracker == null || !selectionTracker.hasSelection()));
}
private void scrollToVisibleItem(LinearLayoutManager llm, boolean bottom) {
int pos = llm.findLastVisibleItemPosition();
if (pos == RecyclerView.NO_POSITION)
@ -1294,7 +1296,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
public void onSelectedChanged(@Nullable RecyclerView.ViewHolder viewHolder, int actionState) {
super.onSelectedChanged(viewHolder, actionState);
swiping = (actionState == ItemTouchHelper.ACTION_STATE_SWIPE);
updateSwipeRefresh();
}
@Override

@ -40,7 +40,7 @@ public class FragmentOptions extends FragmentBase {
static String[] OPTIONS_RESTART = new String[]{
"startup", "date", "threading", "avatars", "identicons", "circular", "name_email", "subject_italic", "flags", "preview",
"addresses", "attachments_alt", "contrast", "monospaced", "autohtml", "autoimages", "actionbar",
"pull", "autoscroll", "swipenav", "autoexpand", "autoclose", "autonext",
"autoscroll", "swipenav", "autoexpand", "autoclose", "autonext",
"subscriptions", "debug",
"biometrics"
};

Loading…
Cancel
Save