Double viewport height on modern devices

This commit is contained in:
M66B
2024-06-02 14:55:16 +02:00
parent 910a8e844b
commit 11a5c4fe27
2 changed files with 14 additions and 7 deletions

View File

@@ -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);