diff options
Diffstat (limited to 'src/com')
| -rw-r--r-- | src/com/android/browser/Tab.java | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java index d70b0ef7a..0347ef596 100644 --- a/src/com/android/browser/Tab.java +++ b/src/com/android/browser/Tab.java @@ -53,6 +53,7 @@ import android.webkit.WebHistoryItem; import android.webkit.WebStorage; import android.webkit.WebView; import android.webkit.WebViewClient; +import android.widget.CheckBox; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; @@ -1124,28 +1125,36 @@ class Tab { // Prompt the user to set up their profile. final Message msg = message; AlertDialog.Builder builder = new AlertDialog.Builder(mActivity); - builder.setMessage(R.string.autofill_setup_dialog_message) - .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int id) { - // Take user to the AutoFill profile editor. When they return, - // we will send the message that we pass here which will trigger - // the form to get filled out with their new profile. - mWebViewController.setupAutoFill(msg); - } - }) - .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int id) { - // Disable autofill and show a toast with how to turn it on again. - BrowserSettings s = BrowserSettings.getInstance(); - s.addObserver(mMainView.getSettings()); - s.disableAutoFill(mActivity); - s.update(); - Toast.makeText(mActivity, R.string.autofill_setup_dialog_negative_toast, - Toast.LENGTH_LONG).show(); - } - }).show(); + LayoutInflater inflater = (LayoutInflater) mActivity.getSystemService( + Context.LAYOUT_INFLATER_SERVICE); + final View layout = inflater.inflate(R.layout.setup_autofill_dialog, null); + + builder.setView(layout) + .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + CheckBox disableAutoFill = (CheckBox) layout.findViewById( + R.id.setup_autofill_dialog_disable_autofill); + + if (disableAutoFill.isChecked()) { + // Disable autofill and show a toast with how to turn it on again. + BrowserSettings s = BrowserSettings.getInstance(); + s.addObserver(mMainView.getSettings()); + s.disableAutoFill(mActivity); + s.update(); + Toast.makeText(mActivity, + R.string.autofill_setup_dialog_negative_toast, + Toast.LENGTH_LONG).show(); + } else { + // Take user to the AutoFill profile editor. When they return, + // we will send the message that we pass here which will trigger + // the form to get filled out with their new profile. + mWebViewController.setupAutoFill(msg); + } + } + }) + .setNegativeButton(R.string.cancel, null) + .show(); } }; |
