1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-27 02:07:12 +00:00

Fixed widget sync indication

This commit is contained in:
M66B 2022-04-28 07:57:05 +02:00
parent 35dfbed5dd
commit 27cf21d95e
3 changed files with 35 additions and 8 deletions

View file

@ -107,10 +107,6 @@ public class WidgetUnified extends AppWidgetProvider {
views.setViewPadding(R.id.refresh, px, px, px, px);
views.setOnClickPendingIntent(R.id.refresh, piSync);
boolean syncing = prefs.getBoolean("widget." + appWidgetId + ".syncing", false);
views.setImageViewResource(R.id.refresh, syncing ? R.drawable.twotone_compare_arrows_24 : R.drawable.twotone_sync_24);
views.setViewVisibility(R.id.refresh, refresh ? View.VISIBLE : View.GONE);
views.setViewVisibility(R.id.compose, compose ? View.VISIBLE : View.GONE);
views.setViewPadding(R.id.compose, px, px, px, px);
views.setOnClickPendingIntent(R.id.compose, piCompose);
@ -133,6 +129,8 @@ public class WidgetUnified extends AppWidgetProvider {
views.setPendingIntentTemplate(R.id.lv, piItem);
boolean syncing = prefs.getBoolean("widget." + appWidgetId + ".syncing", false);
if (background == Color.TRANSPARENT) {
if (semi)
views.setInt(R.id.background, "setBackgroundResource", R.drawable.widget_background);
@ -141,7 +139,9 @@ public class WidgetUnified extends AppWidgetProvider {
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.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);
@ -155,10 +155,17 @@ public class WidgetUnified extends AppWidgetProvider {
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);
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);
? R.drawable.twotone_edit_24_black
: R.drawable.twotone_edit_24_white);
}
int dp6 = Helper.dp2pixels(context, 6);

View file

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="@android:color/black">
<path
android:fillColor="@android:color/white"
android:pathData="M9.01,14L2,14v2h7.01v3L13,15l-3.99,-4v3zM14.99,13v-3L22,10L22,8h-7.01L14.99,5L11,9l3.99,4z"/>
</vector>

View file

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="@color/colorWidgetForeground">
<path
android:fillColor="@android:color/white"
android:pathData="M9.01,14L2,14v2h7.01v3L13,15l-3.99,-4v3zM14.99,13v-3L22,10L22,8h-7.01L14.99,5L11,9l3.99,4z"/>
</vector>