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

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

Issue 2810373003: [Payments] Display label and price in line item section in the same available width (Closed)
Patch Set: Created 3 years, 8 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 | no next file » | 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 7313f5718ec3fcadfcd31e7ea1aae2fa4bb378df..665f1a3b4344be7b49104aeca6e13e3f9e6256d3 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
@@ -458,7 +458,7 @@ public abstract class PaymentRequestSection extends LinearLayout implements View
mChevronView.setVisibility(
mDisplayMode == DISPLAY_MODE_EXPANDABLE ? VISIBLE : GONE);
} else {
- // Show the edit button and hide the chevron and the summary.
+ // Show the edit button and hide the chevron.
boolean isButtonAllowed = mDisplayMode == DISPLAY_MODE_EXPANDABLE
|| mDisplayMode == DISPLAY_MODE_NORMAL;
mChevronView.setVisibility(GONE);
@@ -677,6 +677,13 @@ public abstract class PaymentRequestSection extends LinearLayout implements View
new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
breakdownParams.gravity = Gravity.END;
mainSectionLayout.addView(mBreakdownLayout, breakdownParams);
+
+ // Sets the summary right text view takes the same available space as the summary left
+ // text view.
+ LinearLayout.LayoutParams rightTextViewLayoutParams =
+ (LinearLayout.LayoutParams) getSummaryRightTextView().getLayoutParams();
+ rightTextViewLayoutParams.width = 0;
+ rightTextViewLayoutParams.weight = 1f;
}
/**
@@ -699,6 +706,9 @@ public abstract class PaymentRequestSection extends LinearLayout implements View
ApiCompatibilityUtils.setTextAlignment(mUpdatedView, TEXT_ALIGNMENT_TEXT_END);
mUpdatedView.setTextColor(ApiCompatibilityUtils.getColor(
context.getResources(), R.color.google_green_700));
+ ApiCompatibilityUtils.setMarginStart(updatedLayoutParams,
+ context.getResources().getDimensionPixelSize(
+ R.dimen.payments_section_small_spacing));
ApiCompatibilityUtils.setMarginEnd(
updatedLayoutParams, context.getResources().getDimensionPixelSize(
R.dimen.payments_section_small_spacing));
@@ -834,6 +844,23 @@ public abstract class PaymentRequestSection extends LinearLayout implements View
}
@Override
+ public void setDisplayMode(int displayMode) {
+ // Displays the summary left text view in at most three lines if in focus mode,
+ // otherwise display it in a single line.
+ if (displayMode == DISPLAY_MODE_FOCUSED) {
+ setSummaryProperties(TruncateAt.END, false /* leftIsSingleLine */,
+ null /* rightTruncate */, false /* rightIsSingleLine */);
+ getSummaryLeftTextView().setMaxLines(3);
+ } else {
+ setSummaryProperties(TruncateAt.END, true /* leftIsSingleLine */,
+ null /* rightTruncate */, false /* rightIsSingleLine */);
+ getSummaryLeftTextView().setMaxLines(1);
+ }
+
+ super.setDisplayMode(displayMode);
+ }
+
+ @Override
protected void updateControlLayout() {
if (!mIsLayoutInitialized) return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698