Chromium Code Reviews| 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..7844d20802e2965c4c309b323510a88ab725608a |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorLabelField.java |
| @@ -0,0 +1,45 @@ |
| +// 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.widget.ImageView; |
| +import android.widget.TextView; |
| + |
| +import org.chromium.chrome.R; |
| + |
| +/** |
| + * Helper class for creating a label view. |
|
gone
2016/07/13 21:13:01
Describe what a label is because it's more than ju
please use gerrit instead
2016/07/14 17:21:44
Done.
|
| + */ |
| +class EditorLabelField { |
| + private final View mLayout; |
| + |
| + /** |
| + * Builds a label view. |
| + * |
| + * @param context The application context to use when creating widgets. |
| + * @param fieldModel The data model of the icon list. |
| + */ |
| + public EditorLabelField(Context context, EditorFieldModel fieldModel) { |
| + assert fieldModel.getInputTypeHint() == EditorFieldModel.INPUT_TYPE_HINT_LABEL; |
| + |
| + mLayout = LayoutInflater.from(context).inflate( |
| + R.layout.payment_request_editor_label, null, false); |
| + |
| + ((TextView) mLayout.findViewById(R.id.label)).setText(fieldModel.getLabel()); |
| + ((TextView) mLayout.findViewById(R.id.midlabel)).setText(fieldModel.getMidLabel()); |
| + ((TextView) mLayout.findViewById(R.id.sublabel)).setText(fieldModel.getSubLabel()); |
| + |
| + ((ImageView) mLayout.findViewById(R.id.icon)).setImageResource( |
| + fieldModel.getLabelIconResourceId()); |
| + } |
| + |
| + /** @return The View containing everything. */ |
| + public View getLayout() { |
| + return mLayout; |
| + } |
| +} |