Java Code Examples for android.webkit.WebView#setWillNotCacheDrawing()
The following examples show how to use
android.webkit.WebView#setWillNotCacheDrawing() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LightningView.java From Xndroid with GNU General Public License v3.0 | 4 votes |
public LightningView(@NonNull Activity activity, @Nullable String url, boolean isIncognito) { BrowserApp.getAppComponent().inject(this); mActivity = activity; mUIController = (UIController) activity; mWebView = new WebView(activity); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) { mWebView.setId(View.generateViewId()); } mIsIncognitoTab = isIncognito; mTitle = new LightningViewTitle(activity); sMaxFling = ViewConfiguration.get(activity).getScaledMaximumFlingVelocity(); mWebView.setDrawingCacheBackgroundColor(Color.WHITE); mWebView.setFocusableInTouchMode(true); mWebView.setFocusable(true); mWebView.setDrawingCacheEnabled(false); mWebView.setWillNotCacheDrawing(true); if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) { //noinspection deprecation mWebView.setAnimationCacheEnabled(false); //noinspection deprecation mWebView.setAlwaysDrawnWithCacheEnabled(false); } mWebView.setBackgroundColor(Color.WHITE); mWebView.setScrollbarFadingEnabled(true); mWebView.setSaveEnabled(true); mWebView.setNetworkAvailable(true); mWebView.setWebChromeClient(new LightningChromeClient(activity, this)); mWebView.setWebViewClient(new LightningWebClient(activity, this)); mWebView.setDownloadListener(new LightningDownloadListener(activity)); mGestureDetector = new GestureDetector(activity, new CustomGestureListener()); mWebView.setOnTouchListener(new TouchListener()); sDefaultUserAgent = mWebView.getSettings().getUserAgentString(); initializeSettings(); initializePreferences(activity); if (url != null) { if (!url.trim().isEmpty()) { mWebView.loadUrl(url, mRequestHeaders); } else { // don't load anything, the user is looking for a blank tab } } else { loadHomepage(); } }
Example 2
Source File: LightningView.java From JumpGo with Mozilla Public License 2.0 | 4 votes |
public LightningView(@NonNull Activity activity, @Nullable String url, boolean isIncognito) { BrowserApp.getAppComponent().inject(this); mActivity = activity; mUIController = (UIController) activity; mWebView = new WebView(activity); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) { mWebView.setId(View.generateViewId()); } mIsIncognitoTab = isIncognito; mTitle = new LightningViewTitle(activity); sMaxFling = ViewConfiguration.get(activity).getScaledMaximumFlingVelocity(); mWebView.setDrawingCacheBackgroundColor(Color.WHITE); mWebView.setFocusableInTouchMode(true); mWebView.setFocusable(true); mWebView.setDrawingCacheEnabled(false); mWebView.setWillNotCacheDrawing(true); if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) { //noinspection deprecation mWebView.setAnimationCacheEnabled(false); //noinspection deprecation mWebView.setAlwaysDrawnWithCacheEnabled(false); } mWebView.setBackgroundColor(Color.WHITE); mWebView.setScrollbarFadingEnabled(true); mWebView.setSaveEnabled(true); mWebView.setNetworkAvailable(true); mWebView.setWebChromeClient(new LightningChromeClient(activity, this)); mLightningWebClient = new LightningWebClient(activity, this); mWebView.setWebViewClient(mLightningWebClient); mWebView.setDownloadListener(new LightningDownloadListener(activity)); mGestureDetector = new GestureDetector(activity, new CustomGestureListener()); mWebView.setOnTouchListener(new TouchListener()); sDefaultUserAgent = mWebView.getSettings().getUserAgentString(); initializeSettings(); initializePreferences(activity); if (url != null) { if (!url.trim().isEmpty()) { mWebView.loadUrl(url, mRequestHeaders); } else { // don't load anything, the user is looking for a blank tab } } else { loadHomepage(); } }