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

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

Issue 2437223002: Revert of Make PaymentOption store a Drawable instead of id (Closed)
Patch Set: Created 4 years, 2 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
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 3f2e5608bdbf15ee2160c6f309c433ef69a7b7fd..315ceb17d4cae1950b67aeb4261ab8647f72d10c 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
@@ -8,7 +8,6 @@
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.Typeface;
-import android.graphics.drawable.Drawable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.TextUtils.TruncateAt;
@@ -136,7 +135,7 @@
private TextView mSummaryLeftTextView;
private TextView mSummaryRightTextView;
- private Drawable mLogo;
+ private int mLogoResourceId;
private boolean mIsSummaryAllowed = true;
/**
@@ -174,12 +173,12 @@
/**
* Sets what logo should be displayed.
*
- * @param resource The logo to display.
- */
- protected void setLogoDrawable(Drawable logo) {
+ * @param resourceId ID of the logo to display.
+ */
+ protected void setLogoResource(int resourceId) {
assert isLogoNecessary();
- mLogo = logo;
- mLogoView.setImageDrawable(mLogo);
+ mLogoResourceId = resourceId;
+ mLogoView.setImageResource(resourceId);
}
@Override
@@ -412,7 +411,7 @@
// Update whether the logo is displayed.
if (mLogoView != null) {
- boolean show = mLogo != null && mDisplayMode != DISPLAY_MODE_FOCUSED;
+ boolean show = mLogoResourceId != 0 && mDisplayMode != DISPLAY_MODE_FOCUSED;
mLogoView.setVisibility(show ? VISIBLE : GONE);
}
@@ -719,7 +718,7 @@
public OptionRow(GridLayout parent, int rowIndex, int rowType, PaymentOption item,
boolean isSelected) {
- boolean iconExists = item != null && item.getDrawableIcon() != null;
+ boolean iconExists = item != null && item.getDrawableIconId() != 0;
boolean isEnabled = item != null && item.isValid();
mRowType = rowType;
mOption = item;
@@ -872,7 +871,7 @@
ImageView icon = new ImageView(parent.getContext());
icon.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
icon.setBackgroundResource(R.drawable.payments_ui_logo_bg);
- icon.setImageDrawable(mOption.getDrawableIcon());
+ icon.setImageResource(mOption.getDrawableIconId());
icon.setMaxWidth(mIconMaxWidth);
// The icon floats to the right of everything.
@@ -1054,11 +1053,11 @@
private void updateSelectedItem(PaymentOption selectedItem) {
if (selectedItem == null) {
- setLogoDrawable(null);
+ setLogoResource(0);
setIsSummaryAllowed(false);
setSummaryText(null, null);
} else {
- setLogoDrawable(selectedItem.getDrawableIcon());
+ setLogoResource(selectedItem.getDrawableIconId());
setSummaryText(convertOptionToString(selectedItem, false), null);
}

Powered by Google App Engine
This is Rietveld 408576698