mirror of https://github.com/M66B/FairEmail.git
Dynamic widget separator color
This commit is contained in:
parent
85003d0f36
commit
9b428a27e4
|
@ -41,6 +41,8 @@ public class WidgetUnified extends AppWidgetProvider {
|
|||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
int colorWidgetForeground = context.getResources().getColor(R.color.colorWidgetForeground);
|
||||
int lightColorSeparator = context.getResources().getColor(R.color.lightColorSeparator);
|
||||
int darkColorSeparator = context.getResources().getColor(R.color.darkColorSeparator);
|
||||
|
||||
for (int appWidgetId : appWidgetIds) {
|
||||
String name = prefs.getString("widget." + appWidgetId + ".name", null);
|
||||
|
@ -138,6 +140,7 @@ public class WidgetUnified extends AppWidgetProvider {
|
|||
views.setInt(R.id.background, "setBackgroundColor", background);
|
||||
|
||||
views.setTextColor(R.id.title, colorWidgetForeground);
|
||||
views.setInt(R.id.separator, "setBackgroundColor", lightColorSeparator);
|
||||
views.setImageViewResource(R.id.refresh, R.drawable.twotone_sync_24_white);
|
||||
views.setImageViewResource(R.id.compose, R.drawable.twotone_edit_24_white);
|
||||
} else {
|
||||
|
@ -150,6 +153,8 @@ public class WidgetUnified extends AppWidgetProvider {
|
|||
|
||||
int fg = (lum > 0.7f ? Color.BLACK : colorWidgetForeground);
|
||||
views.setTextColor(R.id.title, fg);
|
||||
views.setInt(R.id.separator, "setBackgroundColor",
|
||||
lum > 0.7f ? darkColorSeparator : lightColorSeparator);
|
||||
views.setImageViewResource(R.id.refresh, lum > 0.7f
|
||||
? R.drawable.twotone_sync_24_black : R.drawable.twotone_sync_24_white);
|
||||
views.setImageViewResource(R.id.compose, lum > 0.7f
|
||||
|
|
|
@ -116,6 +116,7 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
|||
if (lum > 0.7f) {
|
||||
colorWidgetForeground = ColorUtils.blendARGB(colorWidgetForeground, Color.BLACK, 1.0f);
|
||||
colorWidgetRead = ColorUtils.blendARGB(colorWidgetRead, Color.BLACK, 1.0f);
|
||||
colorSeparator = ContextCompat.getColor(context, R.color.darkColorSeparator);
|
||||
}
|
||||
|
||||
pro = ActivityBilling.isPro(context);
|
||||
|
@ -232,6 +233,7 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
|||
views.setTextColor(idTime, textColor);
|
||||
views.setTextColor(idSubject, textColor);
|
||||
views.setTextColor(idAccount, textColor);
|
||||
views.setInt(R.id.separator, "setBackgroundColor", colorSeparator);
|
||||
|
||||
views.setViewVisibility(idAccount, account < 0 ? View.VISIBLE : View.GONE);
|
||||
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/llMessage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
@ -9,8 +14,8 @@
|
|||
android:id="@+id/stripe"
|
||||
android:layout_width="3dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/darker_gray"
|
||||
android:layout_marginEnd="3dp" />
|
||||
android:layout_marginEnd="3dp"
|
||||
android:background="@color/grey" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -74,3 +79,10 @@
|
|||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/separator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/grey" />
|
||||
</LinearLayout>
|
|
@ -54,14 +54,13 @@
|
|||
android:id="@+id/separator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/colorWidgetRead" />
|
||||
android:background="@color/grey" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/lv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:divider="@color/colorWidgetRead"
|
||||
android:dividerHeight="1dp" />
|
||||
android:divider="@null" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
Loading…
Reference in New Issue