Added extra buttons option

This commit is contained in:
M66B 2021-04-17 14:14:24 +02:00
parent 051a4266f4
commit a59de04196
6 changed files with 31 additions and 5 deletions

View File

@ -1725,6 +1725,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean button_print = prefs.getBoolean("button_print", false);
boolean button_unsubscribe = prefs.getBoolean("button_unsubscribe", true);
boolean button_rule = prefs.getBoolean("button_rule", false);
boolean button_extra = prefs.getBoolean("button_extra", false);
ibSeen.setImageResource(message.ui_seen ? R.drawable.twotone_visibility_off_24 : R.drawable.twotone_visibility_24);
ibTrash.setTag(delete);
@ -1752,8 +1753,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibTools.setImageLevel(tools ? 0 : 1);
ibTools.setVisibility(outbox ? View.GONE : View.VISIBLE);
ibTrashBottom.setVisibility(button_trash && trash ? View.VISIBLE : View.GONE);
ibArchiveBottom.setVisibility(button_archive && archive ? View.VISIBLE : View.GONE);
ibTrashBottom.setVisibility(button_extra && button_trash && trash ? View.VISIBLE : View.GONE);
ibArchiveBottom.setVisibility(button_extra && button_archive && archive ? View.VISIBLE : View.GONE);
if (bind)
bindBody(message, scroll);

View File

@ -470,6 +470,9 @@ public class ApplicationEx extends Application
editor.putString("last_search1", prefs.getString("last_search", null));
editor.remove("last_search");
}
} else if (version < 1558) {
if (!prefs.contains("button_extra"))
editor.putBoolean("button_extra", true);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !BuildConfig.DEBUG)

View File

@ -92,7 +92,7 @@ public class FragmentOptions extends FragmentBase {
"name_email", "prefer_contact", "only_contact", "distinguish_contacts", "show_recipients", "authentication",
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "highlight_subject", "subject_ellipsize",
"keywords_header", "labels_header", "flags", "flags_background", "preview", "preview_italic", "preview_lines",
"message_zoom", "overview_mode", "addresses", "attachments_alt", "thumbnails",
"message_zoom", "overview_mode", "addresses", "button_extra", "attachments_alt", "thumbnails",
"contrast", "monospaced", "monospaced_pre",
"text_color", "text_size", "text_font", "text_align", "text_separators",
"collapse_quotes", "image_placeholders", "inline_images",

View File

@ -131,6 +131,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swCollapseQuotes;
private SwitchCompat swImagesPlaceholders;
private SwitchCompat swImagesInline;
private SwitchCompat swButtonExtra;
private SwitchCompat swAttachmentsAlt;
private SwitchCompat swThumbnails;
@ -152,7 +153,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
"addresses",
"message_zoom", "overview_mode", "contrast", "monospaced", "monospaced_pre",
"text_color", "text_size", "text_font", "text_align", "text_separators",
"collapse_quotes", "image_placeholders", "inline_images", "attachments_alt", "thumbnails",
"collapse_quotes", "image_placeholders", "inline_images", "button_extra", "attachments_alt", "thumbnails",
"parse_classes", "authentication"
};
@ -236,6 +237,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swCollapseQuotes = view.findViewById(R.id.swCollapseQuotes);
swImagesPlaceholders = view.findViewById(R.id.swImagesPlaceholders);
swImagesInline = view.findViewById(R.id.swImagesInline);
swButtonExtra = view.findViewById(R.id.swButtonExtra);
swAttachmentsAlt = view.findViewById(R.id.swAttachmentsAlt);
swThumbnails = view.findViewById(R.id.swThumbnails);
swParseClasses = view.findViewById(R.id.swParseClasses);
@ -815,6 +817,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swButtonExtra.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("button_extra", checked).apply();
}
});
swAttachmentsAlt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -1006,6 +1015,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swCollapseQuotes.setChecked(prefs.getBoolean("collapse_quotes", false));
swImagesPlaceholders.setChecked(prefs.getBoolean("image_placeholders", true));
swImagesInline.setChecked(prefs.getBoolean("inline_images", false));
swButtonExtra.setChecked(prefs.getBoolean("button_extra", false));
swAttachmentsAlt.setChecked(prefs.getBoolean("attachments_alt", false));
swThumbnails.setChecked(prefs.getBoolean("thumbnails", true));

View File

@ -1130,6 +1130,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swImagesInline" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swButtonExtra"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_button_extra"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvImagesInlineHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAttachmentsAlt"
android:layout_width="0dp"
@ -1138,7 +1149,7 @@
android:text="@string/title_advanced_attachments_alt"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvImagesInlineHint"
app:layout_constraintTop_toBottomOf="@id/swButtonExtra"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

View File

@ -419,6 +419,7 @@
<string name="title_advanced_collapse_quotes">Collapse quoted text</string>
<string name="title_advanced_image_placeholders">Show image placeholders</string>
<string name="title_advanced_images_inline">Automatically show inline images</string>
<string name="title_advanced_button_extra">Show extra buttons at the bottom of a message</string>
<string name="title_advanced_seekbar">Show relative conversation position with a dot</string>
<string name="title_advanced_actionbar">Show conversation action bar</string>
<string name="title_advanced_actionbar_color">Use account color as background color for conversation action bar</string>