android.webkit.WebSettings#setSavePassword ( )源码实例Demo

下面列出了android.webkit.WebSettings#setSavePassword ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: letv   文件: PKDialog.java
@SuppressLint({"SetJavaScriptEnabled"})
private void initViews() {
    this.mWebView.setVerticalScrollBarEnabled(false);
    this.mWebView.setHorizontalScrollBarEnabled(false);
    this.mWebView.setWebViewClient(new FbWebViewClient());
    this.mWebView.setWebChromeClient(this.mChromeClient);
    this.mWebView.clearFormData();
    WebSettings settings = this.mWebView.getSettings();
    settings.setSavePassword(false);
    settings.setSaveFormData(false);
    settings.setCacheMode(-1);
    settings.setNeedInitialFocus(false);
    settings.setBuiltInZoomControls(true);
    settings.setSupportZoom(true);
    settings.setRenderPriority(RenderPriority.HIGH);
    settings.setJavaScriptEnabled(true);
    if (!(this.mWeakContext == null || this.mWeakContext.get() == null)) {
        settings.setDatabaseEnabled(true);
        settings.setDatabasePath(((Context) this.mWeakContext.get()).getApplicationContext().getDir("databases", 0).getPath());
    }
    settings.setDomStorageEnabled(true);
    this.jsBridge.a(new JsListener(), "sdk_js_if");
    this.mWebView.clearView();
    this.mWebView.loadUrl(this.mUrl);
    this.mWebView.getSettings().setSavePassword(false);
}
 
源代码2 项目: AndroidInstagram   文件: InstagramDialog.java
private void setUpWebView() {
	mWebView = new WebView(getContext());
        
	mWebView.setVerticalScrollBarEnabled(false);
	mWebView.setHorizontalScrollBarEnabled(false);
	mWebView.setWebViewClient(new InstagramWebViewClient());
	mWebView.getSettings().setJavaScriptEnabled(true);
	mWebView.loadUrl(mAuthUrl);
	mWebView.setLayoutParams(FILL);
        
	WebSettings webSettings = mWebView.getSettings();
	
	webSettings.setSavePassword(false);
	webSettings.setSaveFormData(false);
	
	mContent.addView(mWebView);
}
 
源代码3 项目: PoupoLayer   文件: WebConfigImpl.java
/**
 * 默认webview设置
 * @param settings
 */
private void initSetting(WebSettings settings, Context context){
    //5.0以上开启混合模式加载
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
    }
    settings.setLoadWithOverviewMode(true);
    settings.setUseWideViewPort(true);
    //允许js代码 在Android 4.3版本调用WebSettings.setJavaScriptEnabled()方法时会调用一下reload方法,同时会回调多次WebChromeClient.onJsPrompt()
    settings.setJavaScriptEnabled(true);
    //允许SessionStorage/LocalStorage存储
    settings.setDomStorageEnabled(true);
    //禁用放缩
    settings.setDisplayZoomControls(false);
    settings.setBuiltInZoomControls(false);
    //禁用文字缩放
    settings.setTextZoom(100);
    //10M缓存,api 18后,系统自动管理。
    settings.setAppCacheMaxSize(10 * 1024 * 1024);
    //允许缓存,设置缓存位置 缓存位置由用户指定
    settings.setAppCacheEnabled(true);
    settings.setAppCachePath(context.getDir("appcache", 0).getPath());
    //允许WebView使用File协议
    settings.setAllowFileAccess(true);
    //不保存密码
    settings.setSavePassword(false);
    //自动加载图片
    settings.setLoadsImagesAutomatically(true);
}
 
