Account color dot for widgets

pull/215/head
M66B 3 months ago
parent b8a1497bb6
commit 6f4fb32b60

@ -53,7 +53,7 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
private boolean threading; private boolean threading;
private boolean subject_top; private boolean subject_top;
private boolean subject_italic; private boolean subject_italic;
private boolean color_stripe; private int account_color;
private long folder; private long folder;
private long account; private long account;
private boolean unseen; private boolean unseen;
@ -105,7 +105,7 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
threading = prefs.getBoolean("threading", true); threading = prefs.getBoolean("threading", true);
subject_top = prefs.getBoolean("subject_top", false); subject_top = prefs.getBoolean("subject_top", false);
subject_italic = prefs.getBoolean("subject_italic", true); subject_italic = prefs.getBoolean("subject_italic", true);
color_stripe = (prefs.getInt("account_color", 1) > 0); account_color = prefs.getInt("account_color", 1);
account = prefs.getLong("widget." + appWidgetId + ".account", -1L); account = prefs.getLong("widget." + appWidgetId + ".account", -1L);
folder = prefs.getLong("widget." + appWidgetId + ".folder", -1L); folder = prefs.getLong("widget." + appWidgetId + ".folder", -1L);
@ -167,8 +167,7 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
} }
hasColor = false; hasColor = false;
allColors = color_stripe; allColors = (account_color > 0);
if (account < 0)
for (TupleMessageWidget message : messages) for (TupleMessageWidget message : messages)
if (message.accountColor == null) if (message.accountColor == null)
allColors = false; allColors = false;
@ -233,10 +232,14 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
int colorBackground = int colorBackground =
(message.accountColor == null || !pro ? colorSeparator : message.accountColor); (message.accountColor == null || !pro ? colorSeparator : message.accountColor);
views.setInt(R.id.dot, "setBackgroundColor", colorBackground);
views.setViewVisibility(R.id.dot, hasColor && account_color == 2 ? View.VISIBLE : View.GONE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
views.setViewLayoutWidth(R.id.stripe, colorStripeWidth, TypedValue.COMPLEX_UNIT_PX); views.setViewLayoutWidth(R.id.stripe, colorStripeWidth, TypedValue.COMPLEX_UNIT_PX);
views.setInt(R.id.stripe, "setBackgroundColor", colorBackground); views.setInt(R.id.stripe, "setBackgroundColor", colorBackground);
views.setViewVisibility(R.id.stripe, hasColor && color_stripe ? View.VISIBLE : View.GONE); views.setViewVisibility(R.id.stripe, hasColor && account_color == 1 ? View.VISIBLE : View.GONE);
if (avatars) { if (avatars) {
ContactInfo[] info = ContactInfo.get(context, ContactInfo[] info = ContactInfo.get(context,

@ -10,6 +10,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
<FrameLayout
android:id="@+id/dot"
android:layout_width="6dp"
android:layout_height="6dp"
android:layout_marginTop="3dp"
android:layout_marginEnd="3dp"
android:background="@color/grey" />
<FrameLayout <FrameLayout
android:id="@+id/stripe" android:id="@+id/stripe"
android:layout_width="3dp" android:layout_width="3dp"

Loading…
Cancel
Save