Added swipe/reply option

pull/194/merge
M66B 3 years ago
parent e0a9579b9c
commit e603952a88

@ -3354,12 +3354,6 @@ For some background, see for [this Wikipedia article](https://en.wikipedia.org/w
<br />
*Swip right to reply*
Swiping an expanded message in a conversation thread to the right will reply to the sender of the message.
<br />
<a name="faq126"></a>
**(126) Can message previews be sent to my wearable?**

@ -1990,7 +1990,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean button_headers = prefs.getBoolean("button_headers", false);
boolean button_unsubscribe = prefs.getBoolean("button_unsubscribe", true);
boolean button_rule = prefs.getBoolean("button_rule", false);
boolean experiments = prefs.getBoolean("experiments", false);
boolean swipe_reply = prefs.getBoolean("swipe_reply", 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 +2014,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 || experiments ? View.GONE : View.VISIBLE);
ibAnswer.setVisibility(!tools || outbox || (!expand_all && expand_one) || !threading || swipe_reply ? 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);

@ -317,7 +317,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private String onclose;
private boolean quick_scroll;
private boolean addresses;
private boolean experiments;
private boolean swipe_reply;
private int colorPrimary;
private int colorAccent;
@ -445,7 +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);
swipe_reply = prefs.getBoolean("swipe_reply", false);
colorPrimary = Helper.resolveColor(getContext(), R.attr.colorPrimary);
colorAccent = Helper.resolveColor(getContext(), R.attr.colorAccent);
@ -2116,7 +2116,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
boolean expanded = iProperties.getValue("expanded", message.id);
if (expanded && experiments)
if (expanded && swipe_reply)
return makeMovementFlags(0, ItemTouchHelper.RIGHT);
if (EntityFolder.OUTBOX.equals(message.folderType))
@ -2194,7 +2194,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
boolean expanded = iProperties.getValue("expanded", message.id);
TupleAccountSwipes swipes;
if (expanded && experiments) {
if (expanded && swipe_reply) {
swipes = new TupleAccountSwipes();
swipes.swipe_right = EntityMessage.SWIPE_ACTION_REPLY;
swipes.right_type = null;
@ -2241,7 +2241,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
int margin = Helper.dp2pixels(context, 12);
int size = Helper.dp2pixels(context, 24);
if (expanded && experiments) {
if (expanded && swipe_reply) {
Rect r1 = new Rect();
holder.itemView.getGlobalVisibleRect(r1);
Rect r2 = new Rect();
@ -2343,7 +2343,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
boolean expanded = iProperties.getValue("expanded", message.id);
if (expanded && experiments) {
if (expanded && swipe_reply) {
adapter.notifyItemChanged(pos);
onMenuReply(message, "reply", null);
return;
@ -2432,7 +2432,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
boolean expanded = iProperties.getValue("expanded", message.id);
if (expanded && !experiments)
if (expanded && !swipe_reply)
return null;
return message;

@ -141,6 +141,7 @@ public class FragmentOptions extends FragmentBase {
"collapse_quotes", "image_placeholders", "inline_images",
"seekbar", "actionbar", "actionbar_color",
"autoscroll", "swipenav", "reversed", "swipe_close", "swipe_move", "autoexpand", "autoclose", "onclose",
"swipe_reply",
"language_detection",
"quick_filter", "quick_scroll",
"experiments", "debug",

@ -92,6 +92,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private SwitchCompat swAutoUnflag;
private SwitchCompat swAutoImportant;
private SwitchCompat swResetImportance;
private SwitchCompat swSwipeReply;
final static int MAX_SWIPE_SENSITIVITY = 10;
final static int DEFAULT_SWIPE_SENSITIVITY = 7;
@ -104,7 +105,8 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
"autoexpand", "expand_first", "expand_all", "expand_one", "collapse_multiple",
"autoclose", "onclose", "autoclose_unseen", "collapse_marked",
"undo_timeout",
"autoread", "flag_snoozed", "autounflag", "auto_important", "reset_importance"
"autoread", "flag_snoozed", "autounflag", "auto_important", "reset_importance",
"swipe_reply"
};
@Override
@ -152,6 +154,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swAutoUnflag = view.findViewById(R.id.swAutoUnflag);
swAutoImportant = view.findViewById(R.id.swAutoImportant);
swResetImportance = view.findViewById(R.id.swResetImportance);
swSwipeReply = view.findViewById(R.id.swSwipeReply);
setOptions();
@ -452,6 +455,13 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
}
});
swSwipeReply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("swipe_reply", checked).apply();
}
});
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
@ -556,6 +566,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swAutoUnflag.setChecked(prefs.getBoolean("autounflag", false));
swAutoImportant.setChecked(prefs.getBoolean("auto_important", false));
swResetImportance.setChecked(prefs.getBoolean("reset_importance", false));
swSwipeReply.setChecked(prefs.getBoolean("swipe_reply", false));
}
public static class FragmentDialogSwipes extends FragmentDialogBase {

@ -640,6 +640,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAutoImportant"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSwipeReply"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_swipe_reply"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swResetImportance"
app:switchPadding="12dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -543,6 +543,7 @@
<string name="title_advanced_autounstar">Automatically remove stars from messages on moving messages</string>
<string name="title_advanced_auto_important">Automatically make starred messages important</string>
<string name="title_advanced_reset_importance">Reset importance on moving messages</string>
<string name="title_advanced_swipe_reply">Swipe expanded messages to the right to reply</string>
<string name="title_advanced_default_snooze">Default snooze/delay time</string>
<string name="title_advanced_notifications">Manage notifications</string>

Loading…
Cancel
Save