OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.payments.ui; | 5 package org.chromium.chrome.browser.payments.ui; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.content.res.Resources; | 8 import android.content.res.Resources; |
9 import android.graphics.Color; | 9 import android.graphics.Color; |
10 import android.graphics.Typeface; | 10 import android.graphics.Typeface; |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
521 * .................................................................| CHERVO N . | 521 * .................................................................| CHERVO N . |
522 * . LEFT SUMMARY TEXT | RIGHT SUMMARY TEXT | or . | 522 * . LEFT SUMMARY TEXT | RIGHT SUMMARY TEXT | or . |
523 * .................................................................| ADD . | 523 * .................................................................| ADD . |
524 * . | Line item 1 | $13.99 | or . | 524 * . | Line item 1 | $13.99 | or . |
525 * . | Line item 2 | $.99 | SELEC T . | 525 * . | Line item 2 | $.99 | SELEC T . |
526 * . | Line item 3 | $2.99 | . | 526 * . | Line item 3 | $2.99 | . |
527 * ......................................................................... ... | 527 * ......................................................................... ... |
528 */ | 528 */ |
529 public static class LineItemBreakdownSection extends PaymentRequestSection { | 529 public static class LineItemBreakdownSection extends PaymentRequestSection { |
530 private GridLayout mBreakdownLayout; | 530 private GridLayout mBreakdownLayout; |
531 private static final int MAX_CURRENCY_CHARS = 6; | |
532 private static final String ELLIPSIS = "..."; | |
please use gerrit instead
2016/08/25 16:47:38
Use the unicode ellipsis character: http://www.fil
pals
2016/08/26 07:20:26
If it is ok, I'll do the application related chang
please use gerrit instead
2016/08/26 17:01:37
OK. Since Samsung does not use Chromium's UI (as f
pals
2016/08/27 11:16:31
I'm working on it here https://codereview.chromium
| |
531 | 533 |
532 public LineItemBreakdownSection( | 534 public LineItemBreakdownSection( |
533 Context context, String sectionName, SectionDelegate delegate) { | 535 Context context, String sectionName, SectionDelegate delegate) { |
534 super(context, sectionName, delegate); | 536 super(context, sectionName, delegate); |
535 } | 537 } |
536 | 538 |
537 @Override | 539 @Override |
538 protected void createMainSectionContent(LinearLayout mainSectionLayout) { | 540 protected void createMainSectionContent(LinearLayout mainSectionLayout) { |
539 Context context = mainSectionLayout.getContext(); | 541 Context context = mainSectionLayout.getContext(); |
540 | 542 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
598 /** | 600 /** |
599 * Builds a CharSequence that displays a value in a particular currency. | 601 * Builds a CharSequence that displays a value in a particular currency. |
600 * | 602 * |
601 * @param currency Currency of the value being displayed. | 603 * @param currency Currency of the value being displayed. |
602 * @param value Value to display. | 604 * @param value Value to display. |
603 * @param isValueBold Whether or not to bold the item. | 605 * @param isValueBold Whether or not to bold the item. |
604 * @return CharSequence that represents the whole value. | 606 * @return CharSequence that represents the whole value. |
605 */ | 607 */ |
606 private CharSequence createValueString(String currency, String value, bo olean isValueBold) { | 608 private CharSequence createValueString(String currency, String value, bo olean isValueBold) { |
607 SpannableStringBuilder valueBuilder = new SpannableStringBuilder(); | 609 SpannableStringBuilder valueBuilder = new SpannableStringBuilder(); |
610 if (currency.length() > MAX_CURRENCY_CHARS) { | |
please use gerrit instead
2016/08/25 16:47:38
All currency formatting should happen in CurrencyS
| |
611 currency = currency.substring(0, MAX_CURRENCY_CHARS) + ELLIPSIS; | |
please use gerrit instead
2016/08/25 16:47:38
currency = currency.substring(0, MAX_CURRENCY_CHAR
| |
612 } | |
608 valueBuilder.append(currency); | 613 valueBuilder.append(currency); |
609 valueBuilder.append(" "); | 614 valueBuilder.append(" "); |
610 | 615 |
611 int boldStartIndex = valueBuilder.length(); | 616 int boldStartIndex = valueBuilder.length(); |
612 valueBuilder.append(value); | 617 valueBuilder.append(value); |
613 | 618 |
614 if (isValueBold) { | 619 if (isValueBold) { |
615 valueBuilder.setSpan(new StyleSpan(android.graphics.Typeface.BOL D), boldStartIndex, | 620 valueBuilder.setSpan(new StyleSpan(android.graphics.Typeface.BOL D), boldStartIndex, |
616 boldStartIndex + value.length(), 0); | 621 boldStartIndex + value.length(), 0); |
617 } | 622 } |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1145 } | 1150 } |
1146 | 1151 |
1147 /** Expand the separator to be the full width of the dialog. */ | 1152 /** Expand the separator to be the full width of the dialog. */ |
1148 public void expand() { | 1153 public void expand() { |
1149 LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) getLa youtParams(); | 1154 LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) getLa youtParams(); |
1150 ApiCompatibilityUtils.setMarginStart(params, 0); | 1155 ApiCompatibilityUtils.setMarginStart(params, 0); |
1151 ApiCompatibilityUtils.setMarginEnd(params, 0); | 1156 ApiCompatibilityUtils.setMarginEnd(params, 0); |
1152 } | 1157 } |
1153 } | 1158 } |
1154 } | 1159 } |
OLD | NEW |