diff --git a/app/src/main/java/eu/faircode/email/WidgetUnified.java b/app/src/main/java/eu/faircode/email/WidgetUnified.java index 6dad0bfe89..53a40c18d5 100644 --- a/app/src/main/java/eu/faircode/email/WidgetUnified.java +++ b/app/src/main/java/eu/faircode/email/WidgetUnified.java @@ -52,6 +52,10 @@ public class WidgetUnified extends AppWidgetProvider { if (version <= 1550) semi = true; // Legacy + if (font == 0) + font = 2; // Default medium + if (padding == 0) + padding = 2; // Default medium Intent view = new Intent(context, ActivityView.class); view.setAction("folder:" + folder); @@ -65,13 +69,10 @@ public class WidgetUnified extends AppWidgetProvider { RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_unified); - if (font > 0) - views.setTextViewTextSize(R.id.title, TypedValue.COMPLEX_UNIT_SP, getFontSizeSp(font)); + views.setTextViewTextSize(R.id.title, TypedValue.COMPLEX_UNIT_SP, getFontSizeSp(font)); - if (padding > 0) { - int px = getPaddingPx(padding, context); - views.setViewPadding(R.id.title, px, px, px, px); - } + int px = getPaddingPx(padding, context); + views.setViewPadding(R.id.title, px, px, px, px); if (name == null) views.setTextViewText(R.id.title, context.getString(R.string.title_folder_unified)); diff --git a/app/src/main/java/eu/faircode/email/WidgetUnifiedRemoteViewsFactory.java b/app/src/main/java/eu/faircode/email/WidgetUnifiedRemoteViewsFactory.java index a8eadd5871..33a6cb96d2 100644 --- a/app/src/main/java/eu/faircode/email/WidgetUnifiedRemoteViewsFactory.java +++ b/app/src/main/java/eu/faircode/email/WidgetUnifiedRemoteViewsFactory.java @@ -146,18 +146,18 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot int idSubject = (subject_top ? R.id.tvFrom : R.id.tvSubject); int idAccount = (subject_top ? R.id.tvTime : R.id.tvAccount); - if (font > 0) { - int sp = WidgetUnified.getFontSizeSp(font); - views.setTextViewTextSize(idFrom, TypedValue.COMPLEX_UNIT_SP, sp); - views.setTextViewTextSize(idTime, TypedValue.COMPLEX_UNIT_SP, sp); - views.setTextViewTextSize(idSubject, TypedValue.COMPLEX_UNIT_SP, sp); - views.setTextViewTextSize(idAccount, TypedValue.COMPLEX_UNIT_SP, sp); - } - - if (padding > 0) { - int px = WidgetUnified.getPaddingPx(padding, context); - views.setViewPadding(R.id.llMessage, px, px, px, px); - } + if (font == 0) + font = 1; // Default small + + int sp = WidgetUnified.getFontSizeSp(font); + views.setTextViewTextSize(idFrom, TypedValue.COMPLEX_UNIT_SP, sp); + views.setTextViewTextSize(idTime, TypedValue.COMPLEX_UNIT_SP, sp); + views.setTextViewTextSize(idSubject, TypedValue.COMPLEX_UNIT_SP, sp); + views.setTextViewTextSize(idAccount, TypedValue.COMPLEX_UNIT_SP, sp); + + // Default no padding + int px = (padding == 0 ? 0 : WidgetUnified.getPaddingPx(padding, context)); + views.setViewPadding(R.id.llMessage, px, px, px, px); if (position >= messages.size()) return views;