List of usage examples for android.webkit WebSettings setSavePassword
@Deprecated public abstract void setSavePassword(boolean save);
From source file:net.niyonkuru.koodroid.webview.BlockingWebView.java
public static BlockingWebView createInstance(Context ctx) { BlockingWebView view = new BlockingWebView(ctx); WebSettings websettings = view.getSettings(); websettings.setJavaScriptEnabled(true); websettings.setDatabaseEnabled(false); websettings.setDomStorageEnabled(false); websettings.setSupportZoom(false);//w ww. j ava 2 s . co m websettings.setSavePassword(false); websettings.setSupportMultipleWindows(false); websettings.setAppCacheEnabled(false); websettings.setCacheMode(WebSettings.LOAD_NO_CACHE); websettings.setBlockNetworkImage(true); return view; }
From source file:com.hyperkode.friendshare.fragment.TwitterWebViewFragment.java
public void onResume() { super.onResume(); String url = null;/*from w w w . java 2s. c om*/ FragmentManager fragmentManager = TwitterWebViewFragment.this.getActivity().getSupportFragmentManager(); Bundle args = this.getArguments(); if (args != null) { url = args.getString("URL"); loginFragment = (LoginFragment) fragmentManager.getFragment(args, "LoginFragment"); } WebView webView = (WebView) mThisActivity.findViewById(R.id.twitter_webview); WebSettings webSettings = webView.getSettings(); webSettings.setSavePassword(false); webSettings.setSaveFormData(false); webSettings.setJavaScriptEnabled(true); webSettings.setSupportZoom(false); webView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.contains(getString(R.string.TWITTER_CALLBACK_URL))) { Uri uri = Uri.parse(url); String oauthVerifier = uri.getQueryParameter("oauth_verifier"); if (loginFragment != null) { loginFragment.setOAuthVerifierResult(oauthVerifier); } return true; } return false; } }); webView.loadUrl(url); }
From source file:com.owncloud.android.ui.dialog.LoginWebViewDialog.java
@SuppressWarnings("deprecation") @SuppressLint("SetJavaScriptEnabled") @Override//from w ww. java2 s .com public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log_OC.v(TAG, "onCreateView, savedInsanceState is " + savedInstanceState); // Inflate layout of the dialog RelativeLayout ssoRootView = (RelativeLayout) inflater.inflate(R.layout.webview_dialog, container, false); // null parent view because it will go in the dialog layout if (mWebView == null) { // initialize the WebView mWebView = new SsoWebView(getActivity().getApplicationContext()); mWebView.setFocusable(true); mWebView.setFocusableInTouchMode(true); mWebView.setClickable(true); WebSettings webSettings = mWebView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setSavePassword(false); webSettings.setUserAgentString(MainApp.getUserAgent()); webSettings.setSaveFormData(false); // next two settings grant that non-responsive webs are zoomed out when loaded webSettings.setUseWideViewPort(true); webSettings.setLoadWithOverviewMode(true); // next three settings allow the user use pinch gesture to zoom in / out webSettings.setSupportZoom(true); webSettings.setBuiltInZoomControls(true); webSettings.setDisplayZoomControls(false); webSettings.setAllowFileAccess(false); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.setAcceptCookie(true); cookieManager.removeAllCookie(); mWebView.loadUrl(mInitialUrl); } mWebViewClient.addTargetUrls(mTargetUrls); mWebView.setWebViewClient(mWebViewClient); // add the webview into the layout RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); ssoRootView.addView(mWebView, layoutParams); ssoRootView.requestLayout(); return ssoRootView; }
From source file:com.wpi.assistments.HomeTabbedActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_webview); final ProgressDialog pd = ProgressDialog.show(this, "", "Loading...", true); isTeacher = false;//from w w w . ja va 2s.co m toggle = true; logoutFlag = false; homeWebView = (WebView) findViewById(R.id.homeWebView); homeWebView.setWebViewClient(new WebViewClient() { public void onPageFinished(WebView view, String url) { Log.i("test", view.getUrl()); if (view.getUrl().equals("https://www.assistments.org/account/login") && !logoutFlag) { Intent intent = new Intent(getApplicationContext(), LoginActivity.class); intent.putExtra("showPopup", "true"); startActivity(intent); finish(); } else if (view.getUrl().equals("https://www.assistments.org/teacher")) { isTeacher = true; } else if (view.getUrl().equals("https://www.assistments.org/account/login") && logoutFlag) { Intent intent = new Intent(getApplicationContext(), LoginActivity.class); startActivity(intent); } if (!homeWebView.canGoBack()) { btnBack.setEnabled(false); } else { btnBack.setEnabled(true); } if (!homeWebView.canGoForward()) { btnForward.setEnabled(false); } else { btnForward.setEnabled(true); } if (pd.isShowing() && pd != null) { pd.dismiss(); } } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { pd.show(); view.loadUrl(url); return true; } }); homeWebView.setWebChromeClient(new WebChromeClient() { @Override public boolean onJsConfirm(WebView view, String url, String message, final JsResult result) { new AlertDialog.Builder(webviewContext).setTitle("ASSISTments").setMessage(message) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { logoutFlag = true; result.confirm(); } }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { result.cancel(); } }).create().show(); return true; } }); if (savedInstanceState != null) { homeWebView.restoreState(savedInstanceState); } else { /** Scaling, replaced by overview mode and wide view port Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); if (size.x <= 780) { int scaleRate = (int) ((size.x) / 7.8); Log.i("test", Integer.toString(size.x)); homeWebView.setInitialScale(scaleRate); } */ Intent intent = getIntent(); if (intent.getStringExtra("username").equals("") && intent.getStringExtra("password").equals("")) { homeWebView.loadUrl("https://www.assistments.org/signup"); } else { String username = intent.getStringExtra("username"); String password = intent.getStringExtra("password"); String postData = "login=" + username + "&password=" + password + "&commit=Log in"; homeWebView.postUrl("https://www.assistments.org/account/login", EncodingUtils.getBytes(postData, "BASE64")); } } WebSettings settings = homeWebView.getSettings(); settings.setSaveFormData(false); settings.setSavePassword(false); settings.setJavaScriptEnabled(true); settings.setBuiltInZoomControls(true); settings.setDisplayZoomControls(false); settings.setJavaScriptCanOpenWindowsAutomatically(true); settings.setSupportMultipleWindows(true); settings.setCacheMode(WebSettings.LOAD_NO_CACHE); settings.setAppCacheEnabled(false); settings.setDomStorageEnabled(true); settings.setDatabaseEnabled(true); settings.setUseWideViewPort(false); settings.setLoadWithOverviewMode(true); homeWebView.clearCache(true); homeWebView.setPadding(0, 0, 0, 0); homeWebView.setInitialScale(getScale()); btnBack = (Button) findViewById(R.id.btnBack); btnBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { homeWebView.goBack(); } }); btnRefresh = (Button) findViewById(R.id.btnRefresh); btnRefresh.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //homeWebView.zoomOut(); homeWebView.scrollTo(1000, 0); Log.i("test", "111"); //homeWebView.reload(); } }); btnForward = (Button) findViewById(R.id.btnForward); btnForward.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { homeWebView.goForward(); } }); btnOffline = (Button) findViewById(R.id.btnOffline); btnOffline.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (toggle) { homeWebView.loadUrl( "https://www.assistments.org/assistments/student/index.html#offlineUserAssignmentList/"); btnOffline.setText("Home"); toggle = false; } else { if (isTeacher) { homeWebView.loadUrl("https://www.assistments.org/teacher"); } else { homeWebView.loadUrl("https://www.assistments.org/tutor"); } btnOffline.setText("Offline"); toggle = true; } } }); }
From source file:com.cerema.cloud2.ui.dialog.SamlWebViewDialog.java
@SuppressWarnings("deprecation") @SuppressLint("SetJavaScriptEnabled") @Override//from w w w. j av a 2s . c om public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log_OC.v(TAG, "onCreateView, savedInsanceState is " + savedInstanceState); // Inflate layout of the dialog RelativeLayout ssoRootView = (RelativeLayout) inflater.inflate(R.layout.sso_dialog, container, false); // null parent view because it will go in the dialog layout if (mSsoWebView == null) { // initialize the WebView mSsoWebView = new SsoWebView(getActivity().getApplicationContext()); mSsoWebView.setFocusable(true); mSsoWebView.setFocusableInTouchMode(true); mSsoWebView.setClickable(true); WebSettings webSettings = mSsoWebView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setBuiltInZoomControls(false); webSettings.setLoadWithOverviewMode(false); webSettings.setSavePassword(false); webSettings.setUserAgentString(MainApp.getUserAgent()); webSettings.setSaveFormData(false); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.setAcceptCookie(true); cookieManager.removeAllCookie(); mSsoWebView.loadUrl(mInitialUrl); } mWebViewClient.setTargetUrl(mTargetUrl); mSsoWebView.setWebViewClient(mWebViewClient); // add the webview into the layout RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); ssoRootView.addView(mSsoWebView, layoutParams); ssoRootView.requestLayout(); return ssoRootView; }
From source file:com.digitalarx.android.ui.dialog.SamlWebViewDialog.java
@SuppressWarnings("deprecation") @SuppressLint("SetJavaScriptEnabled") @Override//from w w w. j a va 2 s .com public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log_OC.d(TAG, "onCreateView, savedInsanceState is " + savedInstanceState); // Inflate layout of the dialog RelativeLayout ssoRootView = (RelativeLayout) inflater.inflate(R.layout.sso_dialog, container, false); // null parent view because it will go in the dialog layout if (mSsoWebView == null) { // initialize the WebView mSsoWebView = new SsoWebView(getSherlockActivity().getApplicationContext()); mSsoWebView.setFocusable(true); mSsoWebView.setFocusableInTouchMode(true); mSsoWebView.setClickable(true); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.setAcceptCookie(true); cookieManager.removeAllCookie(); mSsoWebView.loadUrl(mInitialUrl); WebSettings webSettings = mSsoWebView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setBuiltInZoomControls(false); webSettings.setLoadWithOverviewMode(false); webSettings.setSavePassword(false); webSettings.setUserAgentString(OwnCloudClient.USER_AGENT); webSettings.setSaveFormData(false); } mWebViewClient.setTargetUrl(mTargetUrl); mSsoWebView.setWebViewClient(mWebViewClient); // add the webview into the layout RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); ssoRootView.addView(mSsoWebView, layoutParams); ssoRootView.requestLayout(); return ssoRootView; }
From source file:org.jsharkey.oilcan.BrowserActivity.java
public void onCreate(Bundle icicle) { super.onCreate(icicle); requestWindowFeature(Window.FEATURE_PROGRESS); setContentView(R.layout.act_browse); scriptdb = new ScriptDatabase(this); scriptdb.onUpgrade(scriptdb.getWritableDatabase(), -10, 10); webview = (WebView) findViewById(R.id.browse_webview); WebSettings settings = webview.getSettings(); settings.setSavePassword(false); settings.setSaveFormData(false);/*w w w .j ava2 s . c o m*/ settings.setJavaScriptEnabled(true); settings.setSupportZoom(true); settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); FrameLayout zoomholder = (FrameLayout) this.findViewById(R.id.browse_zoom); zoomholder.addView(webview.getZoomControls()); webview.getZoomControls().setVisibility(View.GONE); webview.setWebViewClient(new OilCanClient()); webview.setWebChromeClient(new OilCanChrome()); webview.addJavascriptInterface(new IntentHelper(), "intentHelper"); // load the last-viewed page into browser String url = "http://m.half.com/"; if (icicle != null && icicle.containsKey(LAST_VIEWED)) url = icicle.getString(LAST_VIEWED); // or watch for incoming requested urls if (getIntent().getExtras() != null && getIntent().getExtras().containsKey(SearchManager.QUERY)) url = getIntent().getStringExtra(SearchManager.QUERY); webview.loadUrl(url); }
From source file:com.tdispatch.passenger.fragment.OAuthFragment.java
@SuppressLint("SetJavaScriptEnabled") @Override/*from w ww. j av a2 s. c om*/ protected void onPostCreateView() { View v = mFragmentView.findViewById(R.id.button_cancel); v.setOnClickListener(mOnClickListener); ProgressBar pb = (ProgressBar) mFragmentView.findViewById(R.id.progressbar); pb.setVisibility(View.GONE); mWebView = (WebView) mFragmentView.findViewById(R.id.webview); if (mWebView != null) { mWebView.setWebViewClient(new MyWebViewClient()); mWebView.setWebChromeClient(new MyWebchromeClient()); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { mWebView.setOnTouchListener(mOnTouchListener); } WebSettings webSettings = mWebView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); webSettings.setAppCacheEnabled(false); webSettings.setSavePassword(false); webSettings.setSaveFormData(false); CookieSyncManager.createInstance(mContext); CookieManager cm = CookieManager.getInstance(); cm.setAcceptCookie(true); cm.removeAllCookie(); try { ApiRequest req = new ApiRequest(Const.Api.OauthAuthUrl); req.addGetParam("key", Const.getApiKey()); req.addGetParam("scope", ""); req.addGetParam("response_type", "code"); req.addGetParam("client_id", Const.getOAuthClientId()); req.addGetParam("redirect_uri", mOAuthRedirectUrl); req.buildRequest(); String url = req.getUrl(); mWebView.loadUrl(url); } catch (Exception e) { WebnetLog.e("Failed to load oauth launch page..."); } } else { WebnetLog.e("Failed to init WebView. Aborting"); mHostActivity.oAuthCancelled(); } }
From source file:org.openqa.selendroid.server.model.SelendroidWebDriver.java
private void configureWebView(final WebView view) { ServerInstrumentation.getInstance().runOnUiThread(new Runnable() { @Override/*from w w w . j a v a 2 s .com*/ public void run() { view.clearCache(true); view.clearFormData(); view.clearHistory(); view.setFocusable(true); view.setFocusableInTouchMode(true); view.setNetworkAvailable(true); view.setWebChromeClient(new MyWebChromeClient()); WebSettings settings = view.getSettings(); settings.setJavaScriptCanOpenWindowsAutomatically(true); settings.setSupportMultipleWindows(true); settings.setBuiltInZoomControls(true); settings.setJavaScriptEnabled(true); settings.setAppCacheEnabled(true); settings.setAppCacheMaxSize(10 * 1024 * 1024); settings.setAppCachePath(""); settings.setDatabaseEnabled(true); settings.setDomStorageEnabled(true); settings.setGeolocationEnabled(true); settings.setSaveFormData(false); settings.setSavePassword(false); settings.setRenderPriority(WebSettings.RenderPriority.HIGH); // Flash settings settings.setPluginState(WebSettings.PluginState.ON); // Geo location settings settings.setGeolocationEnabled(true); settings.setGeolocationDatabasePath("/data/data/selendroid"); } }); }
From source file:com.owncloud.android.ui.activity.ExternalSiteWebView.java
@Override protected void onCreate(Bundle savedInstanceState) { Log_OC.v(TAG, "onCreate() start"); Bundle extras = getIntent().getExtras(); String title = extras.getString(EXTRA_TITLE); String url = extras.getString(EXTRA_URL); menuItemId = extras.getInt(EXTRA_MENU_ITEM_ID); showSidebar = extras.getBoolean(EXTRA_SHOW_SIDEBAR); // show progress getWindow().requestFeature(Window.FEATURE_PROGRESS); super.onCreate(savedInstanceState); setContentView(R.layout.externalsite_webview); WebView webview = (WebView) findViewById(R.id.webView); WebSettings webSettings = webview.getSettings(); webview.setFocusable(true);/*from w w w. ja v a 2s . com*/ webview.setFocusableInTouchMode(true); webview.setClickable(true); // setup toolbar setupToolbar(); // setup drawer setupDrawer(menuItemId); if (!showSidebar) { setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); } getSupportActionBar().setTitle(title); getSupportActionBar().setDisplayHomeAsUpEnabled(true); // enable zoom webSettings.setSupportZoom(true); webSettings.setBuiltInZoomControls(true); webSettings.setDisplayZoomControls(false); // Non-responsive webs are zoomed out when loaded webSettings.setUseWideViewPort(true); webSettings.setLoadWithOverviewMode(true); // user agent webSettings.setUserAgentString(MainApp.getUserAgent()); // no private data storing webSettings.setSavePassword(false); webSettings.setSaveFormData(false); // disable local file access webSettings.setAllowFileAccess(false); // enable javascript webview.getSettings().setJavaScriptEnabled(true); final Activity activity = this; final ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar); webview.setWebChromeClient(new WebChromeClient() { public void onProgressChanged(WebView view, int progress) { progressBar.setProgress(progress * 1000); } }); webview.setWebViewClient(new WebViewClient() { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { Toast.makeText(activity, getString(R.string.webview_error) + ": " + description, Toast.LENGTH_SHORT) .show(); } }); webview.loadUrl(url); }