Added thin color stripe

pull/217/head
M66B 5 months ago
parent d947e5eeec
commit cc52b60594

@ -965,8 +965,8 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
this.dp24 = Helper.dp2pixels(context, 24);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean color_stripe_wide = prefs.getBoolean("color_stripe_wide", false);
this.colorStripeWidth = Helper.dp2pixels(context, color_stripe_wide ? 12 : 6);
int account_color_size = prefs.getInt("account_color_size", 6);
this.colorStripeWidth = Helper.dp2pixels(context, account_color_size);
boolean highlight_unread = prefs.getBoolean("highlight_unread", true);
this.colorWarning = Helper.resolveColor(context, R.attr.colorWarning);
int colorHighlight = prefs.getInt("highlight_color", Helper.resolveColor(context, R.attr.colorUnreadHighlight));

@ -1504,8 +1504,8 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
this.dp6 = Helper.dp2pixels(context, 6);
this.dp12 = Helper.dp2pixels(context, 12);
this.textSize = Helper.getTextSize(context, zoom);
boolean color_stripe_wide = prefs.getBoolean("color_stripe_wide", false);
this.colorStripeWidth = Helper.dp2pixels(context, color_stripe_wide ? 12 : 6);
int account_color_size = prefs.getInt("account_color_size", 6);
this.colorStripeWidth = Helper.dp2pixels(context, account_color_size);
this.textColorPrimary = Helper.resolveColor(context, android.R.attr.textColorPrimary);
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);

@ -463,8 +463,8 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
this.inflater = LayoutInflater.from(context);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean color_stripe_wide = prefs.getBoolean("color_stripe_wide", false);
this.colorStripeWidth = Helper.dp2pixels(context, color_stripe_wide ? 12 : 6);
int account_color_size = prefs.getInt("account_color_size", 6);
this.colorStripeWidth = Helper.dp2pixels(context, account_color_size);
this.colorWarning = Helper.resolveColor(context, R.attr.colorWarning);
this.textColorTertiary = Helper.resolveColor(context, android.R.attr.textColorTertiary);
this.debug = prefs.getBoolean("debug", false);

@ -8449,8 +8449,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.unmetered = state.isUnmetered();
this.colorCardBackground = Helper.resolveColor(context, R.attr.colorCardBackground);
boolean color_stripe_wide = prefs.getBoolean("color_stripe_wide", false);
this.colorStripeWidth = Helper.dp2pixels(context, color_stripe_wide ? 12 : 6);
int account_color_size = prefs.getInt("account_color_size", 6);
this.colorStripeWidth = Helper.dp2pixels(context, account_color_size);
this.colorAccent = Helper.resolveColor(context, androidx.appcompat.R.attr.colorAccent);
this.textColorPrimary = Helper.resolveColor(context, android.R.attr.textColorPrimary);
this.textColorPrimaryInverse = Helper.resolveColor(context, android.R.attr.textColorPrimaryInverse);

@ -1095,6 +1095,13 @@ public class ApplicationEx extends Application
if (version < 2259)
editor.putBoolean("thread_byref", true);
if (version < 2271) {
boolean color_stripe_wide = prefs.getBoolean("color_stripe_wide", false);
if (color_stripe_wide)
editor.putInt("account_color_size", 12);
editor.remove("color_stripe_wide");
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !BuildConfig.DEBUG)
editor.remove("background_service");