源代码4 项目: MiBandDecompiled   文件: PKDialog.java
private void d()
{
    n.setVerticalScrollBarEnabled(false);
    n.setHorizontalScrollBarEnabled(false);
    n.setWebViewClient(new e(this, null));
    n.setWebChromeClient(mChromeClient);
    n.clearFormData();
    WebSettings websettings = n.getSettings();
    websettings.setSavePassword(false);
    websettings.setSaveFormData(false);
    websettings.setCacheMode(-1);
    websettings.setNeedInitialFocus(false);
    websettings.setBuiltInZoomControls(true);
    websettings.setSupportZoom(true);
    websettings.setRenderPriority(android.webkit.WebSettings.RenderPriority.HIGH);
    websettings.setJavaScriptEnabled(true);
    if (o != null && o.get() != null)
    {
        websettings.setDatabaseEnabled(true);
        websettings.setDatabasePath(((Context)o.get()).getApplicationContext().getDir("databases", 0).getPath());
    }
    websettings.setDomStorageEnabled(true);
    jsBridge.a(new f(this, null), "sdk_js_if");
    n.clearView();
    n.loadUrl(i);
    n.getSettings().setSavePassword(false);
}
 
源代码5 项目: RePlugin-GameSdk   文件: FunSdkUiActivity.java
private void initViews() {
	webViewLayout = new RelativeLayout(this);
	webViewLayout.setBackgroundColor(0xFFFFFFFF);
	webViewLayout.setLayoutParams(new LinearLayout.LayoutParams(
			LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

	mWebView = new HWWebView(this);
	mWebView.setBackgroundColor(0xFFFFFFFF);
	mWebView.clearCache(true);
	mWebView.setFocusable(true);
	mWebView.requestFocus();
	mWebView.requestFocusFromTouch();
	mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
	mWebView.setVerticalScrollBarEnabled(false);
	mWebView.setHorizontalScrollBarEnabled(false);
	LinearLayout.LayoutParams myWebViewParams = new LinearLayout.LayoutParams(
			LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
	mWebView.setLayoutParams(myWebViewParams);

	webViewLayout.addView(mWebView, myWebViewParams);

	setContentView(webViewLayout);
	mWebView.loadurl(urlString + "?" + postData.toString());

	HWUtils.logError(TAG, "postData = " + postData.toString());
	// mWebView.posturl(urlString,
	// EncodingUtils.getBytes(postData.toString(), "base64"));

	WebSettings set = mWebView.getSettings();
	set.setSavePassword(false);
	set.setSaveFormData(false);
	set.setJavaScriptEnabled(true);
	set.setJavaScriptCanOpenWindowsAutomatically(true);
}
 
源代码6 项目: BigApp_Discuz_Android   文件: HTML5WebView.java
private void init(Context context) {
	mContext = context;		
	Activity a = (Activity) mContext;
	
	mLayout = new FrameLayout(context);
	
	mBrowserFrameLayout = (FrameLayout) LayoutInflater.from(a).inflate(R.layout.custom_screen, null);
	mContentView = (FrameLayout) mBrowserFrameLayout.findViewById(R.id.main_content);
	mCustomViewContainer = (FrameLayout) mBrowserFrameLayout.findViewById(R.id.fullscreen_custom_content);
	
	mLayout.addView(mBrowserFrameLayout, COVER_SCREEN_PARAMS);

	mWebChromeClient = new MyWebChromeClient();
    setWebChromeClient(mWebChromeClient);
    
    setWebViewClient(new MyWebViewClient());
       
    // Configure the webview
    WebSettings s = getSettings();
    s.setBuiltInZoomControls(true);
    s.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
    s.setUseWideViewPort(true);
    s.setLoadWithOverviewMode(true);
    s.setSavePassword(true);
    s.setSaveFormData(true);
    s.setJavaScriptEnabled(true);
    
    // enable navigator.geolocation 
    s.setGeolocationEnabled(true);
    s.setGeolocationDatabasePath("/data/data/org.itri.html5webview/databases/");
    
    // enable Web Storage: localStorage, sessionStorage
    s.setDomStorageEnabled(true);
    
    mContentView.addView(this);
}
 
源代码7 项目: letv   文件: TDialog.java
@SuppressLint({"SetJavaScriptEnabled"})
private void b() {
    this.i.setVerticalScrollBarEnabled(false);
    this.i.setHorizontalScrollBarEnabled(false);
    this.i.setWebViewClient(new FbWebViewClient());
    this.i.setWebChromeClient(this.mChromeClient);
    this.i.clearFormData();
    WebSettings settings = this.i.getSettings();
    settings.setSavePassword(false);
    settings.setSaveFormData(false);
    settings.setCacheMode(-1);
    settings.setNeedInitialFocus(false);
    settings.setBuiltInZoomControls(true);
    settings.setSupportZoom(true);
    settings.setRenderPriority(RenderPriority.HIGH);
    settings.setJavaScriptEnabled(true);
    if (!(this.c == null || this.c.get() == null)) {
        settings.setDatabaseEnabled(true);
        settings.setDatabasePath(((Context) this.c.get()).getApplicationContext().getDir("databases", 0).getPath());
    }
    settings.setDomStorageEnabled(true);
    this.jsBridge.a(new JsListener(), "sdk_js_if");
    this.i.loadUrl(this.e);
    this.i.setLayoutParams(a);
    this.i.setVisibility(4);
    this.i.getSettings().setSavePassword(false);
}
 
源代码8 项目: BonjourBrowser   文件: HTMLViewerActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_html_viewer);

    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }

    mWebView = findViewById(R.id.webview);
    mLoading = findViewById(R.id.loading);

    mWebView.setWebChromeClient(new ChromeClient());
    mWebView.setWebViewClient(new ViewClient());

    WebSettings s = mWebView.getSettings();
    s.setUseWideViewPort(true);
    s.setSupportZoom(true);
    s.setBuiltInZoomControls(true);
    s.setDisplayZoomControls(false);
    s.setSavePassword(false);
    s.setSaveFormData(false);
    s.setBlockNetworkLoads(true);

    // Javascript is purposely disabled, so that nothing can be
    // automatically run.
    s.setJavaScriptEnabled(false);
    s.setDefaultTextEncodingName("utf-8");

    final Intent intent = getIntent();
    if (intent.hasExtra(Intent.EXTRA_TITLE)) {
        setTitle(intent.getStringExtra(Intent.EXTRA_TITLE));
    }

    mWebView.loadUrl(String.valueOf(intent.getData()));
}
 
