Configurable default answer action

pull/194/merge
M66B 3 years ago
parent d939941864
commit e94e1ca408

@ -577,6 +577,10 @@ public class ApplicationEx extends Application
} else if (version < 1837) { } else if (version < 1837) {
if (!prefs.contains("compact_folders")) if (!prefs.contains("compact_folders"))
editor.putBoolean("compact_folders", false); editor.putBoolean("compact_folders", false);
} else if (version < 1839) {
boolean reply_all = prefs.getBoolean("reply_all", false);
if (reply_all)
editor.remove("reply_all").putString("answer_action", "reply_all");
} }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !BuildConfig.DEBUG) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !BuildConfig.DEBUG)

@ -2787,7 +2787,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
} }
}; };
private void onReply(boolean sender) { private void onReply(boolean long_press) {
if (values.containsKey("expanded") && values.get("expanded").size() > 0) { if (values.containsKey("expanded") && values.get("expanded").size() > 0) {
long id = values.get("expanded").get(0); long id = values.get("expanded").get(0);
int pos = adapter.getPositionForKey(id); int pos = adapter.getPositionForKey(id);
@ -2798,10 +2798,15 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (message == null) if (message == null)
return; return;
if (sender && message.content) { if (long_press && message.content) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean reply_all = prefs.getBoolean("reply_all", false); String answer_action = prefs.getString("answer_action", "reply");
onMenuReply(message, reply_all ? "reply_all" : "reply", selected); if ("reply".equals(answer_action) ||
"reply_all".equals(answer_action) ||
"list".equals(answer_action))
onMenuReply(message, answer_action, selected);
else
onMenuReply(message, answer_action);
} else } else
onReply(message, selected, fabReply); onReply(message, selected, fabReply);
} }

@ -64,7 +64,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
private SwitchCompat swSendReminders; private SwitchCompat swSendReminders;
private Spinner spSendDelayed; private Spinner spSendDelayed;
private SwitchCompat swAttachNew; private SwitchCompat swAttachNew;
private SwitchCompat swReplyAll; private Spinner spAnswerAction;
private SwitchCompat swSendPending; private SwitchCompat swSendPending;
private Spinner spComposeFont; private Spinner spComposeFont;
@ -97,7 +97,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
"suggest_names", "suggest_sent", "suggested_received", "suggest_frequently", "suggest_names", "suggest_sent", "suggested_received", "suggest_frequently",
"alt_re", "alt_fwd", "alt_re", "alt_fwd",
"send_reminders", "send_delayed", "send_reminders", "send_delayed",
"attach_new", "reply_all", "send_pending", "attach_new", "answer_action", "send_pending",
"compose_font", "prefix_once", "prefix_count", "separate_reply", "extended_reply", "write_below", "quote_reply", "quote_limit", "resize_reply", "compose_font", "prefix_once", "prefix_count", "separate_reply", "extended_reply", "write_below", "quote_reply", "quote_limit", "resize_reply",
"signature_location", "signature_new", "signature_reply", "signature_forward", "signature_location", "signature_new", "signature_reply", "signature_forward",
"discard_delete", "reply_move", "discard_delete", "reply_move",
@ -129,7 +129,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
swSendReminders = view.findViewById(R.id.swSendReminders); swSendReminders = view.findViewById(R.id.swSendReminders);
spSendDelayed = view.findViewById(R.id.spSendDelayed); spSendDelayed = view.findViewById(R.id.spSendDelayed);
swAttachNew = view.findViewById(R.id.swAttachNew); swAttachNew = view.findViewById(R.id.swAttachNew);
swReplyAll = view.findViewById(R.id.swReplyAll); spAnswerAction = view.findViewById(R.id.spAnswerAction);
swSendPending = view.findViewById(R.id.swSendPending); swSendPending = view.findViewById(R.id.swSendPending);
spComposeFont = view.findViewById(R.id.spComposeFont); spComposeFont = view.findViewById(R.id.spComposeFont);
@ -287,10 +287,16 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
} }
}); });
swReplyAll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { spAnswerAction.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
prefs.edit().putBoolean("reply_all", checked).apply(); String[] values = getResources().getStringArray(R.array.answerValues);
prefs.edit().putString("answer_action", values[position]).apply();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
prefs.edit().remove("sender_ellipsize").apply();
} }
}); });
@ -567,7 +573,16 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
} }
swAttachNew.setChecked(prefs.getBoolean("attach_new", true)); swAttachNew.setChecked(prefs.getBoolean("attach_new", true));
swReplyAll.setChecked(prefs.getBoolean("reply_all", false));
boolean reply_all = prefs.getBoolean("reply_all", false);
String answer_action = prefs.getString("answer_action", reply_all ? "reply_all" : "reply");
String[] answerValues = getResources().getStringArray(R.array.answerValues);
for (int pos = 0; pos < answerValues.length; pos++)
if (answerValues[pos].equals(answer_action)) {
spAnswerAction.setSelection(pos);
break;
}
swSendPending.setChecked(prefs.getBoolean("send_pending", true)); swSendPending.setChecked(prefs.getBoolean("send_pending", true));
String compose_font = prefs.getString("compose_font", ""); String compose_font = prefs.getString("compose_font", "");

