diff --git a/app/src/main/java/eu/faircode/email/ActivityWidgetUnified.java b/app/src/main/java/eu/faircode/email/ActivityWidgetUnified.java index eb62adc855..60584640a4 100644 --- a/app/src/main/java/eu/faircode/email/ActivityWidgetUnified.java +++ b/app/src/main/java/eu/faircode/email/ActivityWidgetUnified.java @@ -71,6 +71,7 @@ public class ActivityWidgetUnified extends ActivityBase { private Spinner spSubjectLines; private TextView tvSubjectLinesHint; private CheckBox cbAvatars; + private CheckBox cbAccountName; private CheckBox cbRefresh; private CheckBox cbCompose; private Button btnSave; @@ -112,6 +113,7 @@ public class ActivityWidgetUnified extends ActivityBase { int padding = prefs.getInt("widget." + appWidgetId + ".padding", 0); int subject_lines = prefs.getInt("widget." + appWidgetId + ".subject_lines", 1); boolean avatars = prefs.getBoolean("widget." + appWidgetId + ".avatars", false); + boolean account_name = prefs.getBoolean("widget." + appWidgetId + ".account_name", true); boolean refresh = prefs.getBoolean("widget." + appWidgetId + ".refresh", false); boolean compose = prefs.getBoolean("widget." + appWidgetId + ".compose", false); @@ -136,6 +138,7 @@ public class ActivityWidgetUnified extends ActivityBase { spSubjectLines = findViewById(R.id.spSubjectLines); tvSubjectLinesHint = findViewById(R.id.tvSubjectLinesHint); cbAvatars = findViewById(R.id.cbAvatars); + cbAccountName = findViewById(R.id.cbAccountName); cbRefresh = findViewById(R.id.cbRefresh); cbCompose = findViewById(R.id.cbCompose); btnSave = findViewById(R.id.btnSave); @@ -278,6 +281,7 @@ public class ActivityWidgetUnified extends ActivityBase { editor.putInt("widget." + appWidgetId + ".padding", tinyOut(padding)); editor.putInt("widget." + appWidgetId + ".subject_lines", spSubjectLines.getSelectedItemPosition() + 1); editor.putBoolean("widget." + appWidgetId + ".avatars", cbAvatars.isChecked()); + editor.putBoolean("widget." + appWidgetId + ".account_name", cbAccountName.isChecked()); editor.putBoolean("widget." + appWidgetId + ".refresh", cbRefresh.isChecked()); editor.putBoolean("widget." + appWidgetId + ".compose", cbCompose.isChecked()); editor.putInt("widget." + appWidgetId + ".version", BuildConfig.VERSION_CODE); @@ -324,6 +328,7 @@ public class ActivityWidgetUnified extends ActivityBase { public void onItemSelected(AdapterView parent, View view, int position, long id) { EntityAccount account = (EntityAccount) spAccount.getAdapter().getItem(position); setFolders(account.id); + cbAccountName.setEnabled(account.id < 0); } @Override @@ -408,6 +413,7 @@ public class ActivityWidgetUnified extends ActivityBase { spFontSize.setSelection(tinyIn(font)); spPadding.setSelection(tinyIn(padding)); cbAvatars.setChecked(avatars); + cbAccountName.setChecked(account_name); spSubjectLines.setSelection(subject_lines - 1); tvSubjectLinesHint.setText(getString(R.string.title_advanced_preview_lines_hint, NF.format(HtmlHelper.PREVIEW_SIZE))); cbRefresh.setChecked(refresh); diff --git a/app/src/main/java/eu/faircode/email/WidgetUnifiedRemoteViewsFactory.java b/app/src/main/java/eu/faircode/email/WidgetUnifiedRemoteViewsFactory.java index 30c50dd7b8..cd36dee79d 100644 --- a/app/src/main/java/eu/faircode/email/WidgetUnifiedRemoteViewsFactory.java +++ b/app/src/main/java/eu/faircode/email/WidgetUnifiedRemoteViewsFactory.java @@ -66,6 +66,7 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot private int font; private int padding; private boolean avatars; + private boolean account_name; private int subject_lines; private boolean prefer_contact; private boolean only_contact; @@ -117,6 +118,7 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot font = prefs.getInt("widget." + appWidgetId + ".font", 0); padding = prefs.getInt("widget." + appWidgetId + ".padding", 0); avatars = prefs.getBoolean("widget." + appWidgetId + ".avatars", false); + account_name = prefs.getBoolean("widget." + appWidgetId + ".account_name", true); subject_lines = prefs.getInt("widget." + appWidgetId + ".subject_lines", 1); prefer_contact = prefs.getBoolean("prefer_contact", false); @@ -293,7 +295,7 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot views.setViewVisibility(R.id.separator, separators ? View.VISIBLE : View.GONE); - views.setViewVisibility(idAccount, account < 0 && !allColors ? View.VISIBLE : View.GONE); + views.setViewVisibility(idAccount, account < 0 && !allColors && account_name ? View.VISIBLE : View.GONE); } catch (Throwable ex) { Log.e(ex); diff --git a/app/src/main/res/layout/activity_widget_unified.xml b/app/src/main/res/layout/activity_widget_unified.xml index 8c690e89d0..1a015fe231 100644 --- a/app/src/main/res/layout/activity_widget_unified.xml +++ b/app/src/main/res/layout/activity_widget_unified.xml @@ -213,6 +213,16 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvSubjectLinesHint" /> + + + app:layout_constraintTop_toBottomOf="@id/cbAccountName" /> Show unread count at the top Maximum number of subject lines Show contact avatars + Show account name Show refresh messages button Show compose new message button Background color