mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-27 11:25:13 +01:00
Allow semi transparent widget color
This commit is contained in:
@@ -59,9 +59,6 @@ public class WidgetUnified extends AppWidgetProvider {
|
||||
|
||||
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_unified);
|
||||
|
||||
if (!semi)
|
||||
views.setInt(R.id.widget, "setBackgroundColor", background);
|
||||
|
||||
if (font > 0)
|
||||
views.setTextViewTextSize(R.id.title, TypedValue.COMPLEX_UNIT_SP, getFontSizeSp(font));
|
||||
|
||||
@@ -70,10 +67,6 @@ public class WidgetUnified extends AppWidgetProvider {
|
||||
views.setViewPadding(R.id.title, px, px, px, px);
|
||||
}
|
||||
|
||||
float lum = (float) ColorUtils.calculateLuminance(background);
|
||||
if (lum > 0.7f)
|
||||
views.setTextColor(R.id.title, Color.BLACK);
|
||||
|
||||
if (name == null)
|
||||
views.setTextViewText(R.id.title, context.getString(R.string.title_folder_unified));
|
||||
else
|
||||
@@ -99,6 +92,18 @@ public class WidgetUnified extends AppWidgetProvider {
|
||||
|
||||
views.setPendingIntentTemplate(R.id.lv, piItem);
|
||||
|
||||
if (background != Color.TRANSPARENT) {
|
||||
float lum = (float) ColorUtils.calculateLuminance(background);
|
||||
|
||||
if (semi)
|
||||
background = ColorUtils.setAlphaComponent(background, 127);
|
||||
|
||||
views.setInt(R.id.widget, "setBackgroundColor", background);
|
||||
|
||||
if (lum > 0.7f)
|
||||
views.setTextColor(R.id.title, Color.BLACK);
|
||||
}
|
||||
|
||||
appWidgetManager.updateAppWidget(appWidgetId, views);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user