mirror of https://github.com/M66B/FairEmail.git
Added option to use account color for action bar
This commit is contained in:
parent
1ffc5e1dad
commit
16fbb76231
|
@ -259,6 +259,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
private boolean swipenav;
|
||||
private boolean seekbar;
|
||||
private boolean actionbar;
|
||||
private boolean actionbar_color;
|
||||
private boolean autoexpand;
|
||||
private boolean autoclose;
|
||||
private String onclose;
|
||||
|
@ -371,6 +372,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
threading = prefs.getBoolean("threading", true);
|
||||
seekbar = prefs.getBoolean("seekbar", false);
|
||||
actionbar = prefs.getBoolean("actionbar", true);
|
||||
actionbar_color = prefs.getBoolean("actionbar_color", false);
|
||||
autoexpand = prefs.getBoolean("autoexpand", true);
|
||||
autoclose = prefs.getBoolean("autoclose", true);
|
||||
onclose = (autoclose ? null : prefs.getString("onclose", null));
|
||||
|
@ -4015,17 +4017,21 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
new SimpleTask<Boolean[]>() {
|
||||
@Override
|
||||
protected Boolean[] onExecute(Context context, Bundle args) {
|
||||
long account = args.getLong("account");
|
||||
long aid = args.getLong("account");
|
||||
String thread = args.getString("thread");
|
||||
long id = args.getLong("id");
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
|
||||
EntityFolder trash = db.folder().getFolderByType(account, EntityFolder.TRASH);
|
||||
EntityFolder archive = db.folder().getFolderByType(account, EntityFolder.ARCHIVE);
|
||||
EntityAccount account = db.account().getAccount(aid);
|
||||
if (account != null && account.color != null)
|
||||
args.putInt("color", account.color);
|
||||
|
||||
EntityFolder trash = db.folder().getFolderByType(aid, EntityFolder.TRASH);
|
||||
EntityFolder archive = db.folder().getFolderByType(aid, EntityFolder.ARCHIVE);
|
||||
|
||||
List<EntityMessage> messages = db.message().getMessagesByThread(
|
||||
account, thread, threading ? null : id, null);
|
||||
aid, thread, threading ? null : id, null);
|
||||
|
||||
boolean trashable = false;
|
||||
boolean snoozable = false;
|
||||
|
@ -4061,6 +4067,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Boolean[] data) {
|
||||
if (actionbar_color && args.containsKey("color"))
|
||||
bottom_navigation.setBackgroundColor(args.getInt("color"));
|
||||
|
||||
bottom_navigation.setTag(data[0]);
|
||||
bottom_navigation.getMenu().findItem(R.id.action_delete).setVisible(data[1]);
|
||||
bottom_navigation.getMenu().findItem(R.id.action_snooze).setVisible(data[2]);
|
||||
|
|
|
@ -52,7 +52,7 @@ public class FragmentOptions extends FragmentBase {
|
|||
"keywords_header", "flags", "flags_background", "preview", "preview_italic", "preview_lines",
|
||||
"addresses", "button_archive_trash", "button_move", "attachments_alt",
|
||||
"contrast", "monospaced", "text_color", "text_size",
|
||||
"inline_images", "collapse_quotes", "seekbar", "actionbar", "navbar_colorize",
|
||||
"inline_images", "collapse_quotes", "seekbar", "actionbar", "actionbar_color", "navbar_colorize",
|
||||
"autoscroll", "swipenav", "autoexpand", "autoclose", "onclose",
|
||||
"quick_filter", "quick_scroll",
|
||||
"experiments", "debug",
|
||||
|
|
|
@ -67,6 +67,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
private SwitchCompat swIndentation;
|
||||
private SwitchCompat swSeekbar;
|
||||
private SwitchCompat swActionbar;
|
||||
private SwitchCompat swActionbarColor;
|
||||
|
||||
private SwitchCompat swHighlightUnread;
|
||||
private SwitchCompat swColorStripe;
|
||||
|
@ -114,7 +115,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
|
||||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"theme", "startup", "cards", "date", "navbar_colorize", "landscape", "landscape3",
|
||||
"threading", "indentation", "seekbar", "actionbar",
|
||||
"threading", "indentation", "seekbar", "actionbar", "actionbar_color",
|
||||
"highlight_unread", "color_stripe",
|
||||
"avatars", "gravatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
|
||||
"name_email", "prefer_contact", "distinguish_contacts",
|
||||
|
@ -149,6 +150,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
swIndentation = view.findViewById(R.id.swIndentation);
|
||||
swSeekbar = view.findViewById(R.id.swSeekbar);
|
||||
swActionbar = view.findViewById(R.id.swActionbar);
|
||||
swActionbarColor = view.findViewById(R.id.swActionbarColor);
|
||||
|
||||
swHighlightUnread = view.findViewById(R.id.swHighlightUnread);
|
||||
swColorStripe = view.findViewById(R.id.swColorStripe);
|
||||
|
@ -282,6 +284,14 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("actionbar", checked).apply();
|
||||
swActionbarColor.setEnabled(checked);
|
||||
}
|
||||
});
|
||||
|
||||
swActionbarColor.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("actionbar_color", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -691,6 +701,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
swIndentation.setEnabled(swCards.isChecked());
|
||||
swSeekbar.setChecked(prefs.getBoolean("seekbar", false));
|
||||
swActionbar.setChecked(prefs.getBoolean("actionbar", true));
|
||||
swActionbarColor.setChecked(prefs.getBoolean("actionbar_color", false));
|
||||
swActionbarColor.setEnabled(swActionbar.isChecked());
|
||||
|
||||
swHighlightUnread.setChecked(prefs.getBoolean("highlight_unread", true));
|
||||
swColorStripe.setChecked(prefs.getBoolean("color_stripe", true));
|
||||
|
|
|
@ -240,6 +240,17 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/swSeekbar"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swActionbarColor"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_actionbar_color"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swActionbar"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<!-- message -->
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
|
@ -252,7 +263,7 @@
|
|||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/swActionbar" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/swActionbarColor" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swHighlightUnread"
|
||||
|
|
|
@ -350,6 +350,7 @@
|
|||
<string name="title_advanced_images_inline">Automatically show inline images</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>
|
||||
<string name="title_advanced_navbar_colorize">Colorize the Android navigation bar</string>
|
||||
|
||||
<string name="title_advanced_double_back">Double \'back\' to exit</string>
|
||||
|
|
Loading…
Reference in New Issue