use of io.github.hidroh.materialistic.widget.CacheableWebView in project materialistic by hidroh.
the class SyncDelegate method loadArticle.
private void loadArticle(@NonNull final HackerNewsItem item) {
mWebView = new CacheableWebView(mContext);
mWebView.setWebViewClient(new AdBlockWebViewClient(Preferences.adBlockEnabled(mContext)));
mWebView.setWebChromeClient(new CacheableWebView.ArchiveClient() {
@Override
public void onProgressChanged(WebView view, int newProgress) {
super.onProgressChanged(view, newProgress);
notifyArticle(newProgress);
}
});
notifyArticle(0);
mWebView.loadUrl(item.getUrl());
}
use of io.github.hidroh.materialistic.widget.CacheableWebView in project materialistic by hidroh.
the class WebCacheService method onStartCommand.
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent == null) {
// restarted
stopSelf(startId);
return START_STICKY;
}
CacheableWebView webView = new CacheableWebView(this);
webView.setWebViewClient(new AdBlockWebViewClient(Preferences.adBlockEnabled(this)));
webView.setWebChromeClient(new CacheableWebView.ArchiveClient() {
@Override
public void onProgressChanged(WebView view, int newProgress) {
super.onProgressChanged(view, newProgress);
if (newProgress == 100) {
stopSelf(startId);
}
}
});
webView.loadUrl(intent.getStringExtra(EXTRA_URL));
return START_STICKY;
}
Aggregations