源代码9 项目: UltimateAndroid   文件: WebViewActivity.java
private void initWebView() {
    mWebView.setWebViewClient(new WebViewClient());
    mWebView.setWebChromeClient(new WebChromeClient());
    WebSettings settings = mWebView.getSettings();
    settings.setSavePassword(true);
    settings.setSaveFormData(true);
    settings.setJavaScriptEnabled(true);
    settings.setSupportZoom(false);
    settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
    settings.setDomStorageEnabled(true);
    settings.setSupportMultipleWindows(false);


    mWebView.loadUrl("http://developer.android.com");
}
 
源代码10 项目: pre-dem-android   文件: WebViewActivity.java
private void init() {
        mWebView.setWebViewClient(webViewClient);
//        mWebView.setWebChromeClient(chromeClient);
        WebSettings settings = mWebView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
        settings.setDefaultZoom(WebSettings.ZoomDensity.FAR);

        settings.setSupportZoom(true);
        settings.setBuiltInZoomControls(true);
        settings.setAppCacheEnabled(false);
        settings.setSavePassword(false);

        mWebView.loadUrl(mUrl);
    }
 
源代码11 项目: PocketEOS-Android   文件: BaseWebSetting.java
private void initWebSettings() {
    WebSettings webSettings = mBaseWebView.getSettings();
    if (webSettings == null) return;
    //设置字体缩放倍数,默认100
    webSettings.setTextZoom(100);
    // 支持 Js 使用
    webSettings.setJavaScriptEnabled(true);
    // 开启DOM缓存
    webSettings.setDomStorageEnabled(true);
    // 开启数据库缓存
    webSettings.setDatabaseEnabled(true);
    // 支持自动加载图片
    webSettings.setLoadsImagesAutomatically(hasKitkat());
    if (isCache) {
        // 设置 WebView 的缓存模式
        webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
        // 支持启用缓存模式
        webSettings.setAppCacheEnabled(true);
        // 设置 AppCache 最大缓存值(现在官方已经不提倡使用,已废弃)
        webSettings.setAppCacheMaxSize(8 * 1024 * 1024);
        // Android 私有缓存存储,如果你不调用setAppCachePath方法,WebView将不会产生这个目录
        webSettings.setAppCachePath(mContext.getCacheDir().getAbsolutePath());
    }
    // 数据库路径
    if (!hasKitkat()) {
        webSettings.setDatabasePath(mContext.getDatabasePath("html").getPath());
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
    }
    // 关闭密码保存提醒功能
    webSettings.setSavePassword(false);
    // 支持缩放
    webSettings.setSupportZoom(true);
    // 设置 UserAgent 属性
    webSettings.setUserAgentString("");
    // 允许加载本地 html 文件/false
    webSettings.setAllowFileAccess(true);
    // 允许通过 file url 加载的 Javascript 读取其他的本地文件,Android 4.1 之前默认是true,在 Android 4.1 及以后默认是false,也就是禁止
    webSettings.setAllowFileAccessFromFileURLs(false);
    // 允许通过 file url 加载的 Javascript 可以访问其他的源,包括其他的文件和 http,https 等其他的源,
    // Android 4.1 之前默认是true,在 Android 4.1 及以后默认是false,也就是禁止
    // 如果此设置是允许,则 setAllowFileAccessFromFileURLs 不起做用
    webSettings.setAllowUniversalAccessFromFileURLs(false);

}
 
