Prevent crash

pull/184/head
M66B 4 years ago
parent db20baf31e
commit 71b440b3da

@ -1308,86 +1308,94 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
} }
}); });
if (viewType == AdapterMessage.ViewType.THREAD) { if (viewType == AdapterMessage.ViewType.THREAD)
boolean swipe_close = prefs.getBoolean("swipe_close", false); try {
boolean swipe_move = prefs.getBoolean("swipe_move", false); boolean swipe_close = prefs.getBoolean("swipe_close", false);
IOverScrollDecor decor = new VerticalOverScrollBounceEffectDecorator( boolean swipe_move = prefs.getBoolean("swipe_move", false);
new RecyclerViewOverScrollDecorAdapter(rvMessage, touchHelper) { IOverScrollDecor decor = new VerticalOverScrollBounceEffectDecorator(
@Override new RecyclerViewOverScrollDecorAdapter(rvMessage, touchHelper) {
public boolean isInAbsoluteStart() { @Override
if (!swipe_close) public boolean isInAbsoluteStart() {
return false; if (!swipe_close)
return super.isInAbsoluteStart(); return false;
} return super.isInAbsoluteStart();
}
@Override
public boolean isInAbsoluteEnd() {
PagedList<TupleMessageEx> list = ((AdapterMessage) rvMessage.getAdapter()).getCurrentList();
if (list == null)
return false;
boolean moveable = false; @Override
for (TupleMessageEx message : list) { public boolean isInAbsoluteEnd() {
if (message == null) PagedList<TupleMessageEx> list = ((AdapterMessage) rvMessage.getAdapter()).getCurrentList();
if (list == null)
return false; return false;
if (!EntityFolder.isOutgoing(message.folderType) && boolean moveable = false;
(!filter_archive || !EntityFolder.ARCHIVE.equals(message.folderType))) { for (TupleMessageEx message : list) {
moveable = true; if (message == null)
break; return false;
if (!EntityFolder.isOutgoing(message.folderType) &&
(!filter_archive || !EntityFolder.ARCHIVE.equals(message.folderType))) {
moveable = true;
break;
}
} }
if (!moveable)
return false;
if (!swipe_move)
return false;
return super.isInAbsoluteEnd();
} }
},
DEFAULT_TOUCH_DRAG_MOVE_RATIO_FWD,
DEFAULT_TOUCH_DRAG_MOVE_RATIO_BCK,
DEFAULT_DECELERATE_FACTOR
);
decor.setOverScrollUpdateListener(new IOverScrollUpdateListener() {
private boolean triggered = false;
if (!moveable) @Override
return false; public void onOverScrollUpdate(IOverScrollDecor decor, int state, float offset) {
float height = decor.getView().getHeight();
if (height == 0)
return;
if (!swipe_move) if (offset == 0)
return false; triggered = false;
return super.isInAbsoluteEnd(); else if (!triggered) {
} float dx = Math.abs(offset * DEFAULT_TOUCH_DRAG_MOVE_RATIO_FWD);
}, if (offset > 0 && dx > height / 4) {
DEFAULT_TOUCH_DRAG_MOVE_RATIO_FWD, triggered = true;
DEFAULT_TOUCH_DRAG_MOVE_RATIO_BCK, handleAutoClose();
DEFAULT_DECELERATE_FACTOR }
);
decor.setOverScrollUpdateListener(new IOverScrollUpdateListener() {
private boolean triggered = false;
@Override if (offset < 0 && dx > height / 8) {
public void onOverScrollUpdate(IOverScrollDecor decor, int state, float offset) { triggered = true;
float height = decor.getView().getHeight();
if (height == 0)
return;
if (offset == 0) Bundle args = new Bundle();
triggered = false; args.putString("title", getString(R.string.title_move_to_folder));
else if (!triggered) { args.putLong("account", account);
float dx = Math.abs(offset * DEFAULT_TOUCH_DRAG_MOVE_RATIO_FWD); args.putString("thread", thread);
if (offset > 0 && dx > height / 4) { args.putLong("id", id);
triggered = true; args.putBoolean("filter_archive", filter_archive);
handleAutoClose(); args.putLongArray("disabled", new long[]{folder});
}
if (offset < 0 && dx > height / 8) { FragmentDialogFolder fragment = new FragmentDialogFolder();
triggered = true; fragment.setArguments(args);
fragment.setTargetFragment(FragmentMessages.this, REQUEST_THREAD_MOVE);
Bundle args = new Bundle(); fragment.show(getParentFragmentManager(), "overscroll:move");
args.putString("title", getString(R.string.title_move_to_folder)); }
args.putLong("account", account);
args.putString("thread", thread);
args.putLong("id", id);
args.putBoolean("filter_archive", filter_archive);
args.putLongArray("disabled", new long[]{folder});
FragmentDialogFolder fragment = new FragmentDialogFolder();
fragment.setArguments(args);
fragment.setTargetFragment(FragmentMessages.this, REQUEST_THREAD_MOVE);
fragment.show(getParentFragmentManager(), "overscroll:move");
} }
} }
} });
}); } catch (Throwable ex) {
} /*
java.lang.NoClassDefFoundError: Failed resolution of: Lme/a/a/a/a/a/b$1;
at me.a.a.a.a.a.b.setUpTouchHelperCallback(SourceFile:78)
at me.a.a.a.a.a.b.<init>(SourceFile:69)
at eu.faircode.email.FragmentMessages$29.<init>(SourceFile:1315)
*/
}
final String pkg = Helper.getOpenKeychainPackage(getContext()); final String pkg = Helper.getOpenKeychainPackage(getContext());
Log.i("PGP binding to " + pkg); Log.i("PGP binding to " + pkg);

Loading…
Cancel
Save