Added settings to enable/disable color stripes, quick filter and quick scroll

This commit is contained in:
M66B 2019-12-30 11:44:09 +01:00
parent 7a02055253
commit 3f1c6a949a
10 changed files with 94 additions and 11 deletions

View File

@ -196,6 +196,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private boolean date;
private boolean threading;
private boolean avatars;
private boolean color_stripe;
private boolean name_email;
private boolean distinguish_contacts;
private Float font_size_sender;
@ -792,6 +793,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
vwColor.setTag(colorBackground);
vwColor.setBackgroundColor(colorBackground);
}
vwColor.setVisibility(color_stripe ? View.VISIBLE : View.GONE);
// Expander
if (ibExpander.getTag() == null || (boolean) ibExpander.getTag() != expanded) {
@ -3895,6 +3897,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.date = prefs.getBoolean("date", true);
this.threading = prefs.getBoolean("threading", true);
this.avatars = (contacts && avatars) || generated;
this.color_stripe = prefs.getBoolean("color_stripe", true);
this.name_email = prefs.getBoolean("name_email", false);
this.distinguish_contacts = prefs.getBoolean("distinguish_contacts", false);

View File

@ -190,6 +190,12 @@ public class ApplicationEx extends Application {
} else if (version < 844) {
if (prefs.getBoolean("schedule", false))
editor.putBoolean("enabled", true);
} else if (version < 874) {
if (prefs.contains("experiments") &&
prefs.getBoolean("experiments", false))
editor.putBoolean("quick_filter", true);
editor.remove("experiments");
}
if (BuildConfig.DEBUG && false) {

View File

@ -232,6 +232,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private boolean autoexpand;
private boolean autoclose;
private String onclose;
private boolean quick_scroll;
private boolean addresses;
private int colorPrimary;
@ -337,6 +338,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
autoexpand = prefs.getBoolean("autoexpand", true);
autoclose = prefs.getBoolean("autoclose", true);
onclose = (autoclose ? null : prefs.getString("onclose", null));
quick_scroll = prefs.getBoolean("quick_scroll", true);
addresses = prefs.getBoolean("addresses", false);
colorPrimary = Helper.resolveColor(getContext(), R.attr.colorPrimary);
@ -2859,7 +2861,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
boolean filter_snoozed = prefs.getBoolean("filter_snoozed", true);
boolean filter_duplicates = prefs.getBoolean("filter_duplicates", true);
boolean compact = prefs.getBoolean("compact", false);
boolean experiments = prefs.getBoolean("experiments", false);
boolean quick_filter = prefs.getBoolean("quick_filter", false);
boolean outbox = EntityFolder.OUTBOX.equals(type);
boolean folder =
@ -2936,9 +2938,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
ibUnflagged.setImageResource(filter_unflagged ? R.drawable.baseline_star_border_24 : R.drawable.baseline_star_24);
ibSnoozed.setImageResource(filter_snoozed ? R.drawable.baseline_visibility_off_24 : R.drawable.baseline_visibility_24);
ibSeen.setVisibility(experiments && folder ? View.VISIBLE : View.GONE);
ibUnflagged.setVisibility(experiments && folder ? View.VISIBLE : View.GONE);
ibSnoozed.setVisibility(experiments && folder && canSnooze ? View.VISIBLE : View.GONE);
ibSeen.setVisibility(quick_filter && folder ? View.VISIBLE : View.GONE);
ibUnflagged.setVisibility(quick_filter && folder ? View.VISIBLE : View.GONE);
ibSnoozed.setVisibility(quick_filter && folder && canSnooze ? View.VISIBLE : View.GONE);
super.onPrepareOptionsMenu(menu);
}
@ -3554,8 +3556,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
} else
fabReply.hide();
ibDown.setVisibility(expanded > 0 ? View.VISIBLE : View.GONE);
ibUp.setVisibility(expanded > 0 ? View.VISIBLE : View.GONE);
ibDown.setVisibility(quick_scroll && expanded > 0 ? View.VISIBLE : View.GONE);
ibUp.setVisibility(quick_scroll && expanded > 0 ? View.VISIBLE : View.GONE);
}
private void handleExpand(long id) {

View File

@ -39,7 +39,7 @@ public class FragmentOptions extends FragmentBase {
static String[] OPTIONS_RESTART = new String[]{
"subscriptions",
"landscape", "startup", "cards", "indentation", "date", "threading", "highlight_unread",
"landscape", "startup", "cards", "indentation", "date", "threading", "highlight_unread", "color_stripe",
"avatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
"name_email", "distinguish_contacts", "authentication",
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "subject_ellipsize",
@ -48,6 +48,7 @@ public class FragmentOptions extends FragmentBase {
"contrast", "monospaced", "text_color",
"inline_images", "collapse_quotes", "seekbar", "actionbar",
"autoscroll", "swipenav", "autoexpand", "autoclose", "onclose",
"quick_filter", "quick_scroll",
"experiments", "debug",
"biometrics"
};

View File

@ -52,6 +52,8 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private SwitchCompat swExpandOne;
private SwitchCompat swAutoClose;
private Spinner spOnClose;
private SwitchCompat swQuickFilter;
private SwitchCompat swQuickScroll;
private SwitchCompat swCollapseMultiple;
private SwitchCompat swAutoRead;
private SwitchCompat swAutoUnflag;
@ -62,7 +64,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private final static String[] RESET_OPTIONS = new String[]{
"double_back", "pull", "autoscroll", "doubletap", "swipenav", "reversed",
"autoexpand", "expand_all", "expand_one", "collapse_multiple",
"autoclose", "onclose", "autoread", "autounflag", "automove", "discard_delete",
"autoclose", "onclose", "quick_filter", "quick_scroll", "autoread", "autounflag", "automove", "discard_delete",
"default_snooze"
};
@ -88,6 +90,8 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swCollapseMultiple = view.findViewById(R.id.swCollapseMultiple);
swAutoClose = view.findViewById(R.id.swAutoClose);
spOnClose = view.findViewById(R.id.spOnClose);
swQuickFilter = view.findViewById(R.id.swQuickFilter);
swQuickScroll = view.findViewById(R.id.swQuickScroll);
swAutoRead = view.findViewById(R.id.swAutoRead);
swAutoUnflag = view.findViewById(R.id.swAutoUnflag);
swAutoMove = view.findViewById(R.id.swAutoMove);
@ -201,6 +205,20 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
}
});
swQuickFilter.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("quick_filter", checked).apply();
}
});
swQuickScroll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("quick_scroll", checked).apply();
}
});
swAutoRead.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -308,6 +326,9 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
spOnClose.setEnabled(!swAutoClose.isChecked());
swQuickFilter.setChecked(prefs.getBoolean("quick_filter", false));
swQuickScroll.setChecked(prefs.getBoolean("quick_scroll", true));
swAutoRead.setChecked(prefs.getBoolean("autoread", false));
swAutoUnflag.setChecked(prefs.getBoolean("autounflag", false));
swAutoMove.setChecked(!prefs.getBoolean("automove", false));

