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

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

Issue 2163693002: [Merge M-53] Credit card editor for PaymentRequest UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 5 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/EditorLabelField.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorLabelField.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorLabelField.java
new file mode 100644
index 0000000000000000000000000000000000000000..30f2a377ac6d3af616fcd9ba5a9b0bd88151beee
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorLabelField.java
@@ -0,0 +1,61 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.payments.ui;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import org.chromium.chrome.R;
+
+/**
+ * Helper class for creating a view with three labels and an icon.
+ *
+ * +--------------+------------+
+ * | TOP LABEL | |
+ * | MID LABEL | ICON |
+ * | BOTTOM LABEL | |
+ * +--------------+------------+
+ *
+ * Used for showing the uneditable parts of server cards. For example:
+ *
+ * +--------------+------------+
+ * | Visa***1234 | |
+ * | First Last | VISA |
+ * | Exp: 12/2020 | |
+ * +--------------+------------+
+ */
+class EditorLabelField {
+ private final View mLayout;
+
+ /**
+ * Builds a label view.
+ *
+ * @param context The application context to use when creating widgets.
+ * @param root The object that provides a set of LayoutParams values for the view.
+ * @param fieldModel The data model of the icon list.
+ */
+ public EditorLabelField(Context context, ViewGroup root, EditorFieldModel fieldModel) {
+ assert fieldModel.getInputTypeHint() == EditorFieldModel.INPUT_TYPE_HINT_LABEL;
+
+ mLayout = LayoutInflater.from(context).inflate(
+ R.layout.payment_request_editor_label, root, false);
+
+ ((TextView) mLayout.findViewById(R.id.top_label)).setText(fieldModel.getLabel());
+ ((TextView) mLayout.findViewById(R.id.mid_label)).setText(fieldModel.getMidLabel());
+ ((TextView) mLayout.findViewById(R.id.bottom_label)).setText(fieldModel.getBottomLabel());
+
+ ((ImageView) mLayout.findViewById(R.id.icon)).setImageResource(
+ fieldModel.getLabelIconResourceId());
+ }
+
+ /** @return The View containing everything. */
+ public View getLayout() {
+ return mLayout;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698