Commit cdb475af authored by dfalcantara's avatar dfalcantara Committed by Commit bot

[Payments] Select and add buttons for incomplete sections

* Replaces the previous "Select shipping address" or "Select shipping option"
  prompts with gigantic [SELECT] and [ADD] buttons on the right of each
  incomplete section.

* Caches a copy of the SectionInformation in the relevant PaymentRequestSection
  instances so that we can determine if we need to prompt the user to SELECT
  or ADD new PaymentOptions.

* Buttons are enabled from top to bottom, with only one button enabled at a
  time.  This encourages users to move downward while filling out the form.
  When a button is visible for a section, the only way to interact with the
  section is via the button (no more clicking on incomplete sections to expand
  them).

* The shipping summary section, which combines both the shipping address and
  shipping option fields, can now display a button that shows either the
  button for the incomplete shipping address section or the incomplete shipping
  option section (prioritized in taht order).

* Get rid of and generalizes a bunch of unneeded strings.

* Because the logic is so complicated now, we consolidate most layout updates
  and view visibility checks to updateControlLayout().

* Updates the PaymentRequestDynamicShippingSingleAddressTest to account for the
  lack of summary text for incomplete sections.

* Edits the "select shipping address" string to add "and requirements" to the end.

Videos:
https://drive.google.com/open?id=0B7c8ZkXVwskDZDZWUkhDXzdvLUE
https://drive.google.com/open?id=0B7c8ZkXVwskDRm53UUhHUHZmeW8

BUG=603635

