From ba7b57afbb9e33110d8fdd24351223078d5a1866 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 11 Apr 2020 10:53:31 +0200 Subject: [PATCH] Improved layout of new message count widget --- .../main/java/eu/faircode/email/Widget.java | 11 ++- .../baseline_mail_outline_widget_24.xml | 14 ++++ .../res/drawable/baseline_mail_widget_24.xml | 15 ++++ app/src/main/res/layout/widget_new.xml | 69 +++++++++---------- 4 files changed, 68 insertions(+), 41 deletions(-) create mode 100644 app/src/main/res/drawable/baseline_mail_outline_widget_24.xml create mode 100644 app/src/main/res/drawable/baseline_mail_widget_24.xml diff --git a/app/src/main/java/eu/faircode/email/Widget.java b/app/src/main/java/eu/faircode/email/Widget.java index c9d8b72d08..ca4b965a0c 100644 --- a/app/src/main/java/eu/faircode/email/Widget.java +++ b/app/src/main/java/eu/faircode/email/Widget.java @@ -101,9 +101,14 @@ public class Widget extends AppWidgetProvider { if (!semi) views.setInt(R.id.widget, "setBackgroundColor", Color.TRANSPARENT); - views.setImageViewResource(R.id.ivMessage, unseen == 0 - ? R.drawable.baseline_mail_outline_24 - : R.drawable.baseline_mail_24); + if (layout == 1) + views.setImageViewResource(R.id.ivMessage, unseen == 0 + ? R.drawable.baseline_mail_outline_widget_24 + : R.drawable.baseline_mail_widget_24); + else + views.setImageViewResource(R.id.ivMessage, unseen == 0 + ? R.drawable.baseline_mail_outline_24 + : R.drawable.baseline_mail_24); views.setTextViewText(R.id.tvCount, unseen < 100 ? nf.format(unseen) : "99+"); views.setViewVisibility(R.id.tvCount, layout == 1 && unseen == 0 ? View.GONE : View.VISIBLE); diff --git a/app/src/main/res/drawable/baseline_mail_outline_widget_24.xml b/app/src/main/res/drawable/baseline_mail_outline_widget_24.xml new file mode 100644 index 0000000000..4efc53e68c --- /dev/null +++ b/app/src/main/res/drawable/baseline_mail_outline_widget_24.xml @@ -0,0 +1,14 @@ + + + + + diff --git a/app/src/main/res/drawable/baseline_mail_widget_24.xml b/app/src/main/res/drawable/baseline_mail_widget_24.xml new file mode 100644 index 0000000000..3b34dad0d2 --- /dev/null +++ b/app/src/main/res/drawable/baseline_mail_widget_24.xml @@ -0,0 +1,15 @@ + + + + + + diff --git a/app/src/main/res/layout/widget_new.xml b/app/src/main/res/layout/widget_new.xml index e6af9d2072..44ee835bd3 100644 --- a/app/src/main/res/layout/widget_new.xml +++ b/app/src/main/res/layout/widget_new.xml @@ -1,53 +1,46 @@ - - + android:adjustViewBounds="true" + android:contentDescription="@string/title_legend_count" + android:padding="3dp" + android:scaleType="fitXY" + android:src="@drawable/baseline_mail_widget_24" + android:tint="@color/colorWidgetForeground" /> - - - - + - +