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);
|
||||
|
||||
|
|
|
@ -3,74 +3,86 @@
|
|||
android:id="@+id/llMessage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/stripe"
|
||||
android:layout_width="3dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/darker_gray"
|
||||
android:layout_marginEnd="3dp" />
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingBottom="6dp">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/stripe"
|
||||
android:layout_width="3dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="3dp"
|
||||
android:background="@color/grey" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingBottom="6dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFrom"
|
||||
android:layout_width="0dp"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="From"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="@color/colorWidgetForeground" />
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTime"
|
||||
android:layout_width="wrap_content"
|
||||
<TextView
|
||||
android:id="@+id/tvFrom"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="From"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="@color/colorWidgetForeground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:maxLines="1"
|
||||
android:text="12:34"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="@color/colorWidgetForeground" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:maxLines="1"
|
||||
android:text="12:34"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="@color/colorWidgetForeground" />
|
||||
</LinearLayout>
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/tvSubject"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="Subject"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="@color/colorWidgetForeground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSubject"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="Subject"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="@color/colorWidgetForeground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAccount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:maxLines="1"
|
||||
android:text="Account"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="@color/colorWidgetForeground" />
|
||||
<TextView
|
||||
android:id="@+id/tvAccount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:maxLines="1"
|
||||
android:text="Account"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="@color/colorWidgetForeground" />
|
||||
</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