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

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

Issue 2041483002: [Payments] Partially refactor the PaymentRequestUI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed file Created 4 years, 6 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/PaymentResultUIManager.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentResultUI.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentResultUIManager.java
similarity index 73%
rename from chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentResultUI.java
rename to chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentResultUIManager.java
index cb21aef8fccf037993ecaf7b61dee2da859a7b20..ebb171dbc3a5bad56937078755d84acf1325447c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentResultUI.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentResultUIManager.java
@@ -10,6 +10,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
+import android.view.ViewGroup.MarginLayoutParams;
import android.widget.ImageView;
import android.widget.TextView;
@@ -19,7 +20,7 @@ import org.chromium.chrome.R;
/**
* Displays the status of a payment request to the user.
*/
-public class PaymentResultUI {
+public class PaymentResultUIManager {
private final ViewGroup mResultLayout;
/**
@@ -31,11 +32,32 @@ public class PaymentResultUI {
* @param title Title of the webpage.
* @param origin Origin of the webpage.
*/
- public PaymentResultUI(Context context, String title, String origin) {
+ public PaymentResultUIManager(Context context, String title, String origin) {
mResultLayout =
- (ViewGroup) LayoutInflater.from(context).inflate(R.layout.payment_result, null);
+ (ViewGroup) LayoutInflater.from(context).inflate(R.layout.payment_request, null);
((TextView) mResultLayout.findViewById(R.id.page_title)).setText(title);
((TextView) mResultLayout.findViewById(R.id.hostname)).setText(origin);
+
+ // In lieu of being able to set the elevation, use a drop shadow background.
+ mResultLayout.setBackgroundResource(R.drawable.menu_bg);
+
+ // Remove views specific to the request dialog.
+ int[] viewsToRemove = {R.id.option_container, R.id.button_bar, R.id.close_button};
+ for (int i = 0; i < viewsToRemove.length; i++) {
+ View toRemove = mResultLayout.findViewById(viewsToRemove[i]);
+ ((ViewGroup) toRemove.getParent()).removeView(toRemove);
+ }
+
+ // Expand the page information to take up the space formerly occupied by the X.
+ int titleEndMargin = context.getResources().getDimensionPixelSize(
+ R.dimen.payments_section_large_spacing);
+ View pageInfoGroup = mResultLayout.findViewById(R.id.page_info);
+ ApiCompatibilityUtils.setMarginEnd(
+ (MarginLayoutParams) pageInfoGroup.getLayoutParams(), titleEndMargin);
+
+ // Indicate that we're processing the data.
+ TextView messageView = (TextView) mResultLayout.findViewById(R.id.message);
+ messageView.setText(R.string.payments_processing_message);
}
/**
@@ -49,19 +71,18 @@ public class PaymentResultUI {
// Dismiss the dialog immediately.
callback.run();
} else {
- // Show the result of the payment.
+ // Describe the error.
Context context = mResultLayout.getContext();
- TextView resultMessage = (TextView) mResultLayout.findViewById(R.id.waiting_message);
+ TextView resultMessage = (TextView) mResultLayout.findViewById(R.id.message);
+ resultMessage.setText(context.getString(R.string.payments_error_message));
+ resultMessage.setTextColor(ApiCompatibilityUtils.getColor(
+ context.getResources(), R.color.error_text_color));
+ ApiCompatibilityUtils.setTextAlignment(resultMessage, View.TEXT_ALIGNMENT_VIEW_START);
// Hide the progress bar.
View progressBar = mResultLayout.findViewById(R.id.waiting_progress);
progressBar.setVisibility(View.GONE);
- // Describe the error.
- resultMessage.setText(context.getString(R.string.payments_error_message));
- resultMessage.setTextColor(ApiCompatibilityUtils.getColor(
- context.getResources(), R.color.error_text_color));
-
// Make the user explicitly click on the OK button to dismiss the dialog.
View confirmButton = mResultLayout.findViewById(R.id.ok_button);
confirmButton.setVisibility(View.VISIBLE);
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentResultUI.java ('k') | chrome/android/java_sources.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698