Fixed original message view not/showing images

pull/217/head
M66B 8 months ago
parent 45489f9082
commit 8eedaa0286

@ -58,7 +58,6 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
private IWebView intf; private IWebView intf;
private Runnable onPageLoaded; private Runnable onPageLoaded;
private String hash; private String hash;
private Boolean images;
private static String userAgent = null; private static String userAgent = null;
@ -247,6 +246,10 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
void setImages(boolean show_images, boolean inline) { void setImages(boolean show_images, boolean inline) {
WebSettings settings = getSettings(); WebSettings settings = getSettings();
if (settings.getLoadsImagesAutomatically() != show_images)
this.hash = null;
settings.setLoadsImagesAutomatically(show_images || inline); settings.setLoadsImagesAutomatically(show_images || inline);
settings.setBlockNetworkLoads(!show_images); settings.setBlockNetworkLoads(!show_images);
settings.setBlockNetworkImage(!show_images); settings.setBlockNetworkImage(!show_images);
@ -256,14 +259,10 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
public void loadDataWithBaseURL(String baseUrl, String data, String mimeType, String encoding, String historyUrl) { public void loadDataWithBaseURL(String baseUrl, String data, String mimeType, String encoding, String historyUrl) {
try { try {
// Prevent flickering // Prevent flickering
boolean i = getSettings().getLoadsImagesAutomatically(); String h = (data == null ? null : Helper.md5(data.getBytes()));
if (Objects.equals(this.images, i)) { if (Objects.equals(this.hash, h))
String h = (data == null ? null : Helper.md5(data.getBytes())); return;
if (Objects.equals(this.hash, h)) this.hash = h;
return;
this.hash = h;
} else
this.images = i;
} catch (Throwable ex) { } catch (Throwable ex) {
Log.w(ex); Log.w(ex);
} }

Loading…
Cancel
Save