| Index: trunk/src/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialog.java
|
| ===================================================================
|
| --- trunk/src/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialog.java (revision 195318)
|
| +++ trunk/src/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialog.java (working copy)
|
| @@ -156,7 +156,7 @@
|
| }
|
|
|
| protected AutofillDialog(Context context, AutofillDialogDelegate delegate,
|
| - String saveLocallyText) {
|
| + String useBillingForShippingText, String saveLocallyText) {
|
| super(context);
|
| getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
| mDelegate = delegate;
|
| @@ -170,6 +170,9 @@
|
| inflate(R.layout.autofill_dialog_content, null);
|
| mContentView.setAutofillDialog(this);
|
|
|
| + CheckBox useBillingCheck = getUseBillingForShippingCheckBox();
|
| + useBillingCheck.setText(useBillingForShippingText);
|
| + useBillingCheck.setChecked(true);
|
| getSaveLocallyCheckBox().setText(saveLocallyText);
|
|
|
| String[] labels = new String[AutofillDialogConstants.NUM_SECTIONS];
|
| @@ -305,6 +308,9 @@
|
| }
|
|
|
| mDelegate.editingStart(section);
|
| + if (section == AutofillDialogConstants.SECTION_SHIPPING) {
|
| + getUseBillingForShippingCheckBox().setChecked(false);
|
| + }
|
| AutofillDialogMenuItem currentItem =
|
| (AutofillDialogMenuItem) spinner.getItemAtPosition(position);
|
| if (currentItem.mIndex == ADD_MENU_ITEM_INDEX) {
|
| @@ -318,6 +324,10 @@
|
| public void onNothingSelected(AdapterView<?> spinner) {
|
| }
|
|
|
| + private CheckBox getUseBillingForShippingCheckBox() {
|
| + return (CheckBox) mContentView.findViewById(R.id.use_billing_checkbox);
|
| + }
|
| +
|
| /**
|
| * @param spinner The dropdown that was selected by the user.
|
| * @param section The section that the dropdown corresponds to.
|
| @@ -446,11 +456,10 @@
|
| combinedItems = Arrays.asList(menuItems);
|
| } else {
|
| combinedItems = new ArrayList<AutofillDialogMenuItem>(
|
| - menuItems.length - 2 + mDefaultMenuItems[section].length);
|
| + menuItems.length - 1 + mDefaultMenuItems[section].length);
|
| combinedItems.addAll(Arrays.asList(menuItems));
|
| - // Replace the provided "Add..." item with ours and add "Edit".
|
| - // Also remove the "Manage..." item (for now).
|
| - combinedItems.remove(menuItems.length - 2);
|
| + // Replace the provided "Add... item with ours and add "Edit".
|
| + combinedItems.remove(menuItems.length - 1);
|
| combinedItems.addAll(Arrays.asList(mDefaultMenuItems[section]));
|
| }
|
|
|
| @@ -549,6 +558,13 @@
|
| }
|
|
|
| /**
|
| + * @return Whether the billing address should be used as shipping address.
|
| + */
|
| + public boolean shouldUseBillingForShipping() {
|
| + return getUseBillingForShippingCheckBox().isChecked();
|
| + }
|
| +
|
| + /**
|
| * @return Whether the details entered should be saved locally on the device.
|
| */
|
| public boolean shouldSaveDetailsLocally() {
|
|
|