summaryrefslogtreecommitdiffstats
path: root/chrome/android/java
diff options
context:
space:
mode:
authoraruslan@chromium.org <aruslan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-05 00:39:24 +0000
committeraruslan@chromium.org <aruslan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-05 00:39:24 +0000
commit6ef047d4095d354bfd00cbf9f66b1ec892b50b7f (patch)
tree85629b8dea44da979f277bb2e82115248098499c /chrome/android/java
parent37c37d5067a66e0a639f3e62c019c3dd13b3c2c9 (diff)
downloadchromium_src-6ef047d4095d354bfd00cbf9f66b1ec892b50b7f.zip
chromium_src-6ef047d4095d354bfd00cbf9f66b1ec892b50b7f.tar.gz
chromium_src-6ef047d4095d354bfd00cbf9f66b1ec892b50b7f.tar.bz2
Do not attempt to "Edit" the section we already edit or "Add".
This is purely a crash and texts fix; the proper solution is to have an Android-specific model wrapper on the native side (http://crbug.com/224162). BUG=226172,224162 NOTRY=True Review URL: https://chromiumcodereview.appspot.com/13441005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192437 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/android/java')
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialog.java35
1 files changed, 29 insertions, 6 deletions
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialog.java
index a115d5b..d24b50a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialog.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialog.java
@@ -182,20 +182,36 @@ public class AutofillDialog extends AlertDialog
mContentView.setOnItemSelectedListener(this);
- AutofillDialogMenuItem[] billingItems = {
+ // TODO(aruslan): remove as part of the native model wrapper http://crbug.com/224162.
+ final AutofillDialogMenuItem[] ccItems = {
+ new AutofillDialogMenuItem(ADD_MENU_ITEM_INDEX,
+ resources.getString(R.string.autofill_new_credit_card)),
+ new AutofillDialogMenuItem(EDIT_MENU_ITEM_INDEX,
+ resources.getString(R.string.autofill_edit_credit_card))
+ };
+ final AutofillDialogMenuItem[] billingDetailsItems = {
+ new AutofillDialogMenuItem(ADD_MENU_ITEM_INDEX,
+ resources.getString(R.string.autofill_new_cc_billing)),
+ new AutofillDialogMenuItem(EDIT_MENU_ITEM_INDEX,
+ resources.getString(R.string.autofill_edit_cc_billing))
+ };
+ final AutofillDialogMenuItem[] billingAddressItems = {
new AutofillDialogMenuItem(ADD_MENU_ITEM_INDEX,
resources.getString(R.string.autofill_new_billing)),
new AutofillDialogMenuItem(EDIT_MENU_ITEM_INDEX,
resources.getString(R.string.autofill_edit_billing))
};
- AutofillDialogMenuItem[] shippingItems = {
+ final AutofillDialogMenuItem[] shippingItems = {
new AutofillDialogMenuItem(ADD_MENU_ITEM_INDEX,
resources.getString(R.string.autofill_new_shipping)),
new AutofillDialogMenuItem(EDIT_MENU_ITEM_INDEX,
resources.getString(R.string.autofill_edit_shipping))
};
- mDefaultMenuItems[AutofillDialogConstants.SECTION_CC_BILLING] = billingItems;
+ // TODO(yusufo): http://crbug.com/226497 Need an email add/edit layout/something.
+ mDefaultMenuItems[AutofillDialogConstants.SECTION_CC] = ccItems;
+ mDefaultMenuItems[AutofillDialogConstants.SECTION_BILLING] = billingAddressItems;
+ mDefaultMenuItems[AutofillDialogConstants.SECTION_CC_BILLING] = billingDetailsItems;
mDefaultMenuItems[AutofillDialogConstants.SECTION_SHIPPING] = shippingItems;
String hint = mDelegate.getPlaceholderForField(
@@ -408,14 +424,21 @@ public class AutofillDialog extends AlertDialog
setFieldsForSection(section, dialogInputs);
mContentView.setVisibilityForSection(section, visible);
List<AutofillDialogMenuItem> combinedItems;
- if (mDefaultMenuItems[section] == null) {
+
+ // This is a temporary hack in absence of an Android-specific model wrapper,
+ // which would handle Edit/Add/EditingDone operations.
+ // TODO(aruslan): remove as part of the native model wrapper http://crbug.com/224162.
+ if (mDefaultMenuItems[section] == null || menuItems.length == 0) {
combinedItems = Arrays.asList(menuItems);
} else {
combinedItems = new ArrayList<AutofillDialogMenuItem>(
- menuItems.length + mDefaultMenuItems[section].length);
+ menuItems.length - 1 + mDefaultMenuItems[section].length);
combinedItems.addAll(Arrays.asList(menuItems));
+ // Replace the provided "Add... item with ours and add "Edit".
+ combinedItems.remove(menuItems.length - 1);
combinedItems.addAll(Arrays.asList(mDefaultMenuItems[section]));
}
+
mContentView.updateMenuItemsForSection(section, combinedItems);
mAutofillSectionMenuData[section] = menuItems;
}
@@ -557,4 +580,4 @@ public class AutofillDialog extends AlertDialog
// Entire section is validated if the field is valid.
if (errorText == null) mDelegate.validateSection(section);
}
-} \ No newline at end of file
+}