Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1213)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestSection.java

Issue 2170603006: [Payments] Use the correct index when checking addresses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUI.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a8a9f336a3eaa0fc629d4a71df1adce697ea30d5..4078cb4b68ab9ab52948e20671dd298b71f32c6d 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
@@ -540,7 +540,7 @@ public abstract class PaymentRequestSection extends LinearLayout {
* + The "label" is text describing the row.
* + The "icon" is a logo representing the option, like a credit card.
*/
- private class OptionRow {
+ public class OptionRow {
private static final int OPTION_ROW_TYPE_OPTION = 0;
private static final int OPTION_ROW_TYPE_ADD = 1;
private static final int OPTION_ROW_TYPE_DESCRIPTION = 2;
@@ -589,6 +589,12 @@ public abstract class PaymentRequestSection extends LinearLayout {
mButton.setId(id);
}
+ /** @return the label for the row. */
+ @VisibleForTesting
+ public CharSequence getLabelText() {
+ return mLabel.getText();
+ }
+
private View createButton(
GridLayout parent, int rowIndex, boolean isSelected, boolean isEnabled) {
if (mRowType == OPTION_ROW_TYPE_DESCRIPTION) return null;
@@ -881,21 +887,22 @@ public abstract class PaymentRequestSection extends LinearLayout {
mLabelsForTest.clear();
// Show any additional text requested by the layout.
- if (!TextUtils.isEmpty(mDelegate.getAdditionalText(this))) {
+ String additionalText = mDelegate.getAdditionalText(this);
+ if (!TextUtils.isEmpty(additionalText)) {
OptionRow descriptionRow = new OptionRow(mOptionLayout,
- mOptionLayout.getChildCount(),
+ mOptionRows.size(),
mDelegate.isAdditionalTextDisplayingWarning(this)
? OptionRow.OPTION_ROW_TYPE_WARNING
: OptionRow.OPTION_ROW_TYPE_DESCRIPTION,
null, false);
mOptionRows.add(descriptionRow);
- descriptionRow.setLabel(mDelegate.getAdditionalText(this));
+ descriptionRow.setLabel(additionalText);
}
// List out known payment options.
int firstOptionIndex = INVALID_OPTION_INDEX;
for (int i = 0; i < information.getSize(); i++) {
- int currentRow = mOptionLayout.getChildCount();
+ int currentRow = mOptionRows.size();
if (firstOptionIndex == INVALID_OPTION_INDEX) firstOptionIndex = currentRow;
PaymentOption item = information.getItem(i);
@@ -957,6 +964,12 @@ public abstract class PaymentRequestSection extends LinearLayout {
public int getNumberOfOptionLabelsForTest() {
return mLabelsForTest.size();
}
+
+ /** Returns the OptionRow at the specified |index|. */
+ @VisibleForTesting
+ public OptionRow getOptionRowAtIndex(int index) {
+ return mOptionRows.get(index);
+ }
}
/**
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUI.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698