mirror of https://github.com/M66B/FairEmail.git
Added option for wide color stripe
This commit is contained in:
parent
787599a3f8
commit
a1934c48b7
|
@ -7,6 +7,7 @@
|
|||
### Next version
|
||||
|
||||
* Added display option to use highlight color for unread shadow
|
||||
* Added display option for wide color stripe
|
||||
* Added notification/delete for POP3 when "leave deleted" is enabled
|
||||
* Improved support for read-only folders
|
||||
* Small improvements and minor bug fixes
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
### Next version
|
||||
|
||||
* Added display option to use highlight color for unread shadow
|
||||
* Added display option for wide color stripe
|
||||
* Added notification/delete for POP3 when "leave deleted" is enabled
|
||||
* Improved support for read-only folders
|
||||
* Small improvements and minor bug fixes
|
||||
|
|
|
@ -81,6 +81,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
|
|||
private LifecycleOwner owner;
|
||||
private LayoutInflater inflater;
|
||||
|
||||
private int colorStripeWidth;
|
||||
private int colorWarning;
|
||||
private int colorUnread;
|
||||
private int textColorSecondary;
|
||||
|
@ -150,6 +151,8 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
|
|||
tvError = itemView.findViewById(R.id.tvError);
|
||||
btnHelp = itemView.findViewById(R.id.btnHelp);
|
||||
grpSettings = itemView.findViewById(R.id.grpSettings);
|
||||
|
||||
vwColor.getLayoutParams().width = colorStripeWidth;
|
||||
}
|
||||
|
||||
private void wire() {
|
||||
|
@ -611,6 +614,8 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
|
|||
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);
|
||||
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));
|
||||
|
|
|
@ -100,6 +100,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
|
||||
private int dp12;
|
||||
private float textSize;
|
||||
private int colorStripeWidth;
|
||||
private int textColorPrimary;
|
||||
private int textColorSecondary;
|
||||
private int colorUnread;
|
||||
|
@ -185,6 +186,8 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
|
||||
grpFlagged = itemView.findViewById(R.id.grpFlagged);
|
||||
grpExtended = itemView.findViewById(R.id.grpExtended);
|
||||
|
||||
vwColor.getLayoutParams().width = colorStripeWidth;
|
||||
}
|
||||
|
||||
private void wire() {
|
||||
|
@ -1164,6 +1167,8 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
|
||||
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);
|
||||
this.textColorPrimary = Helper.resolveColor(context, android.R.attr.textColorPrimary);
|
||||
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ package eu.faircode.email;
|
|||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
|
@ -46,6 +47,7 @@ import androidx.lifecycle.LifecycleObserver;
|
|||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.OnLifecycleEvent;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.DiffUtil;
|
||||
import androidx.recyclerview.widget.ListUpdateCallback;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
@ -66,6 +68,8 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
|
|||
private LifecycleOwner owner;
|
||||
private LayoutInflater inflater;
|
||||
|
||||
private int colorStripeWidth;
|
||||
|
||||
private List<TupleIdentityEx> items = new ArrayList<>();
|
||||
|
||||
private DateFormat DTF;
|
||||
|
@ -109,6 +113,8 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
|
|||
tvMaxSize = itemView.findViewById(R.id.tvMaxSize);
|
||||
tvDrafts = itemView.findViewById(R.id.tvDrafts);
|
||||
tvError = itemView.findViewById(R.id.tvError);
|
||||
|
||||
vwColor.getLayoutParams().width = colorStripeWidth;
|
||||
}
|
||||
|
||||
private void wire() {
|
||||
|
@ -402,6 +408,10 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
|
|||
this.owner = parentFragment.getViewLifecycleOwner();
|
||||
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);
|
||||
|
||||
this.DTF = Helper.getDateTimeInstance(context, DateFormat.SHORT, DateFormat.SHORT);
|
||||
|
||||
setHasStableIds(true);
|
||||
|
|
|
@ -226,6 +226,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
private boolean suitable;
|
||||
private boolean unmetered;
|
||||
|
||||
private int colorStripeWidth;
|
||||
private int colorAccent;
|
||||
private int textColorPrimary;
|
||||
private int textColorSecondary;
|
||||
|
@ -670,6 +671,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
ibHelp = itemView.findViewById(R.id.ibHelp);
|
||||
ibSettings = itemView.findViewById(R.id.ibSettings);
|
||||
|
||||
if (vwColor != null)
|
||||
vwColor.getLayoutParams().width = colorStripeWidth;
|
||||
|
||||
if (tvFrom != null) {
|
||||
if (compact) {
|
||||
boolean full = "full".equals(sender_ellipsize);
|
||||
|
@ -5990,6 +5994,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
this.suitable = state.isSuitable();
|
||||
this.unmetered = state.isUnmetered();
|
||||
|
||||
boolean color_stripe_wide = prefs.getBoolean("color_stripe_wide", false);
|
||||
this.colorStripeWidth = Helper.dp2pixels(context, color_stripe_wide ? 12 : 6);
|
||||
this.colorAccent = Helper.resolveColor(context, R.attr.colorAccent);
|
||||
this.textColorPrimary = Helper.resolveColor(context, android.R.attr.textColorPrimary);
|
||||
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
|
||||
|
|
|
@ -128,7 +128,7 @@ public class FragmentOptions extends FragmentBase {
|
|||
"startup", "cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_highlight",
|
||||
"portrait2", "portrait2c", "landscape", "nav_count", "nav_unseen_drafts", "navbar_colorize",
|
||||
"indentation", "date", "date_fixed", "date_bold", "threading", "threading_unread",
|
||||
"highlight_unread", "highlight_color", "color_stripe",
|
||||
"highlight_unread", "highlight_color", "color_stripe", "color_stripe_wide",
|
||||
"avatars", "bimi", "gravatars", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
|
||||
"authentication", "authentication_indicator",
|
||||
"email_format", "prefer_contact", "only_contact", "distinguish_contacts", "show_recipients",
|
||||
|
|
|
@ -85,6 +85,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
private SwitchCompat swHighlightUnread;
|
||||
private ViewButtonColor btnHighlightColor;
|
||||
private SwitchCompat swColorStripe;
|
||||
private SwitchCompat swColorStripeWide;
|
||||
private SwitchCompat swAvatars;
|
||||
private ImageButton ibBimi;
|
||||
private TextView tvBimiHint;
|
||||
|
@ -164,7 +165,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
"date", "date_fixed", "date_bold",
|
||||
"portrait2", "portrait2c", "landscape", "nav_options", "nav_count", "nav_unseen_drafts", "navbar_colorize",
|
||||
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_color",
|
||||
"highlight_unread", "highlight_color", "color_stripe",
|
||||
"highlight_unread", "highlight_color", "color_stripe", "color_stripe_wide",
|
||||
"avatars", "bimi", "gravatars", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
|
||||
"email_format", "prefer_contact", "only_contact", "distinguish_contacts", "show_recipients",
|
||||
"font_size_sender", "sender_ellipsize",
|
||||
|
@ -217,6 +218,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
swHighlightUnread = view.findViewById(R.id.swHighlightUnread);
|
||||
btnHighlightColor = view.findViewById(R.id.btnHighlightColor);
|
||||
swColorStripe = view.findViewById(R.id.swColorStripe);
|
||||
swColorStripeWide = view.findViewById(R.id.swColorStripeWide);
|
||||
swAvatars = view.findViewById(R.id.swAvatars);
|
||||
swBimi = view.findViewById(R.id.swBimi);
|
||||
tvBimiHint = view.findViewById(R.id.tvBimiHint);
|
||||
|
@ -528,6 +530,15 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("color_stripe", checked).apply();
|
||||
//swColorStripeWide.setEnabled(checked);
|
||||
WidgetUnified.updateData(getContext());
|
||||
}
|
||||
});
|
||||
|
||||
swColorStripeWide.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("color_stripe_wide", checked).apply();
|
||||
WidgetUnified.updateData(getContext());
|
||||
}
|
||||
});
|
||||
|
@ -1116,6 +1127,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
Helper.resolveColor(getContext(), R.attr.colorUnreadHighlight)));
|
||||
|
||||
swColorStripe.setChecked(prefs.getBoolean("color_stripe", true));
|
||||
swColorStripeWide.setChecked(prefs.getBoolean("color_stripe_wide", false));
|
||||
//swColorStripeWide.setEnabled(swColorStripe.isChecked());
|
||||
swAvatars.setChecked(prefs.getBoolean("avatars", true));
|
||||
swBimi.setChecked(prefs.getBoolean("bimi", false));
|
||||
swGravatars.setChecked(prefs.getBoolean("gravatars", false));
|
||||
|
|
|
@ -25,6 +25,7 @@ import android.content.Intent;
|
|||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Build;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
|
@ -57,6 +58,7 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
|||
private int background;
|
||||
private int font;
|
||||
private int padding;
|
||||
private int colorStripeWidth;
|
||||
private int colorWidgetForeground;
|
||||
private int colorWidgetRead;
|
||||
private int colorSeparator;
|
||||
|
@ -93,6 +95,8 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
|||
background = prefs.getInt("widget." + appWidgetId + ".background", Color.TRANSPARENT);
|
||||
font = prefs.getInt("widget." + appWidgetId + ".font", 0);
|
||||
padding = prefs.getInt("widget." + appWidgetId + ".padding", 0);
|
||||
boolean color_stripe_wide = prefs.getBoolean("color_stripe_wide", false);
|
||||
this.colorStripeWidth = Helper.dp2pixels(context, color_stripe_wide ? 12 : 6);
|
||||
colorWidgetForeground = ContextCompat.getColor(context, R.color.colorWidgetForeground);
|
||||
colorWidgetRead = ContextCompat.getColor(context, R.color.colorWidgetRead);
|
||||
colorSeparator = ContextCompat.getColor(context, R.color.lightColorSeparator);
|
||||
|
@ -174,6 +178,8 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
|||
|
||||
int colorBackground =
|
||||
(message.accountColor == null || !pro ? colorSeparator : message.accountColor);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
|
||||
views.setViewLayoutWidth(R.id.stripe, colorStripeWidth, TypedValue.COMPLEX_UNIT_PX);
|
||||
views.setInt(R.id.stripe, "setBackgroundColor", colorBackground);
|
||||
views.setViewVisibility(R.id.stripe, hasColor && color_stripe ? View.VISIBLE : View.GONE);
|
||||
|
||||
|
|
|
@ -567,13 +567,24 @@
|
|||
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/btnHighlightColor"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swColorStripeWide"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_color_stripe_wide"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swColorStripe"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/vSeparatorAvatar"
|
||||
android:layout_width="0dp"
|
||||
|
@ -582,7 +593,7 @@
|
|||
android:background="?attr/colorSeparator"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swColorStripe" />
|
||||
app:layout_constraintTop_toBottomOf="@id/swColorStripeWide" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swAvatars"
|
||||
|
|
|
@ -447,6 +447,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_color_stripe">Show color stripe</string>
|
||||
<string name="title_advanced_color_stripe_wide">Use wide color stripe</string>
|
||||
<string name="title_advanced_avatars">Show contact photos</string>
|
||||
<string name="title_advanced_gravatars">Show Gravatars</string>
|
||||
<string name="title_advanced_bimi" translatable="false">Show Brand Indicators for Message Identification (BIMI)</string>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
### Next version
|
||||
|
||||
* Added display option to use highlight color for unread shadow
|
||||
* Added display option for wide color stripe
|
||||
* Added notification/delete for POP3 when "leave deleted" is enabled
|
||||
* Improved support for read-only folders
|
||||
* Small improvements and minor bug fixes
|
||||
|
|
Loading…
Reference in New Issue