- @Override
- public WebResourceResponse shouldInterceptRequest (WebView view, String url) {
- Log_OC.d(TAG, "shouldInterceptRequest : " + url);
- return null;
- }
-
- @Override
- public void onLoadResource (WebView view, String url) {
- Log_OC.d(TAG, "onLoadResource : " + url);
- }
-
- @Override
- public void onReceivedLoginRequest (WebView view, String realm, String account, String args) {
- Log_OC.d(TAG, "onReceivedLoginRequest : " + realm + ", " + account + ", " + args);
- }
-
- @Override
- public void onScaleChanged (WebView view, float oldScale, float newScale) {
- Log_OC.d(TAG, "onScaleChanged : " + oldScale + " -> " + newScale);
- super.onScaleChanged(view, oldScale, newScale);
- }
-
- @Override
- public void onUnhandledKeyEvent (WebView view, KeyEvent event) {
- Log_OC.d(TAG, "onUnhandledKeyEvent : " + event);
- }
-
- @Override
- public boolean shouldOverrideKeyEvent (WebView view, KeyEvent event) {
- Log_OC.d(TAG, "shouldOverrideKeyEvent : " + event);
- return false;
- }
-
- /**
- * Create dialog for request authentication to the user
- * @param webView
- * @param handler
- */
- private void createAuthenticationDialog(WebView webView, HttpAuthHandler handler) {
- final WebView mWebView = webView;
- final HttpAuthHandler mHandler = handler;
-
- // Create field for username
- final EditText usernameET = new EditText(mContext);
- usernameET.setHint(mContext.getText(R.string.auth_username));
-
- // Create field for password
- final EditText passwordET = new EditText(mContext);
- passwordET.setHint(mContext.getText(R.string.auth_password));
- passwordET.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
-
- // Prepare LinearLayout for dialog
- LinearLayout ll = new LinearLayout(mContext);
- ll.setOrientation(LinearLayout.VERTICAL);
- ll.addView(usernameET);
- ll.addView(passwordET);
-
- Builder authDialog = new AlertDialog
- .Builder(mContext)
- .setTitle(mContext.getText(R.string.saml_authentication_required_text))
- .setView(ll)
- .setCancelable(false)
- .setPositiveButton(mContext.getText(R.string.common_ok),
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int whichButton) {
-
- String username = usernameET.getText().toString().trim();
- String password = passwordET.getText().toString().trim();
-
- // Proceed with the authentication
- mHandler.proceed(username, password);
- dialog.dismiss();
- }
- })
- .setNegativeButton(mContext.getText(R.string.common_cancel),
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int whichButton) {
- dialog.dismiss();
- mWebView.stopLoading();
- mIsFirstAttempt = true;
- }
- });
-
- if (mWebView!=null) {
- authDialog.show();
- }
-
- }