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

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

Issue 2421433004: [PaymentRequest] Make shipping name, address, phone and option each on its own line in the summary (Closed)
Patch Set: address comments 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 cac942a36b21063848e51b22a50a7db6e7d35828..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
@@ -456,44 +456,73 @@ public abstract class PaymentRequestSection extends LinearLayout implements View
}
/**
- * Section with a secondary TextView beneath the summary to show additional details.
+ * Section with three extra TextViews beneath the summary to show additional details.
*
* ............................................................................
- * . TITLE | CHEVRON .
+ * . TITLE | .
+ * .................................................................| .
+ * . LEFT SUMMARY TEXT | RIGHT SUMMARY TEXT | CHEVRON .
* .................................................................| or .
- * . LEFT SUMMARY TEXT | RIGHT SUMMARY TEXT | ADD .
+ * . EXTRA TEXT ONE | ADD .
* .................................................................| or .
- * . EXTRA TEXT | SELECT .
+ * . EXTRA TEXT TWO | SELECT .
+ * .................................................................| .
+ * . EXTRA TEXT THREE | .
* ............................................................................
*/
- public static class ExtraTextSection extends PaymentRequestSection {
- private TextView mExtraTextView;
+ public static class ExtraTextsSection extends PaymentRequestSection {
+ private TextView[] mExtraTextViews;
private int mEditButtonState = EDIT_BUTTON_GONE;
- public ExtraTextSection(Context context, String sectionName, SectionDelegate delegate) {
+ public ExtraTextsSection(Context context, String sectionName, SectionDelegate delegate) {
super(context, sectionName, delegate);
- setExtraText(null);
+ setExtraTexts(new String[] {null, null, null});
}
@Override
protected void createMainSectionContent(LinearLayout mainSectionLayout) {
Context context = mainSectionLayout.getContext();
- mExtraTextView = new TextView(context);
- ApiCompatibilityUtils.setTextAppearance(
- mExtraTextView, R.style.PaymentsUiSectionDescriptiveTextEndAligned);
- mainSectionLayout.addView(mExtraTextView, new LinearLayout.LayoutParams(
- LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
+ mExtraTextViews = new TextView[3];
+ for (int i = 0; i < mExtraTextViews.length; i++) {
+ mExtraTextViews[i] = new TextView(context);
+ ApiCompatibilityUtils.setTextAppearance(
+ mExtraTextViews[i], R.style.PaymentsUiSectionDefaultText);
+ mainSectionLayout.addView(
+ mExtraTextViews[i], new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
+ LayoutParams.WRAP_CONTENT));
+ }
+ }
+
+ /**
+ * Sets the CharSequences that are displayed in the extra TextViews.
+ *
+ * @param extraTexts Texts to display in the extra TextViews.
+ */
+ public void setExtraTexts(CharSequence[] extraTexts) {
+ assert extraTexts.length == mExtraTextViews.length;
+
+ for (int i = 0; i < mExtraTextViews.length; i++) {
+ mExtraTextViews[i].setText(extraTexts[i]);
+ mExtraTextViews[i].setVisibility(TextUtils.isEmpty(extraTexts[i]) ? GONE : VISIBLE);
+ }
}
/**
- * Sets the CharSequence that is displayed in the secondary TextView.
+ * Sets how the extra texts should be displayed.
*
- * @param text Text to display.
+ * @param textsTruncate How to truncate the extra texts. Set the element to null to clear.
+ * @param textsAreSingleLine Whether the extra texts should be displayed in a single line.
*/
- public void setExtraText(CharSequence text) {
- mExtraTextView.setText(text);
- mExtraTextView.setVisibility(TextUtils.isEmpty(text) ? GONE : VISIBLE);
+ public void setExtraTextsProperties(
+ TruncateAt[] textsTruncate, boolean[] textsAreSingleLine) {
+ assert textsTruncate.length == mExtraTextViews.length;
+ assert textsAreSingleLine.length == mExtraTextViews.length;
+
+ for (int i = 0; i < mExtraTextViews.length; i++) {
+ mExtraTextViews[i].setEllipsize(textsTruncate[i]);
+ mExtraTextViews[i].setSingleLine(textsAreSingleLine[i]);
+ }
}
/** Sets the state of the edit button. */

Powered by Google App Engine
This is Rietveld 408576698