View File

@ -59,6 +59,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swThreading;
private SwitchCompat swIndentation;
private SwitchCompat swHighlightUnread;
private SwitchCompat swColorStripe;
private SwitchCompat swAvatars;
private SwitchCompat swGeneratedIcons;
private SwitchCompat swIdenticons;
@ -94,7 +95,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swActionbar;
private final static String[] RESET_OPTIONS = new String[]{
"theme", "landscape", "startup", "cards", "indentation", "date", "threading", "highlight_unread",
"theme", "landscape", "startup", "cards", "indentation", "date", "threading", "highlight_unread", "color_stripe",
"avatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
"name_email", "distinguish_contacts", "authentication",
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "subject_ellipsize",
@ -121,6 +122,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swDate = view.findViewById(R.id.swDate);
swThreading = view.findViewById(R.id.swThreading);
swHighlightUnread = view.findViewById(R.id.swHighlightUnread);
swColorStripe = view.findViewById(R.id.swColorStripe);
swAvatars = view.findViewById(R.id.swAvatars);
swGeneratedIcons = view.findViewById(R.id.swGeneratedIcons);
swIdenticons = view.findViewById(R.id.swIdenticons);
@ -224,6 +226,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swColorStripe.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("color_stripe", checked).apply();
}
});
swAvatars.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -565,6 +574,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swDate.setChecked(prefs.getBoolean("date", true));
swThreading.setChecked(prefs.getBoolean("threading", true));
swHighlightUnread.setChecked(prefs.getBoolean("highlight_unread", false));
swColorStripe.setChecked(prefs.getBoolean("color_stripe", true));
swAvatars.setChecked(prefs.getBoolean("avatars", true));
swGeneratedIcons.setChecked(prefs.getBoolean("generated_icons", true));
swIdenticons.setChecked(prefs.getBoolean("identicons", false));

View File

@ -210,6 +210,29 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvOnClose" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swQuickFilter"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_quick_filter"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spOnClose"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swQuickScroll"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:enabled="true"
android:text="@string/title_advanced_quick_scroll"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swQuickFilter"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoRead"
android:layout_width="0dp"
@ -218,7 +241,7 @@
android:text="@string/title_advanced_autoread"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spOnClose"
app:layout_constraintTop_toBottomOf="@id/swQuickScroll"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

View File

@ -166,6 +166,19 @@
app:layout_constraintTop_toBottomOf="@id/tvThreadingHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swColorStripe"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:enabled="true"
android:text="@string/title_advanced_color_stripe"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swHighlightUnread"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAvatars"
android:layout_width="0dp"
@ -175,7 +188,7 @@
android:text="@string/title_advanced_avatars"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swHighlightUnread"
app:layout_constraintTop_toBottomOf="@id/swColorStripe"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

View File

@ -78,6 +78,7 @@
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_experiments"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swUpdates"

View File

@ -269,6 +269,7 @@
<string name="title_advanced_indentation">Left/right indent received/sent messages in conversations</string>
<string name="title_advanced_highlight_unread">Highlight unread messages</string>
<string name="title_advanced_distinguish_contacts">Distinguish messages from known and unknown contacts</string>
<string name="title_advanced_color_stripe">Show color stripe</string>
<string name="title_advanced_avatars">Show contact photos</string>
<string name="title_advanced_generated_icons">Show generated icons</string>
<string name="title_advanced_identicons">Show identicons</string>
@ -310,6 +311,8 @@
<string name="title_advanced_collapse_multiple">Collapse messages in a conversation with multiple messages on \'back\'</string>
<string name="title_advanced_autoclose">Automatically close conversations</string>
<string name="title_advanced_onclose">On closing a conversation</string>
<string name="title_advanced_quick_filter">Show non-obtrusive quick filter icons</string>
<string name="title_advanced_quick_scroll">Show non-obtrusive quick scroll up/down icons</string>
<string name="title_advanced_autoread">Automatically mark messages read on moving messages</string>
<string name="title_advanced_autounstar">Automatically remove stars from messages on moving messages</string>
<string name="title_advanced_automove">Confirm moving messages</string>