@ -149,7 +149,7 @@ public class FragmentOptions extends FragmentBase {
"hide_toolbar", "edge_to_edge", "nav_categories", "nav_last_sync", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "show_unexposed",
"indentation", "date", "date_week", "date_fixed", "date_bold", "date_time", "threading", "threading_unread",
"show_filtered",
"highlight_unread", "highlight_color", "account_color", "color_stripe_wide",
"highlight_unread", "highlight_color", "account_color", "account_color_size",
"avatars", "bimi", "gravatars", "libravatars", "favicons", "favicons_partial", "favicons_manifest", "generated_icons", "identicons",
"circular", "saturation", "brightness", "threshold",
"authentication", "authentication_indicator",

@ -112,7 +112,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swHighlightUnread;
private ViewButtonColor btnHighlightColor;
private Spinner spAccountColor;
private SwitchCompat swColorStripeWide;
private Spinner spAccountColorSize;
private SwitchCompat swAvatars;
private ImageButton ibBimi;
private TextView tvBimiHint;
@ -213,6 +213,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private NumberFormat NF = NumberFormat.getNumberInstance();
final static int[] account_color_sizes = {3, 6, 12};
final static List<String> RESET_OPTIONS = Collections.unmodifiableList(Arrays.asList(
"theme", "startup",
"date", "date_week", "date_fixed", "date_bold", "date_time", "group_category",
@ -220,7 +222,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
"portrait2", "portrait2c", "landscape", "close_pane", "column_width",
"hide_toolbar", "edge_to_edge", "nav_options", "nav_categories", "nav_last_sync", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "show_unexposed",
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_swap", "actionbar_color",
"highlight_unread", "highlight_color", "account_color", "color_stripe_wide",
"highlight_unread", "highlight_color", "account_color", "account_color_size",
"avatars", "bimi", "bimi_vmc", "gravatars", "libravatars", "favicons", "favicons_partial", "favicons_manifest", "ddg_icons", "favicons_dmarc", "generated_icons", "identicons",
"circular", "saturation", "brightness", "threshold",
"email_format", "prefer_contact", "only_contact", "distinguish_contacts", "show_recipients", "reverse_addresses",
@ -295,7 +297,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swHighlightUnread = view.findViewById(R.id.swHighlightUnread);
btnHighlightColor = view.findViewById(R.id.btnHighlightColor);
spAccountColor = view.findViewById(R.id.spAccountColor);
swColorStripeWide = view.findViewById(R.id.swColorStripeWide);
spAccountColorSize = view.findViewById(R.id.spAccountColorSize);
swAvatars = view.findViewById(R.id.swAvatars);
swBimi = view.findViewById(R.id.swBimi);
swBimiVmc = view.findViewById(R.id.swBimiVmc);
@ -804,7 +806,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
prefs.edit().putInt("account_color", position).apply();
swColorStripeWide.setEnabled(position == 1);
spAccountColorSize.setEnabled(position == 1);
WidgetUnified.updateData(getContext());
}
@ -815,10 +817,17 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swColorStripeWide.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
spAccountColorSize.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("color_stripe_wide", checked).apply();
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
int s = account_color_sizes[position];
prefs.edit().putInt("account_color_size", s).apply();
WidgetUnified.updateData(getContext());
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
prefs.edit().remove("account_color_size").apply();
WidgetUnified.updateData(getContext());
}
});
@ -1645,9 +1654,20 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
btnHighlightColor.setColor(prefs.getInt("highlight_color",
Helper.resolveColor(getContext(), R.attr.colorUnreadHighlight)));
spAccountColor.setSelection(prefs.getInt("account_color", 1));
swColorStripeWide.setChecked(prefs.getBoolean("color_stripe_wide", false));
swColorStripeWide.setEnabled(spAccountColor.getSelectedItemPosition() == 1);
int s = prefs.getInt("account_color_size", 6);
int account_color_size = 1;
for (int pos = 0; pos < account_color_sizes.length; pos++)
if (s == account_color_sizes[pos]) {
account_color_size = pos;
break;
}
spAccountColorSize.setSelection(account_color_size);
spAccountColorSize.setEnabled(spAccountColor.getSelectedItemPosition() == 1);
swAvatars.setChecked(prefs.getBoolean("avatars", true));
swBimi.setChecked(prefs.getBoolean("bimi", false));
swBimiVmc.setChecked(prefs.getBoolean("bimi_vmc", false));

@ -131,8 +131,8 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
only_contact = prefs.getBoolean("only_contact", false);
distinguish_contacts = prefs.getBoolean("distinguish_contacts", false);
boolean color_stripe_wide = prefs.getBoolean("color_stripe_wide", false);
this.colorStripeWidth = Helper.dp2pixels(context, color_stripe_wide ? 12 : 6);
int account_color_size = prefs.getInt("account_color_size", 6);
this.colorStripeWidth = Helper.dp2pixels(context, account_color_size);
colorWidgetForeground = ContextCompat.getColor(context, R.color.colorWidgetForeground);
colorWidgetRead = ContextCompat.getColor(context, R.color.colorWidgetRead);

@ -891,17 +891,27 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvAccountColor" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swColorStripeWide"
<TextView
android:id="@+id/tvAccountColorSize"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_color_stripe_wide"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_account_color_size"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spAccountColor"
app:switchPadding="12dp" />
app:layout_constraintTop_toBottomOf="@id/spAccountColor" />
<eu.faircode.email.SpinnerEx
android:id="@+id/spAccountColorSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:entries="@array/accountColorSizes"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvAccountColorSize" />
<View
android:id="@+id/vSeparatorAvatar"
@ -911,7 +921,7 @@
android:background="?attr/colorSeparator"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swColorStripeWide" />
app:layout_constraintTop_toBottomOf="@id/spAccountColorSize" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAvatars"

@ -629,7 +629,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_account_color">Show a color stripe or color dot</string>
<string name="title_advanced_color_stripe_wide">Use wide color stripe</string>
<string name="title_advanced_account_color_size">Color stripe width</string>
<string name="title_advanced_avatars">Show contact photos</string>
<string name="title_advanced_bimi">Show Brand Indicators for Message Identification (BIMI)</string>
<string name="title_advanced_bimi_vmc">Require a valid VMC certificate</string>
@ -2967,6 +2967,12 @@
<item>Dot</item>
</string-array>
<string-array name="accountColorSizes">
<item>Thin</item>
<item>Normal</item>
<item>Thick</item>
</string-array>
<string-array name="answerValues" translatable="false">
<item>reply</item>
<item>reply_all</item>

Loading…
Cancel
Save