mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-22 14:11:00 +00:00
Added option to use the identity color for the bottom action bar
This commit is contained in:
parent
a98a855f50
commit
33382a6579
4 changed files with 35 additions and 4 deletions
|
@ -290,6 +290,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
private boolean media = true;
|
||||
private boolean compact = false;
|
||||
private int zoom = 0;
|
||||
private boolean nav_color;
|
||||
private boolean lt_enabled;
|
||||
private boolean lt_auto;
|
||||
|
||||
|
@ -355,6 +356,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
media = prefs.getBoolean("compose_media", true);
|
||||
compact = prefs.getBoolean("compose_compact", false);
|
||||
zoom = prefs.getInt("compose_zoom", compact ? 0 : 1);
|
||||
nav_color = prefs.getBoolean("send_nav_color", false);
|
||||
|
||||
lt_enabled = LanguageTool.isEnabled(context);
|
||||
lt_auto = LanguageTool.isAuto(context);
|
||||
|
@ -7680,16 +7682,22 @@ public class FragmentCompose extends FragmentBase {
|
|||
private AdapterView.OnItemSelectedListener identitySelected = new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
EntityIdentity identity = (EntityIdentity) parent.getAdapter().getItem(position);
|
||||
final Context context = view.getContext();
|
||||
TupleIdentityEx identity = (TupleIdentityEx) parent.getAdapter().getItem(position);
|
||||
|
||||
int at = (identity == null ? -1 : identity.email.indexOf('@'));
|
||||
etExtra.setHint(at < 0 ? null : identity.email.substring(0, at));
|
||||
tvDomain.setText(at < 0 ? null : identity.email.substring(at));
|
||||
grpExtra.setVisibility(identity != null && identity.sender_extra ? View.VISIBLE : View.GONE);
|
||||
|
||||
if (identity != null && nav_color) {
|
||||
Integer color = (identity.color == null ? identity.accountColor : identity.color);
|
||||
bottom_navigation.setBackgroundColor(color == null
|
||||
? Helper.resolveColor(context, R.attr.colorPrimary) : color);
|
||||
}
|
||||
|
||||
Spanned signature = null;
|
||||
if (identity != null && !TextUtils.isEmpty(identity.signature)) {
|
||||
final Context context = getContext();
|
||||
Document d = HtmlHelper.sanitizeCompose(context, identity.signature, true);
|
||||
signature = HtmlHelper.fromDocument(context, d, new HtmlHelper.ImageGetterEx() {
|
||||
@Override
|
||||
|
|
|
@ -72,6 +72,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
private SwitchCompat swAutoIdentity;
|
||||
private Button btnLocalContacts;
|
||||
private SwitchCompat swSendChips;
|
||||
private SwitchCompat swNavColor;
|
||||
private SwitchCompat swSendReminders;
|
||||
private SwitchCompat swSendPending;
|
||||
private SwitchCompat swAutoSaveParagraph;
|
||||
|
@ -121,7 +122,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"keyboard", "keyboard_no_fullscreen",
|
||||
"suggest_names", "suggest_sent", "suggested_received", "suggest_frequently", "auto_identity",
|
||||
"send_reminders", "send_chips", "send_pending",
|
||||
"send_reminders", "send_chips", "send_nav_color", "send_pending",
|
||||
"auto_save_paragraph", "auto_save_dot", "discard_delete",
|
||||
"send_delayed",
|
||||
"answer_single", "answer_action",
|
||||
|
@ -158,6 +159,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
swAutoIdentity = view.findViewById(R.id.swAutoIdentity);
|
||||
btnLocalContacts = view.findViewById(R.id.btnLocalContacts);
|
||||
swSendChips = view.findViewById(R.id.swSendChips);
|
||||
swNavColor = view.findViewById(R.id.swNavColor);
|
||||
swSendReminders = view.findViewById(R.id.swSendReminders);
|
||||
swSendPending = view.findViewById(R.id.swSendPending);
|
||||
swAutoSaveParagraph = view.findViewById(R.id.swAutoSaveParagraph);
|
||||
|
@ -302,6 +304,13 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
}
|
||||
});
|
||||
|
||||
swNavColor.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("send_nav_color", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swSendReminders.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -748,6 +757,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
swAutoIdentity.setChecked(prefs.getBoolean("auto_identity", false));
|
||||
swAutoIdentity.setEnabled(swSuggestSent.isChecked() || swSuggestReceived.isChecked());
|
||||
swSendChips.setChecked(prefs.getBoolean("send_chips", true));
|
||||
swNavColor.setChecked(prefs.getBoolean("send_nav_color", false));
|
||||
swSendReminders.setChecked(prefs.getBoolean("send_reminders", true));
|
||||
swSendPending.setChecked(prefs.getBoolean("send_pending", true));
|
||||
swAutoSaveParagraph.setChecked(prefs.getBoolean("auto_save_paragraph", true));
|
||||
|
|
|
@ -232,6 +232,18 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/btnLocalContacts"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swNavColor"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_send_nav_color"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swSendChips"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swSendReminders"
|
||||
android:layout_width="0dp"
|
||||
|
@ -241,7 +253,7 @@
|
|||
android:text="@string/title_advanced_send_reminders"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swSendChips"
|
||||
app:layout_constraintTop_toBottomOf="@id/swNavColor"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -444,6 +444,7 @@
|
|||
<string name="title_advanced_suggest_frequently">Sort suggested addresses on frequency of use</string>
|
||||
<string name="title_advanced_alt_re_fwd">Alternative reply/forward prefix</string>
|
||||
<string name="title_advanced_send_chips">Show address bubbles</string>
|
||||
<string name="title_advanced_send_nav_color">Use the identity color for the bottom action bar</string>
|
||||
<string name="title_advanced_send_reminders">Show reminders</string>
|
||||
<string name="title_advanced_send_delayed">Delay sending messages</string>
|
||||
<string name="title_advanced_attach_new">Create a new draft message for shared addresses and files</string>
|
||||
|
|
Loading…
Reference in a new issue