- @Override
- public void onFailedSavingCertificate() {
- AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
- builder.setMessage(mContext.getString(R.string.ssl_validator_not_saved));
- builder.setCancelable(false);
- builder.setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- };
- });
- builder.create().show();
-
- }
+ /**
+ * 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();