Java Code Examples for android.webkit.WebViewDatabase#getInstance()

The following examples show how to use android.webkit.WebViewDatabase#getInstance() . 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: BrowserActivity.java    From browser with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
public void clearHistory() {
	this.deleteDatabase(HistoryDatabase.DATABASE_NAME);
	WebViewDatabase m = WebViewDatabase.getInstance(this);
	m.clearFormData();
	m.clearHttpAuthUsernamePassword();
	if (API < 18) {
		m.clearUsernamePassword();
		WebIconDatabase.getInstance().removeAllIcons();
	}
	if (mSystemBrowser) {
		try {
			//Browser.
			//Browser.clearHistory(getContentResolver());
		} catch (NullPointerException ignored) {
		}
	}
	Utils.trimCache(this);
}
 
Example 2
Source File: MainActivity.java    From Lucid-Browser with Apache License 2.0 6 votes vote down vote up
/**
	 * Clears browser cache etc
	 */
    protected void clearTraces(){
    	CustomWebView WV = webLayout.findViewById(R.id.browser_page);
    	if (WV!=null){
			WV.clearHistory();
			WV.clearCache(true);
    	}
		
		WebViewDatabase wDB = WebViewDatabase.getInstance(activity);
		wDB.clearFormData();
		
		CookieSyncManager.createInstance(activity);
		CookieManager cookieManager = CookieManager.getInstance();
		cookieManager.removeAllCookie();
		// Usefull for future commits:
//			cookieManager.setAcceptCookie(false)
//
//			WebView webview = new WebView(this);
//			WebSettings ws = webview.getSettings();
//			ws.setSaveFormData(false);
//			ws.setSavePassword(false); // Not needed for API level 18 or greater (deprecat
    }
 
Example 3
Source File: ProWebView.java    From prowebview with Apache License 2.0 5 votes vote down vote up
/**
 * Clear the web database
 */
public void clearDatabase() {
    WebViewDatabase database = WebViewDatabase.getInstance(getContext());
    database.clearHttpAuthUsernamePassword();
    database.clearFormData();
    database.clearUsernamePassword();
}
 
Example 4
Source File: WebUtils.java    From Xndroid with GNU General Public License v3.0 5 votes vote down vote up
public static void clearHistory(@NonNull Context context, @NonNull HistoryModel historyModel) {
    historyModel.deleteHistory()
            .subscribeOn(Schedulers.io())
            .subscribe();
    WebViewDatabase m = WebViewDatabase.getInstance(context);
    m.clearFormData();
    m.clearHttpAuthUsernamePassword();
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
        //noinspection deprecation
        m.clearUsernamePassword();
        //noinspection deprecation
        WebIconDatabase.getInstance().removeAllIcons();
    }
    Utils.trimCache(context);
}
 
Example 5
Source File: WebViewUtils.java    From Dashchan with Apache License 2.0 5 votes vote down vote up
public static void clearAll(WebView webView) {
	clearCookie();
	if (webView != null) {
		webView.clearCache(true);
	}
	WebViewDatabase webViewDatabase = WebViewDatabase.getInstance(MainApplication.getInstance());
	webViewDatabase.clearFormData();
	webViewDatabase.clearHttpAuthUsernamePassword();
	WebStorage.getInstance().deleteAllData();
}
 
Example 6
Source File: WebUtils.java    From JumpGo with Mozilla Public License 2.0 5 votes vote down vote up
public static void clearHistory(@NonNull Context context, @NonNull HistoryModel historyModel) {
    historyModel.deleteHistory()
            .subscribeOn(Schedulers.io())
            .subscribe();
    WebViewDatabase m = WebViewDatabase.getInstance(context);
    m.clearFormData();
    m.clearHttpAuthUsernamePassword();
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
        //noinspection deprecation
        m.clearUsernamePassword();
        //noinspection deprecation
        WebIconDatabase.getInstance().removeAllIcons();
    }
    Utils.trimCache(context);
}