mirror of https://github.com/M66B/FairEmail.git
Added browser zoom
This commit is contained in:
parent
21d36b02b6
commit
6572ad77bc
|
@ -2724,6 +2724,22 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
HtmlHelper.restorePre(document);
|
||||
}
|
||||
|
||||
boolean browser_zoom = prefs.getBoolean("browser_zoom", true);
|
||||
int message_zoom = prefs.getInt("message_zoom", 100);
|
||||
if (browser_zoom && message_zoom != 100) {
|
||||
String z = String.format("%.2f", message_zoom / 100f);
|
||||
document.select("body").attr("style",
|
||||
"zoom: " + z + ";" +
|
||||
"-moz-transform: scale(" + z + ");" + // Firefox
|
||||
"-moz-transform-origin: 0 0;" +
|
||||
"-o-transform: scale(" + z + ");" + // Opera
|
||||
"-o-transform-origin: 0 0;" +
|
||||
"-webkit-transform: scale(" + z + ");" + // Safari
|
||||
"-webkit-transform-origin: 0 0;" +
|
||||
"transform: scale(" + z + ");" + // Standard
|
||||
"transform-origin: 0 0;");
|
||||
}
|
||||
|
||||
HtmlHelper.guessSchemes(document);
|
||||
HtmlHelper.autoLink(document);
|
||||
|
||||
|
|
|
@ -154,6 +154,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
private ImageButton ibSqliteCache;
|
||||
private SwitchCompat swUndoManager;
|
||||
private SwitchCompat swWebViewLegacy;
|
||||
private SwitchCompat swBrowserZoom;
|
||||
private SwitchCompat swModSeq;
|
||||
private SwitchCompat swUid;
|
||||
private SwitchCompat swExpunge;
|
||||
|
@ -204,7 +205,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
"protocol", "debug", "log_level", "test1", "test2", "test3", "test4", "test5",
|
||||
"work_manager", // "external_storage",
|
||||
"query_threads", "wal", "sqlite_checkpoints", "sqlite_analyze", "sqlite_cache",
|
||||
"chunk_size", "thread_range", "undo_manager", "webview_legacy",
|
||||
"chunk_size", "thread_range", "undo_manager", "webview_legacy", "browser_zoom",
|
||||
"use_modseq", "uid_command", "perform_expunge", "uid_expunge",
|
||||
"auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "auth_apop",
|
||||
"keep_alive_poll", "empty_pool", "idle_done", "logarithmic_backoff",
|
||||
|
@ -313,6 +314,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
sbThreadRange = view.findViewById(R.id.sbThreadRange);
|
||||
swUndoManager = view.findViewById(R.id.swUndoManager);
|
||||
swWebViewLegacy = view.findViewById(R.id.swWebViewLegacy);
|
||||
swBrowserZoom = view.findViewById(R.id.swBrowserZoom);
|
||||
swModSeq = view.findViewById(R.id.swModSeq);
|
||||
swUid = view.findViewById(R.id.swUid);
|
||||
swExpunge = view.findViewById(R.id.swExpunge);
|
||||
|
@ -1009,6 +1011,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
}
|
||||
});
|
||||
|
||||
swBrowserZoom.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("browser_zoom", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swModSeq.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -1684,6 +1693,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
|
||||
swUndoManager.setChecked(prefs.getBoolean("undo_manager", false));
|
||||
swWebViewLegacy.setChecked(prefs.getBoolean("webview_legacy", false));
|
||||
swBrowserZoom.setChecked(prefs.getBoolean("browser_zoom", true));
|
||||
swModSeq.setChecked(prefs.getBoolean("use_modseq", true));
|
||||
swUid.setChecked(prefs.getBoolean("uid_command", false));
|
||||
swExpunge.setChecked(prefs.getBoolean("perform_expunge", true));
|
||||
|
|
|
@ -109,6 +109,7 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
|
|||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean compact = prefs.getBoolean("compact", false);
|
||||
int zoom = prefs.getInt("view_zoom", compact ? 0 : 1);
|
||||
boolean browser_zoom = prefs.getBoolean("browser_zoom", true);
|
||||
int message_zoom = prefs.getInt("message_zoom", 100);
|
||||
boolean monospaced = prefs.getBoolean("monospaced", false);
|
||||
legacy = prefs.getBoolean("webview_legacy", false);
|
||||
|
@ -121,7 +122,8 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
|
|||
WebSettingsCompat.setForceDark(settings, dark && !force_light ? FORCE_DARK_ON : FORCE_DARK_OFF);
|
||||
setBackgroundColor(canForce && force_light ? Color.WHITE : Color.TRANSPARENT);
|
||||
|
||||
float fontSize = 16f /* Default */ * message_zoom / 100f;
|
||||
float fontSize = 16f /* Default */ *
|
||||
(browser_zoom ? 1f : message_zoom / 100f);
|
||||
if (zoom == 0 /* small */)
|
||||
fontSize *= HtmlHelper.FONT_SMALL;
|
||||
else if (zoom == 2 /* large */)
|
||||
|
|
|
@ -928,7 +928,6 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_undo_manager"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
@ -947,6 +946,18 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/swUndoManager"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swBrowserZoom"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_browser_zoom"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swWebViewLegacy"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swModSeq"
|
||||
android:layout_width="0dp"
|
||||
|
@ -956,7 +967,7 @@
|
|||
android:text="@string/title_advanced_modseq"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swWebViewLegacy"
|
||||
app:layout_constraintTop_toBottomOf="@id/swBrowserZoom"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
|
|
|
@ -716,6 +716,7 @@
|
|||
<string name="title_advanced_thread_range" translatable="false">Thread range: %1$d days</string>
|
||||
<string name="title_advanced_undo_manager" translatable="false">Use Android\'s undo manager</string>
|
||||
<string name="title_advanced_webview_legacy" translatable="false">Old WebView behavior</string>
|
||||
<string name="title_advanced_browser_zoom" translatable="false">Use browser zoom</string>
|
||||
<string name="title_advanced_modseq" translatable="false">MODSEQ</string>
|
||||
<string name="title_advanced_uid" translatable="false">UID command</string>
|
||||
<string name="title_advanced_expunge" translatable="false">AUTO EXPUNGE</string>
|
||||
|
|
Loading…
Reference in New Issue