summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/layout/setup_autofill_dialog.xml37
-rw-r--r--res/values/strings.xml3
-rw-r--r--src/com/android/browser/Tab.java53
3 files changed, 71 insertions, 22 deletions
diff --git a/res/layout/setup_autofill_dialog.xml b/res/layout/setup_autofill_dialog.xml
new file mode 100644
index 000000000..084ae7a92
--- /dev/null
+++ b/res/layout/setup_autofill_dialog.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:paddingTop="20dip" >
+
+ <TextView
+ android:text="@string/autofill_setup_dialog_message"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingBottom="5dip" />
+
+ <CheckBox android:id="@+id/setup_autofill_dialog_disable_autofill"
+ android:text="@string/disable_autofill"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:layout_gravity="left"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5452b6368..9771e1804 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -425,6 +425,9 @@
<!-- Toast message displayed when the user decides to not set up autofill at this time. We want to remind them that they can configure
it through the Browser Settings menu. [CHAR-LIMIT=NONE] -->
<string name="autofill_setup_dialog_negative_toast">AutoFill can always be configured through Browser Settings.</string>
+ <!-- Text on a checkbox in the "setup autofill" dialog which is shown to the user when they are prompted to set up the autofill feature.
+ The checkbox allows them to specify they would like to disable the feature altogether [CHAR-LIMIT=NONE] -->
+ <string name="disable_autofill">Disable AutoFill</string>
<!-- Settings screen, section title [CHAR-LIMIT=50] -->
<string name="pref_privacy_security_title">Privacy &amp; Security</string>
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();
}
};