Async widget sync state update

This commit is contained in:
M66B
2021-09-03 15:48:48 +02:00
parent b88ef51be8
commit 766b92438d
3 changed files with 14 additions and 42 deletions

View File

@@ -105,9 +105,8 @@ public class WidgetUnified extends AppWidgetProvider {
views.setViewPadding(R.id.refresh, px, px, px, px);
views.setOnClickPendingIntent(R.id.refresh, piSync);
long now = new Date().getTime();
long refreshing = prefs.getLong("widget." + appWidgetId + ".sync", 0L);
views.setImageViewResource(R.id.refresh, refreshing < now ? R.drawable.twotone_sync_24 : R.drawable.twotone_compare_arrows_24);
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.INVISIBLE);
views.setViewVisibility(R.id.compose, compose ? View.VISIBLE : View.GONE);