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.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
9 import android.view.LayoutInflater; | 9 import android.view.LayoutInflater; |
10 import android.view.View; | 10 import android.view.View; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 (MarginLayoutParams) pageInfoGroup.getLayoutParams(), titleEndMa rgin); | 56 (MarginLayoutParams) pageInfoGroup.getLayoutParams(), titleEndMa rgin); |
57 | 57 |
58 // Indicate that we're processing the data. | 58 // Indicate that we're processing the data. |
59 TextView messageView = (TextView) mResultLayout.findViewById(R.id.messag e); | 59 TextView messageView = (TextView) mResultLayout.findViewById(R.id.messag e); |
60 messageView.setText(R.string.payments_processing_message); | 60 messageView.setText(R.string.payments_processing_message); |
61 } | 61 } |
62 | 62 |
63 /** | 63 /** |
64 * Updates the UI to display whether or not the payment request was successf ul. | 64 * Updates the UI to display whether or not the payment request was successf ul. |
65 * | 65 * |
66 * @param paymentSuccess Whether or not the payment request was successful. | 66 * @param immediateClose Whether dismissing the dialog immediately without d escribing error. |
palmer
2016/06/16 22:00:55
Same issue here.
| |
67 * @param callback Callback to run upon dismissal. | 67 * @param callback Callback to run upon dismissal. |
68 */ | 68 */ |
69 public void update(boolean paymentSuccess, final Runnable callback) { | 69 public void update(boolean immediateClose, final Runnable callback) { |
70 if (mResultLayout.getParent() == null || paymentSuccess) { | 70 if (mResultLayout.getParent() == null || immediateClose) { |
71 // Dismiss the dialog immediately. | 71 // if the complete() method takes success or empty string, immediate Close will be true. |
palmer
2016/06/16 22:00:55
I don't understand this comment.
please use gerrit instead
2016/06/16 22:06:11
English is my second language as well, but perhaps
| |
72 // Then dismiss the dialog immediately. | |
72 callback.run(); | 73 callback.run(); |
73 } else { | 74 } else { |
74 // Describe the error. | 75 // Describe the error. |
75 Context context = mResultLayout.getContext(); | 76 Context context = mResultLayout.getContext(); |
76 TextView resultMessage = (TextView) mResultLayout.findViewById(R.id. message); | 77 TextView resultMessage = (TextView) mResultLayout.findViewById(R.id. message); |
77 resultMessage.setText(context.getString(R.string.payments_error_mess age)); | 78 resultMessage.setText(context.getString(R.string.payments_error_mess age)); |
78 resultMessage.setTextColor(ApiCompatibilityUtils.getColor( | 79 resultMessage.setTextColor(ApiCompatibilityUtils.getColor( |
79 context.getResources(), R.color.error_text_color)); | 80 context.getResources(), R.color.error_text_color)); |
80 ApiCompatibilityUtils.setTextAlignment(resultMessage, View.TEXT_ALIG NMENT_VIEW_START); | 81 ApiCompatibilityUtils.setTextAlignment(resultMessage, View.TEXT_ALIG NMENT_VIEW_START); |
81 | 82 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 * TODO(dfalcantara): The dialog should listen for configuration changes and resize accordingly. | 124 * TODO(dfalcantara): The dialog should listen for configuration changes and resize accordingly. |
124 */ | 125 */ |
125 public static int computeMaxWidth(Context context, int availableWidth, int a vailableHeight) { | 126 public static int computeMaxWidth(Context context, int availableWidth, int a vailableHeight) { |
126 int baseUnit = context.getResources().getDimensionPixelSize(R.dimen.dial og_width_unit); | 127 int baseUnit = context.getResources().getDimensionPixelSize(R.dimen.dial og_width_unit); |
127 int maxSize = Math.min(availableWidth, availableHeight); | 128 int maxSize = Math.min(availableWidth, availableHeight); |
128 int multiplier = maxSize / baseUnit; | 129 int multiplier = maxSize / baseUnit; |
129 int floatingDialogWidth = multiplier * baseUnit; | 130 int floatingDialogWidth = multiplier * baseUnit; |
130 return floatingDialogWidth; | 131 return floatingDialogWidth; |
131 } | 132 } |
132 } | 133 } |
OLD | NEW |