源代码12 项目: BaseProject   文件: CommonRefreshWebViewActivity.java
/**
     * 子类如果对WebSetting 有自己的设置,则重写此方法
     */
    @SuppressLint("NewApi")
    protected void forwardInitWebViewAndWebSettings() {
        if (!Util.isCompateApi(16) && Util.isCompateApi(11)) {//android 4.1以下(不含4.1)
            webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        }
        webView.setHorizontalScrollBarEnabled(false);
        webView.setVerticalScrollBarEnabled(false);
        WebSettings webSettings = webView.getSettings();

        webSettings.setSavePassword(false);
        webSettings.setAppCacheEnabled(true);

        // Enable Javascript
        webSettings.setJavaScriptEnabled(true);

        // Enable pinch to zoom without the zoom buttons
        webSettings.setBuiltInZoomControls(true);

        if (Build.VERSION.SDK_INT > 11) {
            // Hide the zoom controls for HONEYCOMB+
            webSettings.setDisplayZoomControls(false);
        }
//        webSettings.setSupportZoom(true);

        // Use WideViewport and Zoom out if there is no viewport defined
        webSettings.setUseWideViewPort(true);//设置此属性,可任意比例缩放
        webSettings.setLoadWithOverviewMode(true);

        // Allow use of Local Storage
        webSettings.setDomStorageEnabled(true);


        // Enable remote debugging via chrome://inspect
        if(Build.VERSION.SDK_INT >= 19) {
            WebView.setWebContentsDebuggingEnabled(true);
        }
        webSettings.setJavaScriptCanOpenWindowsAutomatically(true);


        // AppRTC requires third party cookies to work
        CookieManager cookieManager = CookieManager.getInstance();
        cookieManager.setAcceptThirdPartyCookies(webView, true);
    }
 
