Experiment: swipe left/right to reply

pull/194/merge
M66B 3 years ago
parent 166a9720d2
commit 9df54b0659

@ -1991,6 +1991,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean button_unsubscribe = prefs.getBoolean("button_unsubscribe", true);
boolean button_rule = prefs.getBoolean("button_rule", false);
boolean button_extra = prefs.getBoolean("button_extra", false);
boolean experiments = prefs.getBoolean("experiments", false);
ibHide.setImageResource(message.ui_snoozed == null ? R.drawable.twotone_visibility_off_24 : R.drawable.twotone_visibility_24);
ibSeen.setImageResource(message.ui_seen ? R.drawable.twotone_mail_24 : R.drawable.twotone_drafts_24);
@ -2014,7 +2015,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibForceLight.setImageLevel(force_light ? 1 : 0);
ibHide.setVisibility(tools && button_hide && !outbox ? View.VISIBLE : View.GONE);
ibSeen.setVisibility(tools && button_seen && !outbox && seen ? View.VISIBLE : View.GONE);
ibAnswer.setVisibility(!tools || outbox || (!expand_all && expand_one) || !threading ? View.GONE : View.VISIBLE);
ibAnswer.setVisibility(!tools || outbox || (!expand_all && expand_one) || !threading || experiments ? View.GONE : View.VISIBLE);
ibNotes.setVisibility(tools && button_notes && !outbox ? View.VISIBLE : View.GONE);
ibLabels.setVisibility(tools && labels_header && labels ? View.VISIBLE : View.GONE);
ibKeywords.setVisibility(tools && button_keywords && keywords ? View.VISIBLE : View.GONE);

@ -113,6 +113,7 @@ public class EntityMessage implements Serializable {
static final Long SWIPE_ACTION_FLAG = -6L;
static final Long SWIPE_ACTION_DELETE = -7L;
static final Long SWIPE_ACTION_JUNK = -8L;
static final Long SWIPE_ACTION_REPLY = -9L;
@PrimaryKey(autoGenerate = true)
public Long id;

@ -317,6 +317,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private String onclose;
private boolean quick_scroll;
private boolean addresses;
private boolean experiments;
private int colorPrimary;
private int colorAccent;
@ -444,6 +445,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
onclose = (autoclose ? null : prefs.getString("onclose", null));
quick_scroll = prefs.getBoolean("quick_scroll", true);
addresses = prefs.getBoolean("addresses", false);
experiments = prefs.getBoolean("experiments", false);
colorPrimary = Helper.resolveColor(getContext(), R.attr.colorPrimary);
colorAccent = Helper.resolveColor(getContext(), R.attr.colorAccent);
@ -2121,6 +2123,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (message == null)
return 0;
if (experiments &&
iProperties.getValue("expanded", message.id))
return makeMovementFlags(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT);
if (EntityFolder.OUTBOX.equals(message.folderType))
return makeMovementFlags(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT);
@ -2194,7 +2200,14 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
return;
TupleAccountSwipes swipes;
if (EntityFolder.OUTBOX.equals(message.folderType)) {
if (experiments &&
iProperties.getValue("expanded", message.id)) {
swipes = new TupleAccountSwipes();
swipes.swipe_right = EntityMessage.SWIPE_ACTION_REPLY;
swipes.right_type = null;
swipes.swipe_left = EntityMessage.SWIPE_ACTION_REPLY;
swipes.left_type = null;
} else if (EntityFolder.OUTBOX.equals(message.folderType)) {
swipes = new TupleAccountSwipes();
swipes.swipe_right = 0L;
swipes.right_type = EntityFolder.DRAFTS;
@ -2256,6 +2269,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
(action.equals(message.folder) && EntityFolder.TRASH.equals(message.folderType)) ||
(EntityFolder.TRASH.equals(actionType) && EntityFolder.JUNK.equals(message.folderType)))
icon = R.drawable.twotone_delete_forever_24;
else if (EntityMessage.SWIPE_ACTION_REPLY.equals(action))
icon = R.drawable.twotone_reply_24;
else
icon = EntityFolder.getIcon(dX > 0 ? swipes.right_type : swipes.left_type);
@ -2324,6 +2339,13 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
return;
}
if (experiments &&
iProperties.getValue("expanded", message.id)) {
adapter.notifyItemChanged(pos);
onMenuReply(message, "reply", null);
return;
}
if (EntityFolder.OUTBOX.equals(message.folderType)) {
ActivityCompose.undoSend(message.id, getContext(), getViewLifecycleOwner(), getParentFragmentManager());
return;
@ -2405,7 +2427,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (message == null)
return null;
if (iProperties.getValue("expanded", message.id))
if (!experiments &&
iProperties.getValue("expanded", message.id))
return null;
return message;

Loading…
Cancel
Save