Addes setting for send chips

This commit is contained in:
M66B 2022-02-21 13:14:51 +01:00
parent 9c390f0f55
commit 93ac369a82
4 changed files with 31 additions and 3 deletions

View File

@ -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);

View File

@ -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);

View File

@ -276,6 +276,18 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
</RadioGroup>
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSendChips"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_send_chips"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/rgFwd"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSendReminders"
android:layout_width="0dp"
@ -285,7 +297,7 @@
android:text="@string/title_advanced_send_reminders"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/rgFwd"
app:layout_constraintTop_toBottomOf="@id/swSendChips"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView

View File

@ -377,6 +377,7 @@
<string name="title_advanced_suggest_received">Suggest addresses found in received messages</string>
<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_reminders">Show reminders</string>
<string name="title_advanced_send_delayed">Delay sending messages</string>
<string name="title_advanced_attach_new">Add shared files to a new draft</string>