mirror of https://github.com/M66B/FairEmail.git
Double viewport height on modern devices
This commit is contained in:
parent
910a8e844b
commit
11a5c4fe27
|
@ -1343,7 +1343,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
}
|
||||
});
|
||||
|
||||
etViewportHeight.setHint(Integer.toString(WebViewEx.DEFAULT_VIEWPORT_HEIGHT));
|
||||
etViewportHeight.setHint(Integer.toString(WebViewEx.getDefaultViewportHeight(getContext())));
|
||||
etViewportHeight.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
@ -2404,11 +2404,11 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
swUndoManager.setChecked(prefs.getBoolean("undo_manager", false));
|
||||
swBrowserZoom.setChecked(prefs.getBoolean("browser_zoom", false));
|
||||
swFakeDark.setChecked(prefs.getBoolean("fake_dark", false));
|
||||
if (prefs.contains("viewport_height")) {
|
||||
int vh = prefs.getInt("viewport_height", WebViewEx.DEFAULT_VIEWPORT_HEIGHT);
|
||||
etViewportHeight.setText(Integer.toString(vh));
|
||||
} else
|
||||
etViewportHeight.setText(null);
|
||||
|
||||
int dvh = WebViewEx.getDefaultViewportHeight(getContext());
|
||||
int vh = prefs.getInt("viewport_height", dvh);
|
||||
etViewportHeight.setHint(vh == dvh ? null : Integer.toString(dvh));
|
||||
|
||||
swIgnoreFormattedSize.setChecked(prefs.getBoolean("ignore_formatted_size", false));
|
||||
swShowRecent.setChecked(prefs.getBoolean("show_recent", false));
|
||||
swModSeq.setChecked(prefs.getBoolean("use_modseq", true));
|
||||
|
|
|
@ -68,7 +68,7 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
|
|||
super(context);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
this.viewportHeight = prefs.getInt("viewport_height", DEFAULT_VIEWPORT_HEIGHT);
|
||||
this.viewportHeight = prefs.getInt("viewport_height", getDefaultViewportHeight(context));
|
||||
boolean overview_mode = prefs.getBoolean("overview_mode", false);
|
||||
boolean safe_browsing = prefs.getBoolean("safe_browsing", false);
|
||||
|
||||
|
@ -471,6 +471,13 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
|
|||
}
|
||||
}
|
||||
|
||||
static int getDefaultViewportHeight(Context context) {
|
||||
if (Helper.isGoogle() || Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU)
|
||||
return DEFAULT_VIEWPORT_HEIGHT * 2;
|
||||
else
|
||||
return DEFAULT_VIEWPORT_HEIGHT;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
static String getUserAgent(Context context) {
|
||||
return getUserAgent(context, null);
|
||||
|
|
Loading…
Reference in New Issue