From 93ac369a82c2f94abd2f6ef17ff249fe2207319c Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 21 Feb 2022 13:14:51 +0100 Subject: [PATCH] Addes setting for send chips --- .../faircode/email/EditTextMultiAutoComplete.java | 7 ++++++- .../eu/faircode/email/FragmentOptionsSend.java | 12 +++++++++++- app/src/main/res/layout/fragment_options_send.xml | 14 +++++++++++++- app/src/main/res/values/strings.xml | 1 + 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EditTextMultiAutoComplete.java b/app/src/main/java/eu/faircode/email/EditTextMultiAutoComplete.java index 4842d9d9f3..4667d67f2e 100644 --- a/app/src/main/java/eu/faircode/email/EditTextMultiAutoComplete.java +++ b/app/src/main/java/eu/faircode/email/EditTextMultiAutoComplete.java @@ -21,6 +21,7 @@ package eu.faircode.email; import android.content.ContentResolver; import android.content.Context; +import android.content.SharedPreferences; import android.graphics.Canvas; import android.graphics.drawable.Drawable; import android.net.Uri; @@ -39,6 +40,7 @@ import android.view.MotionEvent; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView; +import androidx.preference.PreferenceManager; import com.google.android.material.chip.ChipDrawable; @@ -69,7 +71,10 @@ public class EditTextMultiAutoComplete extends AppCompatMultiAutoCompleteTextVie private void init(Context context) { Helper.setKeyboardIncognitoMode(this, context); - if (BuildConfig.DEBUG) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + boolean send_chips = prefs.getBoolean("send_chips", false); + + if (send_chips) { boolean dark = Helper.isDarkTheme(context); ContextThemeWrapper ctx = new ContextThemeWrapper(context, dark ? R.style.Base_Theme_Material3_Dark : R.style.Base_Theme_Material3_Light); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java b/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java index 65aa5d695c..20c0791784 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java @@ -61,6 +61,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc private SwitchCompat swPrefixCount; private RadioGroup rgRe; private RadioGroup rgFwd; + private SwitchCompat swSendChips; private SwitchCompat swSendReminders; private Spinner spSendDelayed; private SwitchCompat swAttachNew; @@ -96,7 +97,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc "keyboard", "keyboard_no_fullscreen", "suggest_names", "suggest_sent", "suggested_received", "suggest_frequently", "alt_re", "alt_fwd", - "send_reminders", "send_delayed", + "send_reminders", "send_chips", "send_delayed", "attach_new", "answer_action", "send_pending", "compose_font", "prefix_once", "prefix_count", "separate_reply", "extended_reply", "write_below", "quote_reply", "quote_limit", "resize_reply", "signature_location", "signature_new", "signature_reply", "signature_forward", @@ -126,6 +127,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc swPrefixCount = view.findViewById(R.id.swPrefixCount); rgRe = view.findViewById(R.id.rgRe); rgFwd = view.findViewById(R.id.rgFwd); + swSendChips = view.findViewById(R.id.swSendChips); swSendReminders = view.findViewById(R.id.swSendReminders); spSendDelayed = view.findViewById(R.id.spSendDelayed); swAttachNew = view.findViewById(R.id.swAttachNew); @@ -260,6 +262,13 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc } }); + swSendChips.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("send_chips", checked).apply(); + } + }); + swSendReminders.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -562,6 +571,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc rgRe.check(prefs.getBoolean("alt_re", false) ? R.id.rbRe2 : R.id.rbRe1); rgFwd.check(prefs.getBoolean("alt_fwd", false) ? R.id.rbFwd2 : R.id.rbFwd1); + swSendChips.setChecked(prefs.getBoolean("send_chips", false)); swSendReminders.setChecked(prefs.getBoolean("send_reminders", true)); int send_delayed = prefs.getInt("send_delayed", 0); diff --git a/app/src/main/res/layout/fragment_options_send.xml b/app/src/main/res/layout/fragment_options_send.xml index a28cb70615..432e93a135 100644 --- a/app/src/main/res/layout/fragment_options_send.xml +++ b/app/src/main/res/layout/fragment_options_send.xml @@ -276,6 +276,18 @@ android:textAppearance="@style/TextAppearance.AppCompat.Small" /> + + Suggest addresses found in received messages Sort suggested addresses on frequency of use Alternative reply/forward prefix + Show address bubbles Show reminders Delay sending messages Add shared files to a new draft