diff --git a/app/src/main/java/eu/faircode/email/ActivityWidgetUnified.java b/app/src/main/java/eu/faircode/email/ActivityWidgetUnified.java
index 0fa0af3965..c4eca8399a 100644
--- a/app/src/main/java/eu/faircode/email/ActivityWidgetUnified.java
+++ b/app/src/main/java/eu/faircode/email/ActivityWidgetUnified.java
@@ -25,6 +25,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
+import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
@@ -361,6 +362,7 @@ public class ActivityWidgetUnified extends ActivityBase {
cbUnseen.setChecked(unseen);
cbFlagged.setChecked(flagged);
cbDayNight.setChecked(daynight);
+ cbDayNight.setVisibility(Build.VERSION.SDK_INT < Build.VERSION_CODES.S ? View.GONE : View.VISIBLE);
cbHighlight.setChecked(highlight);
cbHighlight.setEnabled(!daynight);
btnHighlight.setVisibility(highlight ? View.VISIBLE : View.GONE);
diff --git a/app/src/main/java/eu/faircode/email/WidgetUnified.java b/app/src/main/java/eu/faircode/email/WidgetUnified.java
index 9540ea8c62..f38a0ecab7 100644
--- a/app/src/main/java/eu/faircode/email/WidgetUnified.java
+++ b/app/src/main/java/eu/faircode/email/WidgetUnified.java
@@ -28,6 +28,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.net.Uri;
+import android.os.Build;
import android.util.TypedValue;
import android.view.View;
import android.widget.RemoteViews;
@@ -133,43 +134,57 @@ public class WidgetUnified extends AppWidgetProvider {
boolean syncing = prefs.getBoolean("widget." + appWidgetId + ".syncing", false);
- if (!daynight)
- if (background == Color.TRANSPARENT) {
- if (semi)
- views.setInt(R.id.background, "setBackgroundResource", R.drawable.widget_background);
- else
- 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, syncing
- ? R.drawable.twotone_compare_arrows_24_white
- : R.drawable.twotone_sync_24_white);
- views.setImageViewResource(R.id.compose, R.drawable.twotone_edit_24_white);
- } else {
- float lum = (float) ColorUtils.calculateLuminance(background);
-
- if (semi)
- background = ColorUtils.setAlphaComponent(background, 127);
+ if (!daynight && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+ views.setColorStateListAttr(R.id.background, "setBackgroundTintList", 0);
+ views.setColorStateListAttr(R.id.separator, "setBackgroundTintList", 0);
+ }
+ if (daynight && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+ views.setInt(R.id.background, "setBackgroundColor", Color.WHITE);
+ views.setColorStateListAttr(R.id.background, "setBackgroundTintList", android.R.attr.colorBackground);
+ views.setColorStateListAttr(R.id.title, "setTextColor", android.R.attr.textColorPrimary);
+ views.setInt(R.id.separator, "setBackgroundColor", Color.WHITE);
+ views.setColorStateListAttr(R.id.separator, "setBackgroundTintList", android.R.attr.colorControlNormal);
+ views.setImageViewResource(R.id.refresh, syncing
+ ? R.drawable.twotone_compare_arrows_24_dn
+ : R.drawable.twotone_sync_24_dn);
+ views.setImageViewResource(R.id.compose, R.drawable.twotone_edit_24_dn);
+ } else if (background == Color.TRANSPARENT) {
+ if (semi)
+ views.setInt(R.id.background, "setBackgroundResource", R.drawable.widget_background);
+ else
views.setInt(R.id.background, "setBackgroundColor", background);
- 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);
- if (syncing)
- views.setImageViewResource(R.id.refresh, lum > 0.7f
- ? R.drawable.twotone_compare_arrows_24_black
- : R.drawable.twotone_compare_arrows_24_white);
- else
- 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
- ? R.drawable.twotone_edit_24_black
- : R.drawable.twotone_edit_24_white);
- }
+ views.setTextColor(R.id.title, colorWidgetForeground);
+ views.setInt(R.id.separator, "setBackgroundColor", lightColorSeparator);
+ views.setImageViewResource(R.id.refresh, syncing
+ ? R.drawable.twotone_compare_arrows_24_white
+ : R.drawable.twotone_sync_24_white);
+ views.setImageViewResource(R.id.compose, R.drawable.twotone_edit_24_white);
+ } else {
+ float lum = (float) ColorUtils.calculateLuminance(background);
+
+ if (semi)
+ background = ColorUtils.setAlphaComponent(background, 127);
+
+ views.setInt(R.id.background, "setBackgroundColor", background);
+
+ 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);
+ if (syncing)
+ views.setImageViewResource(R.id.refresh, lum > 0.7f
+ ? R.drawable.twotone_compare_arrows_24_black
+ : R.drawable.twotone_compare_arrows_24_white);
+ else
+ 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
+ ? R.drawable.twotone_edit_24_black
+ : R.drawable.twotone_edit_24_white);
+ }
views.setViewVisibility(R.id.separator, separators ? View.VISIBLE : View.GONE);
diff --git a/app/src/main/java/eu/faircode/email/WidgetUnifiedRemoteViewsFactory.java b/app/src/main/java/eu/faircode/email/WidgetUnifiedRemoteViewsFactory.java
index 2699148e03..48c04a027b 100644
--- a/app/src/main/java/eu/faircode/email/WidgetUnifiedRemoteViewsFactory.java
+++ b/app/src/main/java/eu/faircode/email/WidgetUnifiedRemoteViewsFactory.java
@@ -57,7 +57,7 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
private long account;
private boolean unseen;
private boolean flagged;
- private boolean daynight = true;
+ private boolean daynight;
private boolean highlight;
private int highlight_color;
private boolean separators;
@@ -258,16 +258,26 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
views.setTextViewText(idSubject, ssSubject);
views.setTextViewText(idAccount, ssAccount);
- if (!daynight) {
+ if (!daynight && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+ views.setColorStateListAttr(R.id.separator, "setBackgroundTintList", 0);
+ }
+
+ if (daynight && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+ views.setColorStateListAttr(idFrom, "setTextColor", android.R.attr.textColorPrimary);
+ views.setColorStateListAttr(idTime, "setTextColor", android.R.attr.textColorPrimary);
+ views.setColorStateListAttr(idSubject, "setTextColor", android.R.attr.textColorPrimary);
+ views.setColorStateListAttr(idAccount, "setTextColor", android.R.attr.textColorPrimary);
+ views.setInt(R.id.separator, "setBackgroundColor", Color.WHITE);
+ views.setColorStateListAttr(R.id.separator, "setBackgroundTintList", android.R.attr.colorControlNormal);
+ } else {
int textColor = (message.ui_seen ? colorWidgetRead : colorWidgetUnread);
views.setTextColor(idFrom, textColor);
views.setTextColor(idTime, textColor);
views.setTextColor(idSubject, textColor);
views.setTextColor(idAccount, textColor);
+ views.setInt(R.id.separator, "setBackgroundColor", colorSeparator);
}
- if (!daynight)
- views.setInt(R.id.separator, "setBackgroundColor", colorSeparator);
views.setViewVisibility(R.id.separator, separators ? View.VISIBLE : View.GONE);
views.setViewVisibility(idAccount, account < 0 && !allColors ? View.VISIBLE : View.GONE);
diff --git a/app/src/main/res/drawable/twotone_compare_arrows_24_dn.xml b/app/src/main/res/drawable/twotone_compare_arrows_24_dn.xml
new file mode 100644
index 0000000000..2cc97cdaad
--- /dev/null
+++ b/app/src/main/res/drawable/twotone_compare_arrows_24_dn.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/twotone_edit_24_dn.xml b/app/src/main/res/drawable/twotone_edit_24_dn.xml
new file mode 100644
index 0000000000..738180298c
--- /dev/null
+++ b/app/src/main/res/drawable/twotone_edit_24_dn.xml
@@ -0,0 +1,15 @@
+
+
+
+
diff --git a/app/src/main/res/drawable/twotone_sync_24_dn.xml b/app/src/main/res/drawable/twotone_sync_24_dn.xml
new file mode 100644
index 0000000000..e75984018a
--- /dev/null
+++ b/app/src/main/res/drawable/twotone_sync_24_dn.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/layout/widget_unified.xml b/app/src/main/res/layout/widget_unified.xml
index daff6b44e0..ef7457aaa5 100644
--- a/app/src/main/res/layout/widget_unified.xml
+++ b/app/src/main/res/layout/widget_unified.xml
@@ -40,9 +40,7 @@
android:contentDescription="@string/tile_synchronize"
android:padding="6dp"
android:src="@drawable/twotone_sync_24"
- android:tint="?android:textColorPrimary"
- android:visibility="visible"
- app:tint="?android:textColorPrimary" />
+ android:visibility="gone" />
+ android:visibility="gone" />