summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-01-17 12:54:24 +0000
committerBen Murdoch <benm@google.com>2011-01-17 13:05:24 +0000
commit1d676b6d3080ea2e8206e2a601be8390f1bbd0ed (patch)
tree4874b05ac8f046bd87739afca4ed0ca9ce26cd04 /src
parentd9844abe83b9eb6340ce646357c3e91ac794eb46 (diff)
downloadpackages_apps_Browser-1d676b6d3080ea2e8206e2a601be8390f1bbd0ed.tar.gz
packages_apps_Browser-1d676b6d3080ea2e8206e2a601be8390f1bbd0ed.tar.bz2
packages_apps_Browser-1d676b6d3080ea2e8206e2a601be8390f1bbd0ed.zip
Add a "disable autofill" checkbox to the setup prompt
Make the intent of the buttons in the setup autofill dialog clearer by adding an option to disable the feature. The cancel button now simply dismisses the dialog and we only disable the feature if the user checks the new box and clicks OK. Clicking OK without checking the box takes the user to the prdoile editor as before. Bug:3348828 Change-Id: Ib54b879b6953d0c8865d50374188059a43a8e6ba
Diffstat (limited to 'src')
-rw-r--r--src/com/android/browser/Tab.java53
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();
}
};