源代码13 项目: unity-ads-android   文件: WebView.java
public WebView(Context context) {
	super(context);
	WebSettings settings = getSettings();

	if(Build.VERSION.SDK_INT >= 16) {
		settings.setAllowFileAccessFromFileURLs(true);
		settings.setAllowUniversalAccessFromFileURLs(true);
	}

	if (Build.VERSION.SDK_INT >= 19) {
		try {
			_evaluateJavascript = android.webkit.WebView.class.getMethod("evaluateJavascript", String.class, ValueCallback.class);
		} catch(NoSuchMethodException e) {
			DeviceLog.exception("Method evaluateJavascript not found", e);
			_evaluateJavascript = null;
		}
	}

	settings.setAppCacheEnabled(false);
	settings.setBlockNetworkImage(false);
	settings.setBlockNetworkLoads(false);
	settings.setBuiltInZoomControls(false);
	settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
	settings.setDatabaseEnabled(false);

	if(Build.VERSION.SDK_INT >= 11) {
		settings.setDisplayZoomControls(false);
	}

	settings.setDomStorageEnabled(false);

	if(Build.VERSION.SDK_INT >= 11) {
		settings.setEnableSmoothTransition(false);
	}

	settings.setGeolocationEnabled(false);
	settings.setJavaScriptCanOpenWindowsAutomatically(false);
	settings.setJavaScriptEnabled(true);
	settings.setLightTouchEnabled(false);
	settings.setLoadWithOverviewMode(false);
	settings.setLoadsImagesAutomatically(true);

	if(Build.VERSION.SDK_INT >= 17) {
		settings.setMediaPlaybackRequiresUserGesture(false);
	}

	if(Build.VERSION.SDK_INT >= 21) {
		settings.setMixedContentMode(WebSettings.MIXED_CONTENT_NEVER_ALLOW);
	}

	settings.setNeedInitialFocus(true);
	settings.setPluginState(WebSettings.PluginState.OFF);
	settings.setRenderPriority(WebSettings.RenderPriority.NORMAL);
	settings.setSaveFormData(false);
	settings.setSavePassword(false);
	settings.setSupportMultipleWindows(false);
	settings.setSupportZoom(false);
	settings.setUseWideViewPort(true);

	setHorizontalScrollBarEnabled(false);
	setVerticalScrollBarEnabled(false);
	setInitialScale(0);
	setBackgroundColor(Color.TRANSPARENT);
	ViewUtilities.setBackground(this, new ColorDrawable(Color.TRANSPARENT));
	setBackgroundResource(0);

	addJavascriptInterface(new WebViewBridgeInterface(), "webviewbridge");
}
 
源代码14 项目: letv   文件: H5AuthActivity.java
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    try {
        Bundle extras = getIntent().getExtras();
        if (extras == null) {
            finish();
            return;
        }
        try {
            String string = extras.getString("url");
            if (k.a(string)) {
                Method method;
                super.requestWindowFeature(1);
                this.c = new Handler(getMainLooper());
                View linearLayout = new LinearLayout(getApplicationContext());
                LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
                linearLayout.setOrientation(1);
                setContentView(linearLayout, layoutParams);
                this.a = new WebView(getApplicationContext());
                layoutParams.weight = 1.0f;
                this.a.setVisibility(0);
                linearLayout.addView(this.a, layoutParams);
                WebSettings settings = this.a.getSettings();
                settings.setUserAgentString(settings.getUserAgentString() + k.c(getApplicationContext()));
                settings.setRenderPriority(RenderPriority.HIGH);
                settings.setSupportMultipleWindows(true);
                settings.setJavaScriptEnabled(true);
                settings.setSavePassword(false);
                settings.setJavaScriptCanOpenWindowsAutomatically(true);
                settings.setMinimumFontSize(settings.getMinimumFontSize() + 8);
                settings.setAllowFileAccess(false);
                settings.setTextSize(TextSize.NORMAL);
                this.a.setVerticalScrollbarOverlay(true);
                this.a.setWebViewClient(new a());
                this.a.setDownloadListener(new a(this));
                this.a.loadUrl(string);
                if (VERSION.SDK_INT >= 7) {
                    try {
                        method = this.a.getSettings().getClass().getMethod("setDomStorageEnabled", new Class[]{Boolean.TYPE});
                        if (method != null) {
                            method.invoke(this.a.getSettings(), new Object[]{Boolean.valueOf(true)});
                        }
                    } catch (Exception e) {
                    }
                }
                try {
                    method = this.a.getClass().getMethod("removeJavascriptInterface", new Class[0]);
                    if (method != null) {
                        method.invoke(this.a, new Object[]{"searchBoxJavaBridge_"});
                        return;
                    }
                    return;
                } catch (Exception e2) {
                    return;
                }
            }
            finish();
        } catch (Exception e3) {
            finish();
        }
    } catch (Exception e4) {
        finish();
    }
}
 
