mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-31 06:08:31 +02:00
Reconfigurable list widget
This commit is contained in:
@@ -50,6 +50,9 @@ public class WidgetUnified extends AppWidgetProvider {
|
||||
int padding = prefs.getInt("widget." + appWidgetId + ".padding", 0);
|
||||
int version = prefs.getInt("widget." + appWidgetId + ".version", 0);
|
||||
|
||||
if (version <= 1550)
|
||||
semi = true; // Legacy
|
||||
|
||||
Intent view = new Intent(context, ActivityView.class);
|
||||
view.setAction("folder:" + folder);
|
||||
view.putExtra("account", account);
|
||||
@@ -96,8 +99,13 @@ public class WidgetUnified extends AppWidgetProvider {
|
||||
views.setPendingIntentTemplate(R.id.lv, piItem);
|
||||
|
||||
if (background == Color.TRANSPARENT) {
|
||||
if (!semi && version > 1550)
|
||||
if (semi)
|
||||
views.setInt(R.id.widget, "setBackgroundResource", R.drawable.widget_background);
|
||||
else
|
||||
views.setInt(R.id.widget, "setBackgroundColor", background);
|
||||
|
||||
int colorWidgetForeground = context.getResources().getColor(R.color.colorWidgetForeground);
|
||||
views.setTextColor(R.id.title, colorWidgetForeground);
|
||||
} else {
|
||||
float lum = (float) ColorUtils.calculateLuminance(background);
|
||||
|
||||
@@ -110,7 +118,11 @@ public class WidgetUnified extends AppWidgetProvider {
|
||||
views.setTextColor(R.id.title, Color.BLACK);
|
||||
}
|
||||
|
||||
int dp6 = Helper.dp2pixels(context, 6);
|
||||
views.setViewPadding(R.id.widget, dp6, 0, dp6, 0);
|
||||
|
||||
appWidgetManager.updateAppWidget(appWidgetId, views);
|
||||
appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.lv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user