@ -333,27 +333,27 @@
app:layout_constraintTop_toBottomOf="@id/spSendDelayed" app:layout_constraintTop_toBottomOf="@id/spSendDelayed"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <eu.faircode.email.FixedTextView
android:id="@+id/swReplyAll" android:id="@+id/tvAnswerAction"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:text="@string/title_advanced_reply_all" android:layout_marginEnd="48dp"
android:text="@string/title_advanced_answer_action"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAttachNew" app:layout_constraintTop_toBottomOf="@id/swAttachNew" />
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView <Spinner
android:id="@+id/tvReplyAll" android:id="@+id/spAnswerAction"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="48dp" android:layout_marginTop="12dp"
android:text="@string/title_advanced_reply_all_hint" android:entries="@array/answerNames"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swReplyAll" /> app:layout_constraintTop_toBottomOf="@id/tvAnswerAction" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSendPending" android:id="@+id/swSendPending"
@ -364,7 +364,7 @@
android:text="@string/title_advanced_send_pending" android:text="@string/title_advanced_send_pending"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvReplyAll" app:layout_constraintTop_toBottomOf="@id/spAnswerAction"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

@ -378,7 +378,7 @@
<string name="title_advanced_send_reminders">Show reminders</string> <string name="title_advanced_send_reminders">Show reminders</string>
<string name="title_advanced_send_delayed">Delay sending messages</string> <string name="title_advanced_send_delayed">Delay sending messages</string>
<string name="title_advanced_attach_new">Add shared files to a new draft</string> <string name="title_advanced_attach_new">Add shared files to a new draft</string>
<string name="title_advanced_reply_all">Long press answer button to reply to all</string> <string name="title_advanced_answer_action">Long pressing on the answer button will:</string>
<string name="title_advanced_send_pending">Show non-obtrusive send delayed icon</string> <string name="title_advanced_send_pending">Show non-obtrusive send delayed icon</string>
<string name="title_advanced_compose_font">Default font</string> <string name="title_advanced_compose_font">Default font</string>
@ -752,7 +752,6 @@
<string name="title_advanced_suggest_names_hint">If disabled, only email addresses will be used when selecting contacts</string> <string name="title_advanced_suggest_names_hint">If disabled, only email addresses will be used when selecting contacts</string>
<string name="title_advanced_suggest_local_hint">In addition to contacts provided by Android. Contact data will be stored for newly sent or received messages only when enabled.</string> <string name="title_advanced_suggest_local_hint">In addition to contacts provided by Android. Contact data will be stored for newly sent or received messages only when enabled.</string>
<string name="title_advanced_send_reminders_hint">Show a warning when the message text or the subject is empty or when an attachment might be missing</string> <string name="title_advanced_send_reminders_hint">Show a warning when the message text or the subject is empty or when an attachment might be missing</string>
<string name="title_advanced_reply_all_hint">If disabled, long pressing the answer button will answer the sender</string>
<string name="title_advanced_reply_move_hint">The email server could still add the messages to the sent message folder</string> <string name="title_advanced_reply_move_hint">The email server could still add the messages to the sent message folder</string>
<string name="title_advanced_usenet_hint">Insert \'-- \' between the text and the signature</string> <string name="title_advanced_usenet_hint">Insert \'-- \' between the text and the signature</string>
<string name="title_advanced_remove_signature_hint">This can result in too little or too much text being removed</string> <string name="title_advanced_remove_signature_hint">This can result in too little or too much text being removed</string>
@ -2235,6 +2234,24 @@
<item>Extra large</item> <item>Extra large</item>
</string-array> </string-array>
<string-array name="answerValues" translatable="false">
<item>reply</item>
<item>reply_all</item>
<item>list</item>
<item>forward</item>
<item>resend</item>
<item>editasnew</item>
</string-array>
<string-array name="answerNames" translatable="false">
<item>@string/title_reply_to_sender</item>
<item>@string/title_reply_to_all</item>
<item>@string/title_reply_list</item>
<item>@string/title_forward</item>
<item>@string/title_resend</item>
<item>@string/title_editasnew</item>
</string-array>
<string name="fingerprint" translatable="false">17BA15C1AF55D925F98B99CEA4375D4CDF4C174B</string> <string name="fingerprint" translatable="false">17BA15C1AF55D925F98B99CEA4375D4CDF4C174B</string>
<string name="fingerprint_fdroid" translatable="false">77CD40058858DC3A38523E01C227A39AA019F88B</string> <string name="fingerprint_fdroid" translatable="false">77CD40058858DC3A38523E01C227A39AA019F88B</string>
<string name="fingerprint_amazon" translatable="false">200D0AA43A8ADBC7BB8237023C1553F4753CA7D2</string> <string name="fingerprint_amazon" translatable="false">200D0AA43A8ADBC7BB8237023C1553F4753CA7D2</string>

Loading…
Cancel
Save