源代码15 项目: Android_Skin_2.0   文件: WebSettingsCompat.java
@Override
public void setSavePassword(WebSettings settings, boolean save) {
	settings.setSavePassword(save);
}
 
源代码16 项目: letv   文件: AuthActivity.java
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    try {
        Bundle extras = getIntent().getExtras();
        if (extras == null) {
            finish();
            return;
        }
        try {
            this.d = extras.getString(b);
            String string = extras.getString("params");
            if (k.a(string)) {
                Method method;
                super.requestWindowFeature(1);
                this.f = new Handler(getMainLooper());
                View linearLayout = new LinearLayout(getApplicationContext());
                LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
                linearLayout.setOrientation(1);
                setContentView(linearLayout, layoutParams);
                this.c = new WebView(getApplicationContext());
                layoutParams.weight = 1.0f;
                this.c.setVisibility(0);
                linearLayout.addView(this.c, layoutParams);
                WebSettings settings = this.c.getSettings();
                settings.setUserAgentString(settings.getUserAgentString() + k.c(getApplicationContext()));
                settings.setRenderPriority(RenderPriority.HIGH);
                settings.setSupportMultipleWindows(true);
                settings.setJavaScriptEnabled(true);
                settings.setSavePassword(false);
                settings.setJavaScriptCanOpenWindowsAutomatically(true);
                settings.setMinimumFontSize(settings.getMinimumFontSize() + 8);
                settings.setAllowFileAccess(false);
                settings.setTextSize(TextSize.NORMAL);
                this.c.setVerticalScrollbarOverlay(true);
                this.c.setWebViewClient(new b());
                this.c.setWebChromeClient(new a());
                this.c.setDownloadListener(new a(this));
                this.c.loadUrl(string);
                if (VERSION.SDK_INT >= 7) {
                    try {
                        method = this.c.getSettings().getClass().getMethod("setDomStorageEnabled", new Class[]{Boolean.TYPE});
                        if (method != null) {
                            method.invoke(this.c.getSettings(), new Object[]{Boolean.valueOf(true)});
                        }
                    } catch (Exception e) {
                    }
                }
                try {
                    method = this.c.getClass().getMethod("removeJavascriptInterface", new Class[0]);
                    if (method != null) {
                        method.invoke(this.c, new Object[]{"searchBoxJavaBridge_"});
                        return;
                    }
                    return;
                } catch (Exception e2) {
                    return;
                }
            }
            finish();
        } catch (Exception e3) {
            finish();
        }
    } catch (Exception e4) {
        finish();
    }
}
 
