Added option to disable message archive/trash buttons

This commit is contained in:
M66B 2020-03-23 16:01:17 +01:00
parent b6d5aeb1c0
commit a709812ab8
5 changed files with 31 additions and 5 deletions

View File

@ -1556,6 +1556,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
final boolean delete = (inTrash || !hasTrash || outbox || message.uid == null);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean archive_trash = prefs.getBoolean("archive_trash", true);
boolean expand_all = prefs.getBoolean("expand_all", false);
boolean expand_one = prefs.getBoolean("expand_one", true);
@ -1569,8 +1570,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibUnsubscribe.setVisibility(message.unsubscribe == null ? View.GONE : View.VISIBLE);
ibAnswer.setVisibility(outbox || (!expand_all && expand_one) ? View.GONE : View.VISIBLE);
ibMove.setVisibility(move ? View.VISIBLE : View.GONE);
ibArchive.setVisibility(archive ? View.VISIBLE : View.GONE);
ibTrash.setVisibility(trash ? View.VISIBLE : View.GONE);
ibArchive.setVisibility(archive && archive_trash ? View.VISIBLE : View.GONE);
ibTrash.setVisibility(trash && archive_trash ? View.VISIBLE : View.GONE);
ibJunk.setVisibility(junk || unjunk ? View.VISIBLE : View.GONE);
bindBody(message, scroll);

View File

@ -50,7 +50,7 @@ public class FragmentOptions extends FragmentBase {
"name_email", "prefer_contact", "distinguish_contacts", "authentication",
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "highlight_subject", "subject_ellipsize",
"keywords_header", "flags", "flags_background", "preview", "preview_italic", "preview_lines",
"addresses", "attachments_alt",
"addresses", "archive_trash", "attachments_alt",
"contrast", "monospaced", "text_color", "text_size",
"inline_images", "collapse_quotes", "seekbar", "actionbar", "navbar_colorize",
"autoscroll", "swipenav", "autoexpand", "autoclose", "onclose",

View File

@ -98,6 +98,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swPreviewItalic;
private Spinner spPreviewLines;
private SwitchCompat swAddresses;
private SwitchCompat swArchiveTrash;
private SwitchCompat swContrast;
private SwitchCompat swMonospaced;
@ -116,7 +117,9 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
"avatars", "gravatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
"name_email", "prefer_contact", "distinguish_contacts",
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "highlight_subject", "subject_ellipsize",
"keywords_header", "flags", "flags_background", "preview", "preview_italic", "preview_lines", "addresses",
"keywords_header", "flags", "flags_background",
"preview", "preview_italic", "preview_lines",
"addresses", "archive_trash",
"contrast", "monospaced", "text_color", "text_size",
"inline_images", "collapse_quotes", "attachments_alt",
"authentication"
@ -175,6 +178,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swPreviewItalic = view.findViewById(R.id.swPreviewItalic);
spPreviewLines = view.findViewById(R.id.spPreviewLines);
swAddresses = view.findViewById(R.id.swAddresses);
swArchiveTrash = view.findViewById(R.id.swArchiveTrash);
swContrast = view.findViewById(R.id.swContrast);
swMonospaced = view.findViewById(R.id.swMonospaced);
swTextColor = view.findViewById(R.id.swTextColor);
@ -541,6 +545,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swArchiveTrash.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("archive_trash", checked).apply();
}
});
swContrast.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -728,6 +739,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
spPreviewLines.setSelection(prefs.getInt("preview_lines", 2) - 1);
spPreviewLines.setEnabled(swPreview.isChecked());
swAddresses.setChecked(prefs.getBoolean("addresses", false));
swArchiveTrash.setChecked(prefs.getBoolean("archive_trash", true));
swContrast.setChecked(prefs.getBoolean("contrast", false));
swMonospaced.setChecked(prefs.getBoolean("monospaced", false));
swTextColor.setChecked(prefs.getBoolean("text_color", true));

View File

@ -710,6 +710,18 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvPreviewIssue" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swArchiveTrash"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_archive_trash"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCaptionBody"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAddresses"
android:layout_width="0dp"
@ -718,7 +730,7 @@
android:text="@string/title_advanced_addresses"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCaptionBody"
app:layout_constraintTop_toBottomOf="@id/swArchiveTrash"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

View File

@ -340,6 +340,7 @@
<string name="title_advanced_preview">Show message preview</string>
<string name="title_advanced_preview_italic">Show message preview in italics</string>
<string name="title_advanced_preview_lines">Number of preview lines</string>
<string name="title_advanced_archive_trash">Show buttons to archive or trash a message</string>
<string name="title_advanced_addresses">Show address details by default</string>
<string name="title_advanced_attachments_alt">Show attachments after the message text</string>
<string name="title_advanced_contrast">Use high contrast for message text</string>