Added option to disable message list title

pull/213/head
M66B 2 years ago
parent 829fc4280b
commit 598779a6fe

@ -72,6 +72,7 @@ public class ActivityWidgetUnified extends ActivityBase {
private TextView tvSubjectLinesHint;
private CheckBox cbAvatars;
private CheckBox cbAccountName;
private CheckBox cbCaption;
private CheckBox cbRefresh;
private CheckBox cbCompose;
private Button btnSave;
@ -114,6 +115,7 @@ public class ActivityWidgetUnified extends ActivityBase {
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 caption = prefs.getBoolean("widget." + appWidgetId + ".caption", true);
boolean refresh = prefs.getBoolean("widget." + appWidgetId + ".refresh", false);
boolean compose = prefs.getBoolean("widget." + appWidgetId + ".compose", false);
@ -139,6 +141,7 @@ public class ActivityWidgetUnified extends ActivityBase {
tvSubjectLinesHint = findViewById(R.id.tvSubjectLinesHint);
cbAvatars = findViewById(R.id.cbAvatars);
cbAccountName = findViewById(R.id.cbAccountName);
cbCaption = findViewById(R.id.cbCaption);
cbRefresh = findViewById(R.id.cbRefresh);
cbCompose = findViewById(R.id.cbCompose);
btnSave = findViewById(R.id.btnSave);
@ -282,6 +285,7 @@ public class ActivityWidgetUnified extends ActivityBase {
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 + ".caption", cbCaption.isChecked());
editor.putBoolean("widget." + appWidgetId + ".refresh", cbRefresh.isChecked());
editor.putBoolean("widget." + appWidgetId + ".compose", cbCompose.isChecked());
editor.putInt("widget." + appWidgetId + ".version", BuildConfig.VERSION_CODE);
@ -416,6 +420,7 @@ public class ActivityWidgetUnified extends ActivityBase {
cbAccountName.setChecked(account_name);
spSubjectLines.setSelection(subject_lines - 1);
tvSubjectLinesHint.setText(getString(R.string.title_advanced_preview_lines_hint, NF.format(HtmlHelper.PREVIEW_SIZE)));
cbCaption.setChecked(caption);
cbRefresh.setChecked(refresh);
cbCompose.setChecked(compose);

@ -56,6 +56,7 @@ public class WidgetUnified extends AppWidgetProvider {
boolean separators = prefs.getBoolean("widget." + appWidgetId + ".separators", true);
int font = prefs.getInt("widget." + appWidgetId + ".font", 0);
int padding = prefs.getInt("widget." + appWidgetId + ".padding", 0);
boolean caption = prefs.getBoolean("widget." + appWidgetId + ".caption", true);
boolean refresh = prefs.getBoolean("widget." + appWidgetId + ".refresh", false);
boolean compose = prefs.getBoolean("widget." + appWidgetId + ".compose", false);
int version = prefs.getInt("widget." + appWidgetId + ".version", 0);
@ -99,10 +100,15 @@ public class WidgetUnified extends AppWidgetProvider {
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));
else
views.setTextViewText(R.id.title, name);
if (caption) {
if (name == null)
views.setTextViewText(R.id.title, context.getString(R.string.title_folder_unified));
else
views.setTextViewText(R.id.title, name);
} else
views.setTextViewText(R.id.title, null);
views.setViewVisibility(R.id.title, caption || refresh || compose ? View.VISIBLE : View.GONE);
views.setViewVisibility(R.id.padding, caption || refresh || compose ? View.GONE : View.VISIBLE);
views.setOnClickPendingIntent(R.id.title, pi);

@ -224,6 +224,16 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbAvatars" />
<CheckBox
android:id="@+id/cbCaption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_widget_caption"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbAccountName" />
<CheckBox
android:id="@+id/cbRefresh"
android:layout_width="wrap_content"
@ -232,7 +242,7 @@
android:checked="true"
android:text="@string/title_widget_refresh"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbAccountName" />
app:layout_constraintTop_toBottomOf="@id/cbCaption" />
<CheckBox
android:id="@+id/cbCompose"

@ -53,6 +53,12 @@
android:visibility="gone" />
</LinearLayout>
<FrameLayout
android:id="@+id/padding"
android:layout_width="match_parent"
android:layout_height="9dp"
android:visibility="gone" />
<FrameLayout
android:id="@+id/separator"
android:layout_width="match_parent"

@ -2280,6 +2280,7 @@
<string name="title_widget_subject_lines">Maximum number of subject lines</string>
<string name="title_widget_avatars">Show contact avatars</string>
<string name="title_widget_account_name">Show account name</string>
<string name="title_widget_caption">Show title</string>
<string name="title_widget_refresh">Show refresh messages button</string>
<string name="title_widget_compose">Show compose new message button</string>
<string name="title_widget_background">Background color</string>

Loading…
Cancel
Save