源代码17 项目: keemob   文件: SystemWebViewEngine.java
@SuppressLint({"NewApi", "SetJavaScriptEnabled"})
@SuppressWarnings("deprecation")
private void initWebViewSettings() {
    webView.setInitialScale(0);
    webView.setVerticalScrollBarEnabled(false);
    // Enable JavaScript
    final WebSettings settings = webView.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setJavaScriptCanOpenWindowsAutomatically(true);
    settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);

    String manufacturer = android.os.Build.MANUFACTURER;
    LOG.d(TAG, "CordovaWebView is running on device made by: " + manufacturer);

    //We don't save any form data in the application
    settings.setSaveFormData(false);
    settings.setSavePassword(false);

    // Jellybean rightfully tried to lock this down. Too bad they didn't give us a whitelist
    // while we do this
    settings.setAllowUniversalAccessFromFileURLs(true);
    settings.setMediaPlaybackRequiresUserGesture(false);

    // Enable database
    // We keep this disabled because we use or shim to get around DOM_EXCEPTION_ERROR_16
    String databasePath = webView.getContext().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
    settings.setDatabaseEnabled(true);
    settings.setDatabasePath(databasePath);


    //Determine whether we're in debug or release mode, and turn on Debugging!
    ApplicationInfo appInfo = webView.getContext().getApplicationContext().getApplicationInfo();
    if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
        enableRemoteDebugging();
    }

    settings.setGeolocationDatabasePath(databasePath);

    // Enable DOM storage
    settings.setDomStorageEnabled(true);

    // Enable built-in geolocation
    settings.setGeolocationEnabled(true);

    // Enable AppCache
    // Fix for CB-2282
    settings.setAppCacheMaxSize(5 * 1048576);
    settings.setAppCachePath(databasePath);
    settings.setAppCacheEnabled(true);

    // Fix for CB-1405
    // Google issue 4641
    String defaultUserAgent = settings.getUserAgentString();

    // Fix for CB-3360
    String overrideUserAgent = preferences.getString("OverrideUserAgent", null);
    if (overrideUserAgent != null) {
        settings.setUserAgentString(overrideUserAgent);
    } else {
        String appendUserAgent = preferences.getString("AppendUserAgent", null);
        if (appendUserAgent != null) {
            settings.setUserAgentString(defaultUserAgent + " " + appendUserAgent);
        }
    }
    // End CB-3360

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
    if (this.receiver == null) {
        this.receiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                settings.getUserAgentString();
            }
        };
        webView.getContext().registerReceiver(this.receiver, intentFilter);
    }
    // end CB-1405
}
 
源代码18 项目: MiBandDecompiled   文件: AuthDialog.java
private void e()
{
    k.setVerticalScrollBarEnabled(false);
    k.setHorizontalScrollBarEnabled(false);
    k.setWebViewClient(new l(this, null));
    k.setWebChromeClient(new WebChromeClient());
    k.clearFormData();
    WebSettings websettings = k.getSettings();
    websettings.setSavePassword(false);
    websettings.setSaveFormData(false);
    websettings.setCacheMode(-1);
    websettings.setNeedInitialFocus(false);
    websettings.setBuiltInZoomControls(true);
    websettings.setSupportZoom(true);
    websettings.setRenderPriority(android.webkit.WebSettings.RenderPriority.HIGH);
    websettings.setJavaScriptEnabled(true);
    if (a != null && a.get() != null)
    {
        websettings.setDatabaseEnabled(true);
        websettings.setDatabasePath(((Context)a.get()).getApplicationContext().getDir("databases", 0).getPath());
    }
    websettings.setDomStorageEnabled(true);
    try
    {
        Method method = android/webkit/WebView.getMethod("addJavascriptInterface", new Class[] {
            java/lang/Object, java/lang/String
        });
        WebView webview = k;
        Object aobj[] = new Object[2];
        aobj[0] = new k(this, null);
        aobj[1] = "sdk_js_if";
        method.invoke(webview, aobj);
    }
    catch (NoSuchMethodException nosuchmethodexception)
    {
        nosuchmethodexception.printStackTrace();
    }
    catch (IllegalArgumentException illegalargumentexception)
    {
        illegalargumentexception.printStackTrace();
    }
    catch (IllegalAccessException illegalaccessexception)
    {
        illegalaccessexception.printStackTrace();
    }
    catch (InvocationTargetException invocationtargetexception)
    {
        invocationtargetexception.printStackTrace();
    }
    catch (Exception exception)
    {
        Log.e("AuthDialog", exception.getMessage());
    }
    k.loadUrl(b);
    k.setVisibility(4);
    k.getSettings().setSavePassword(false);
}
 