Review-Url: https://codereview.chromium.org/2170693002
Cr-Commit-Position: refs/heads/master@{#407289}
parent ffc181a2
......@@ -423,7 +423,7 @@ public class CardEditor extends EditorBase<AutofillPaymentInstrument> {
private void addBillingAddressDropdown(EditorModel editor, final CreditCard card) {
final List<DropdownKeyValue> billingAddresses = new ArrayList<>();
billingAddresses.add(new DropdownKeyValue(BILLING_ADDRESS_NONE,
mContext.getString(R.string.autofill_billing_address_select_prompt)));
mContext.getString(R.string.select)));
// Re-read profiles every time, in case any of them have changed. This does not cause a disk
// read, because personal_data_manager.h holds a cache.
......
......@@ -38,8 +38,7 @@ abstract class AutofillCreditCardEditor extends AutofillEditorBase {
profilesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
AutofillProfile noSelection = new AutofillProfile();
noSelection.setLabel(
getActivity().getString(R.string.autofill_billing_address_select_prompt));
noSelection.setLabel(getActivity().getString(R.string.select));
profilesAdapter.add(noSelection);
List<AutofillProfile> profiles = PersonalDataManager.getInstance().getProfilesForSettings();
......
......@@ -195,6 +195,12 @@ CHAR-LIMIT guidelines:
<message name="IDS_YESTERDAY" desc="Generic Label saying the date is yesterday.">
Yesterday
</message>
<message name="IDS_SELECT" desc="Prompt for user to select something. [CHAR-LIMIT=20]">
Select
</message>
<message name="IDS_ADD" desc="Prompt for the user to add something, like a new address. [CHAR-LIMIT=20]">
Add
</message>
<!-- Main Preferences -->
<message name="IDS_PREFERENCES" desc="Title for Chrome's Settings.">
......@@ -290,9 +296,6 @@ CHAR-LIMIT guidelines:
<message name="IDS_AUTOFILL_CREDIT_CARD_EDITOR_BILLING_ADDRESS" desc="Label for a spinner input field containing a list of billing addresses for a credit card. [CHAR-LIMIT=32]">
Billing address
</message>
<message name="IDS_AUTOFILL_BILLING_ADDRESS_SELECT_PROMPT" desc="Prompt for user to select a billing address in autofill settings for a credit card. [CHAR-LIMIT=24]">
Select
</message>
<message name="IDS_AUTOFILL_DESCRIBE_LOCAL_COPY" desc="Text label that describes a Wallet credit card which has been copied to the local Chrome instance.">
Copied to Chrome
</message>
......@@ -1583,9 +1586,6 @@ You are signing in with a managed account and giving its administrator control o
</message>
<!-- Add to Home screen strings -->
<message name="IDS_ADD" desc="Title for Add button [CHAR-LIMIT=20]">
Add
</message>
<message name="IDS_ADD_TO_HOMESCREEN_TITLE" desc="Edit text title for Add to Home screen dialog [CHAR-LIMIT=30]">
Title
</message>
......@@ -2634,15 +2634,9 @@ You can control the Physical Web in Chrome Settings.
<message name="IDS_PAYMENTS_METHOD_OF_PAYMENT_LABEL" desc="The title for the section that lets the user select the method of payment.">
Payment
</message>
<message name="IDS_PAYMENTS_SELECT_METHOD_OF_PAYMENT_PROMPT" desc="The label for the button that presents the user with the list of possible methods of payments, for example a list of their credit cards..">
Select payment method
</message>
<message name="IDS_PAYMENTS_CONTACT_DETAILS_LABEL" desc="The title for the section that lets the user select how they can be contacted.">
Contact info
</message>
<message name="IDS_PAYMENTS_SELECT_CONTACT_DETAILS_PROMPT" desc="The label for the button that presents the user with the list of possible phone numbers and email addresses where the user can be reached.">
Select contact details
</message>
<message name="IDS_PAYMENTS_ADD_CONTACT_DETAILS_LABEL" desc="The title of the dialog for user to add new contact information, such as email address or phone number.">
Add contact info
</message>
......@@ -2658,15 +2652,6 @@ You can control the Physical Web in Chrome Settings.
<message name="IDS_PAYMENTS_SHIPPING_OPTION_LABEL" desc="The title for the section that lets the user select how the product should be shipped.">
Shipping option
</message>
<message name="IDS_PAYMENTS_SELECT_SHIPPING_PROMPT" desc="The label for the button that presents the user with the list of possible shipping addresses and options.">
Select shipping
</message>
<message name="IDS_PAYMENTS_SELECT_SHIPPING_OPTION_PROMPT" desc="The label for the button that presents the user with the list of possible shipping options.">
Select shipping option
</message>
<message name="IDS_PAYMENTS_SELECT_SHIPPING_ADDRESS_PROMPT" desc="The label for the button that presents the user with the list of possible shipping addresses.">
Select shipping address
</message>
<message name="IDS_PAYMENTS_ORDER_SUMMARY_LABEL" desc="The title of the section that shows the summary of the order, including names and prices of individual line items, i.e. the bill.">
Order summary
</message>
......@@ -2707,7 +2692,7 @@ You can control the Physical Web in Chrome Settings.
Add contact info
</message>
<message name="IDS_PAYMENTS_SELECT_SHIPPING_ADDRESS_FOR_SHIPPING_METHODS" desc="Text implying that a user needs to pick a shipping address to see the shipping methods.">
Select a shipping address to check shipping methods.
Select a shipping address to check shipping methods and requirements.
</message>
<message name="IDS_PAYMENTS_CHECKING_OPTION" desc="Text explaining that the option the user selected is being checked and verified.">
Checking
......
......@@ -15,6 +15,7 @@ import org.chromium.chrome.R;
import org.chromium.chrome.browser.autofill.AutofillTestHelper;
import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard;
import org.chromium.chrome.browser.payments.ui.PaymentRequestSection;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
......@@ -47,7 +48,7 @@ public class PaymentRequestDynamicShippingSingleAddressTest extends PaymentReque
public void testAddressNotSelected()
throws InterruptedException, ExecutionException, TimeoutException {
triggerUIAndWait(mReadyForInput);
assertEquals("Select shipping", getAddressSectionLabel());
assertEquals(PaymentRequestSection.EDIT_BUTTON_SELECT, getSummarySectionButtonState());
}
/** Expand the shipping address section, select an address, and click "Pay." */
......
......@@ -10,7 +10,6 @@ import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.UrlUtils;
......@@ -251,13 +250,12 @@ abstract class PaymentRequestTestBase extends ChromeActivityTestCaseBase<ChromeA
helper.waitForCallback(callCount);
}
/** Returns the left summary label of the "Shipping summary" section. */
protected String getAddressSectionLabel() throws ExecutionException {
return ThreadUtils.runOnUiThreadBlocking(new Callable<String>() {
/** Gets the button state for the shipping summary section. */
protected int getSummarySectionButtonState() throws ExecutionException {
return ThreadUtils.runOnUiThreadBlocking(new Callable<Integer>() {
@Override
public String call() {
return ((TextView) mUI.getShippingSummarySectionForTest().findViewById(
R.id.payments_left_summary_label)).getText().toString();
public Integer call() {
return mUI.getShippingSummarySectionForTest().getEditButtonState();
}
});
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment