Moved PDF preview option

This commit is contained in:
M66B 2023-10-19 08:20:55 +02:00
parent a348bc4d99
commit 1be4d55942
5 changed files with 28 additions and 25 deletions

View File

@ -181,6 +181,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private TextView tvUnzipHint;
private SwitchCompat swAttachmentsAlt;
private SwitchCompat swThumbnails;
private SwitchCompat swPdfPreview;
private SwitchCompat swListCount;
private SwitchCompat swBundledFonts;
@ -220,7 +221,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
"hyphenation", "display_font", "contrast", "monospaced_pre",
"text_separators",
"collapse_quotes", "image_placeholders", "inline_images", "button_extra",
"unzip", "attachments_alt", "thumbnails",
"unzip", "attachments_alt", "thumbnails", "pdf_preview",
"list_count", "bundled_fonts", "narrow_fonts", "parse_classes",
"background_color", "text_color", "text_size", "text_font", "text_align", "text_titles",
"authentication", "authentication_indicator"
@ -351,6 +352,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
tvUnzipHint = view.findViewById(R.id.tvUnzipHint);
swAttachmentsAlt = view.findViewById(R.id.swAttachmentsAlt);
swThumbnails = view.findViewById(R.id.swThumbnails);
swPdfPreview = view.findViewById(R.id.swPdfPreview);
swListCount = view.findViewById(R.id.swListCount);
swBundledFonts = view.findViewById(R.id.swBundledFonts);
@ -1304,6 +1306,14 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("thumbnails", checked).apply();
swPdfPreview.setEnabled(checked);
}
});
swPdfPreview.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("pdf_preview", checked).apply();
}
});
@ -1644,6 +1654,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swUnzip.setChecked(prefs.getBoolean("unzip", !BuildConfig.PLAY_STORE_RELEASE));
swAttachmentsAlt.setChecked(prefs.getBoolean("attachments_alt", false));
swThumbnails.setChecked(prefs.getBoolean("thumbnails", true));
swPdfPreview.setChecked(prefs.getBoolean("pdf_preview", true));
swPdfPreview.setEnabled(swThumbnails.isChecked());
swListCount.setChecked(prefs.getBoolean("list_count", false));
swBundledFonts.setChecked(prefs.getBoolean("bundled_fonts", true));

View File

@ -240,7 +240,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swNativeDkim;
private SwitchCompat swNativeArc;
private EditText etNativeArcWhitelist;
private SwitchCompat swPdfPreview;
private SwitchCompat swWebp;
private SwitchCompat swEasyCorrect;
private SwitchCompat swInfra;
@ -313,7 +312,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
"max_backoff_power", "logarithmic_backoff",
"exact_alarms",
"native_dkim", "native_arc", "native_arc_whitelist",
"pdf_preview", "webp", "easy_correct", "infra", "tld_flags", "dup_msgids", "thread_byref", "mdn",
"webp", "easy_correct", "infra", "tld_flags", "dup_msgids", "thread_byref", "mdn",
"app_chooser", "delete_confirmation", "global_keywords", "test_iab"
};
@ -503,7 +502,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swNativeDkim = view.findViewById(R.id.swNativeDkim);
swNativeArc = view.findViewById(R.id.swNativeArc);
etNativeArcWhitelist = view.findViewById(R.id.etNativeArcWhitelist);
swPdfPreview = view.findViewById(R.id.swPdfPreview);
swWebp = view.findViewById(R.id.swWebp);
swEasyCorrect = view.findViewById(R.id.swEasyCorrect);
swInfra = view.findViewById(R.id.swInfra);
@ -1888,13 +1886,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swPdfPreview.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("pdf_preview", checked).apply();
}
});
swWebp.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -2725,7 +2716,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swNativeArc.setChecked(prefs.getBoolean("native_arc", true));
etNativeArcWhitelist.setEnabled(swNativeDkim.isEnabled() && swNativeDkim.isChecked());
etNativeArcWhitelist.setText(prefs.getString("native_arc_whitelist", null));
swPdfPreview.setChecked(prefs.getBoolean("pdf_preview", true));
swWebp.setChecked(prefs.getBoolean("webp", true));
swEasyCorrect.setChecked(prefs.getBoolean("easy_correct", false));
swInfra.setChecked(prefs.getBoolean("infra", false));

View File

@ -2023,6 +2023,18 @@
app:layout_constraintTop_toBottomOf="@id/swAttachmentsAlt"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swPdfPreview"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_pdf_preview"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swThumbnails"
app:switchPadding="12dp" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpUnzip"
android:layout_width="0dp"

View File

@ -2066,17 +2066,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swNativeArc" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swPdfPreview"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_pdf_preview"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etNativeArcWhitelist"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swWebp"
android:layout_width="0dp"
@ -2085,7 +2074,7 @@
android:text="@string/title_advanced_webp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swPdfPreview"
app:layout_constraintTop_toBottomOf="@id/etNativeArcWhitelist"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

View File

@ -615,6 +615,7 @@
<string name="title_advanced_unzip">Show contents of compressed attachments</string>
<string name="title_advanced_attachments_alt">Show attachments after the message text</string>
<string name="title_advanced_thumbnails">Show image thumbnails after the message text</string>
<string name="title_advanced_pdf_preview">Show PDF thumbnails</string>
<string name="title_advanced_message_text_zoom2">Default message text zoom: %1$s %%</string>
<string name="title_advanced_editor_text_zoom">Zoom message text also in the message editor</string>
<string name="title_advanced_overview_mode">Zoom original messages to fit the screen</string>
@ -909,7 +910,6 @@
<string name="title_advanced_exact_alarms" translatable="false">Use exact timers</string>
<string name="title_advanced_native_dkim" translatable="false">Native DKIM verification</string>
<string name="title_advanced_native_arc" translatable="false">Native ARC verification</string>
<string name="title_advanced_pdf_preview" translatable="false">PDF preview</string>
<string name="title_advanced_webp" translatable="false">Webp</string>
<string name="title_advanced_easy_correct" translatable="false">Easy correct</string>
<string name="title_advanced_infra" translatable="false">Show infrastructure</string>