源代码19 项目: focus-android   文件: ClassicWebViewProvider.java
@SuppressLint("SetJavaScriptEnabled") // We explicitly want to enable JavaScript
private void configureDefaultSettings(Context context, WebSettings settings) {
    settings.setJavaScriptEnabled(true);

    // Needs to be enabled to display some HTML5 sites that use local storage
    settings.setDomStorageEnabled(true);

    // Enabling built in zooming shows the controls by default
    settings.setBuiltInZoomControls(true);

    // So we hide the controls after enabling zooming
    settings.setDisplayZoomControls(false);

    // To respect the html viewport:
    settings.setLoadWithOverviewMode(true);

    // Also increase text size to fill the viewport (this mirrors the behaviour of Firefox,
    // Chrome does this in the current Chrome Dev, but not Chrome release).
    settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING);

    // Disable access to arbitrary local files by webpages - assets can still be loaded
    // via file:///android_asset/res, so at least error page images won't be blocked.
    settings.setAllowFileAccess(false);
    settings.setAllowFileAccessFromFileURLs(false);
    settings.setAllowUniversalAccessFromFileURLs(false);

    final String appName = context.getResources().getString(R.string.useragent_appname);
    settings.setUserAgentString(buildUserAgentString(context, settings, appName));

    // Right now I do not know why we should allow loading content from a content provider
    settings.setAllowContentAccess(false);

    // The default for those settings should be "false" - But we want to be explicit.
    settings.setAppCacheEnabled(false);
    settings.setDatabaseEnabled(false);
    settings.setJavaScriptCanOpenWindowsAutomatically(false);

    // We do not implement the callbacks - So let's disable it.
    settings.setGeolocationEnabled(false);

    // We do not want to save any data...
    settings.setSaveFormData(false);
    //noinspection deprecation - This method is deprecated but let's call it in case WebView implementations still obey it.
    settings.setSavePassword(false);
}
 
源代码20 项目: pychat   文件: SystemWebViewEngine.java
@SuppressLint({"NewApi", "SetJavaScriptEnabled"})
@SuppressWarnings("deprecation")
private void initWebViewSettings() {
    webView.setInitialScale(0);
    webView.setVerticalScrollBarEnabled(false);
    // Enable JavaScript
    final WebSettings settings = webView.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setJavaScriptCanOpenWindowsAutomatically(true);
    settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);

    String manufacturer = android.os.Build.MANUFACTURER;
    LOG.d(TAG, "CordovaWebView is running on device made by: " + manufacturer);

    //We don't save any form data in the application
    settings.setSaveFormData(false);
    settings.setSavePassword(false);

    // Jellybean rightfully tried to lock this down. Too bad they didn't give us a whitelist
    // while we do this
    settings.setAllowUniversalAccessFromFileURLs(true);
    settings.setMediaPlaybackRequiresUserGesture(false);

    // Enable database
    // We keep this disabled because we use or shim to get around DOM_EXCEPTION_ERROR_16
    String databasePath = webView.getContext().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
    settings.setDatabaseEnabled(true);
    settings.setDatabasePath(databasePath);


    //Determine whether we're in debug or release mode, and turn on Debugging!
    ApplicationInfo appInfo = webView.getContext().getApplicationContext().getApplicationInfo();
    if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
        enableRemoteDebugging();
    }

    settings.setGeolocationDatabasePath(databasePath);

    // Enable DOM storage
    settings.setDomStorageEnabled(true);

    // Enable built-in geolocation
    settings.setGeolocationEnabled(true);

    // Enable AppCache
    // Fix for CB-2282
    settings.setAppCacheMaxSize(5 * 1048576);
    settings.setAppCachePath(databasePath);
    settings.setAppCacheEnabled(true);

    // Fix for CB-1405
    // Google issue 4641
    String defaultUserAgent = settings.getUserAgentString();

    // Fix for CB-3360
    String overrideUserAgent = preferences.getString("OverrideUserAgent", null);
    if (overrideUserAgent != null) {
        settings.setUserAgentString(overrideUserAgent);
    } else {
        String appendUserAgent = preferences.getString("AppendUserAgent", null);
        if (appendUserAgent != null) {
            settings.setUserAgentString(defaultUserAgent + " " + appendUserAgent);
        }
    }
    // End CB-3360

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
    if (this.receiver == null) {
        this.receiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                settings.getUserAgentString();
            }
        };
        webView.getContext().registerReceiver(this.receiver, intentFilter);
    }
    // end CB-1405
}