Fixed switching images / WebView

This commit is contained in:
M66B 2023-04-14 16:34:07 +02:00
parent 315bcc74ca
commit 57829b7b04
1 changed files with 9 additions and 4 deletions

View File

@ -51,6 +51,7 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
private IWebView intf;
private Runnable onPageLoaded;
private String hash;
private Boolean images;
private static String userAgent = null;
@ -224,10 +225,14 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
public void loadDataWithBaseURL(String baseUrl, String data, String mimeType, String encoding, String historyUrl) {
try {
// Prevent flickering
String h = (data == null ? null : Helper.md5(data.getBytes()));
if (Objects.equals(hash, h))
return;
this.hash = h;
boolean i = getSettings().getLoadsImagesAutomatically();
if (Objects.equals(this.images, i)) {
String h = (data == null ? null : Helper.md5(data.getBytes()));
if (Objects.equals(this.hash, h))
return;
this.hash = h;
} else
this.images = i;
} catch (Throwable ex) {
Log.w(ex);
}