Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestSection.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestSection.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestSection.java |
| index 4c506bac1d64759d2c38d305739674e543d43411..316cb7aaff7c87e2e26251ba72f8d83553493750 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestSection.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestSection.java |
| @@ -106,6 +106,15 @@ public abstract class PaymentRequestSection extends LinearLayout { |
| protected final SectionDelegate mDelegate; |
| protected final int mLargeSpacing; |
| + /** An array mapping the index of a option label to its id. */ |
|
please use gerrit instead
2016/07/08 09:36:26
"an option label"
sebsg
2016/07/08 09:50:42
Done.
|
| + private static final int[] OPTION_LABEL_IDS = { |
| + R.id.payments_first_option_label, |
| + R.id.payments_second_option_label, |
| + R.id.payments_third_option_label, |
| + R.id.payments_fourth_option_label, |
| + R.id.payments_fifth_option_label |
| + }; |
| + |
| private final int mVerticalSpacing; |
| private final int mFocusedBackgroundColor; |
| private final LinearLayout mMainSection; |
| @@ -577,10 +586,15 @@ public abstract class PaymentRequestSection extends LinearLayout { |
| } |
| /** Set the button identifier for the option. */ |
| - public void setId(int id) { |
| + public void setButtonId(int id) { |
| mButton.setId(id); |
| } |
| + /** Set the label identifier for the option. */ |
| + public void setLabelId(int id) { |
| + mLabel.setId(id); |
| + } |
| + |
| private View createButton( |
| GridLayout parent, int rowIndex, boolean isSelected, boolean isEnabled) { |
| if (mRowType == OPTION_ROW_TYPE_DESCRIPTION) return null; |
| @@ -884,13 +898,19 @@ public abstract class PaymentRequestSection extends LinearLayout { |
| if (firstOptionIndex == INVALID_OPTION_INDEX) firstOptionIndex = currentRow; |
| PaymentOption item = information.getItem(i); |
| - mOptionRows.add(new OptionRow(mOptionLayout, currentRow, |
| - OptionRow.OPTION_ROW_TYPE_OPTION, item, item == selectedItem)); |
| + OptionRow currentOptionRow = new OptionRow(mOptionLayout, currentRow, |
| + OptionRow.OPTION_ROW_TYPE_OPTION, item, item == selectedItem); |
| + mOptionRows.add(currentOptionRow); |
| + |
| + // For testing, set the id of the option label. |
| + if (i < OPTION_LABEL_IDS.length) { |
| + currentOptionRow.setLabelId(OPTION_LABEL_IDS[i]); |
| + } |
| } |
| // For testing. |
| if (firstOptionIndex != INVALID_OPTION_INDEX) { |
| - mOptionRows.get(firstOptionIndex).setId(R.id.payments_first_radio_button); |
| + mOptionRows.get(firstOptionIndex).setButtonId(R.id.payments_first_radio_button); |
| } |
| // If the user is allowed to add new options, show the button for it. |
| @@ -898,7 +918,7 @@ public abstract class PaymentRequestSection extends LinearLayout { |
| OptionRow addRow = new OptionRow(mOptionLayout, mOptionLayout.getChildCount(), |
| OptionRow.OPTION_ROW_TYPE_ADD, null, false); |
| addRow.setLabel(information.getAddStringId()); |
| - addRow.setId(R.id.payments_add_option_button); |
| + addRow.setButtonId(R.id.payments_add_option_button); |
| mOptionRows.add(addRow); |
| } |
| } |