Added reply button option

This commit is contained in:
M66B 2024-03-26 07:28:59 +01:00
parent 3667bc468e
commit ac5830d111
3 changed files with 25 additions and 2 deletions

View File

@ -2335,6 +2335,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean expand_all = prefs.getBoolean("expand_all", false);
boolean expand_one = prefs.getBoolean("expand_one", true);
boolean swipe_reply = prefs.getBoolean("swipe_reply", false);
boolean tools = prefs.getBoolean("message_tools", true);
boolean button_junk = prefs.getBoolean("button_junk", true);
boolean button_trash = prefs.getBoolean("button_trash", true);
@ -2361,7 +2362,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean button_raw = prefs.getBoolean("button_raw", false);
boolean button_unsubscribe = prefs.getBoolean("button_unsubscribe", true);
boolean button_rule = prefs.getBoolean("button_rule", false);
boolean swipe_reply = prefs.getBoolean("swipe_reply", false);
boolean button_answer = prefs.getBoolean("button_answer", false);
int importance = (((message.ui_importance == null ? 1 : message.ui_importance) + 1) % 3);
@ -2375,7 +2376,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibInbox.setImageResource(inJunk ? R.drawable.twotone_report_off_24 : R.drawable.twotone_inbox_24);
ibUndo.setVisibility(outbox ? View.VISIBLE : View.GONE);
ibAnswer.setVisibility(!tools || outbox || (!expand_all && expand_one) || !threading || swipe_reply ? View.GONE : View.VISIBLE);
ibAnswer.setVisibility(!tools || outbox || (!expand_all && expand_one && !button_answer) || (!threading && !button_answer) || (swipe_reply && !button_answer) ? View.GONE : View.VISIBLE);
ibRule.setVisibility(tools && button_rule && !outbox && !message.folderReadOnly ? View.VISIBLE : View.GONE);
ibUnsubscribe.setVisibility(tools && button_unsubscribe && message.unsubscribe != null ? View.VISIBLE : View.GONE);
ibRaw.setVisibility(tools && button_raw && raw ? View.VISIBLE : View.GONE);

View File

@ -67,6 +67,7 @@ public class FragmentDialogButtons extends FragmentDialogBase {
final CheckBox cbHtml = dview.findViewById(R.id.cbHtml);
final CheckBox cbRaw = dview.findViewById(R.id.cbRaw);
final CheckBox cbUnsubscribe = dview.findViewById(R.id.cbUnsubscribe);
final CheckBox cbAnswer = dview.findViewById(R.id.cbAnswer);
cbTranslate.setVisibility(DeepL.isAvailable(context) ? View.VISIBLE : View.GONE);
cbPin.setVisibility(Shortcuts.can(context) ? View.VISIBLE : View.GONE);
@ -96,6 +97,13 @@ public class FragmentDialogButtons extends FragmentDialogBase {
cbHtml.setChecked(prefs.getBoolean("button_html", false));
cbRaw.setChecked(prefs.getBoolean("button_raw", false));
cbUnsubscribe.setChecked(prefs.getBoolean("button_unsubscribe", true));
cbAnswer.setChecked(prefs.getBoolean("button_answer", false));
boolean expand_all = prefs.getBoolean("expand_all", false);
boolean expand_one = prefs.getBoolean("expand_one", true);
boolean threading = prefs.getBoolean("threading", true);
boolean swipe_reply = prefs.getBoolean("swipe_reply", false);
cbAnswer.setVisibility((!expand_all && expand_one) || !threading || swipe_reply ? View.VISIBLE : View.GONE);
return new AlertDialog.Builder(getContext())
.setView(dview)
@ -128,6 +136,7 @@ public class FragmentDialogButtons extends FragmentDialogBase {
editor.putBoolean("button_html", cbHtml.isChecked());
editor.putBoolean("button_raw", cbRaw.isChecked());
editor.putBoolean("button_unsubscribe", cbUnsubscribe.isChecked());
editor.putBoolean("button_answer", cbAnswer.isChecked());
editor.apply();
sendResult(Activity.RESULT_OK);
}

View File

@ -355,5 +355,18 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbUnsubscribe" />
<CheckBox
android:id="@+id/cbAnswer"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableEnd="@drawable/twotone_reply_24"
android:drawablePadding="6dp"
android:text="@string/title_reply"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbRule" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>