mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-26 09:47:13 +00:00
Prevent flickering
This commit is contained in:
parent
512c5d390a
commit
a2e2f7f93f
1 changed files with 18 additions and 0 deletions
|
@ -43,12 +43,15 @@ import androidx.webkit.WebSettingsCompat;
|
|||
import androidx.webkit.WebViewCompat;
|
||||
import androidx.webkit.WebViewFeature;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class WebViewEx extends WebView implements DownloadListener, View.OnLongClickListener {
|
||||
private int height;
|
||||
private int maxHeight;
|
||||
private boolean legacy;
|
||||
private IWebView intf;
|
||||
private Runnable onPageLoaded;
|
||||
private String hash;
|
||||
|
||||
private static String userAgent = null;
|
||||
|
||||
|
@ -219,6 +222,21 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
|
|||
settings.setBlockNetworkImage(!show_images);
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
} catch (Throwable ex) {
|
||||
Log.w(ex);
|
||||
}
|
||||
|
||||
super.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, historyUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMinimumHeight(int minHeight) {
|
||||
super.setMinimumHeight(minHeight);
|
||||
|
|
Loading…
Reference in a new issue