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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogTitleView.java

Issue 12412003: Initial UI structure for autofill dialog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Styling fixes Created 7 years, 10 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/autofill/AutofillDialogTitleView.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogTitleView.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogTitleView.java
new file mode 100644
index 0000000000000000000000000000000000000000..8f29c35c1f2d8d9ae45b5ec85ea984be2aa5b8b3
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogTitleView.java
@@ -0,0 +1,63 @@
+// Copyright (c) 2013 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.autofill;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.widget.ArrayAdapter;
+import android.widget.FrameLayout;
+import android.widget.Spinner;
+import android.widget.AdapterView.OnItemSelectedListener;
+
+import org.chromium.chrome.R;
+
+/**
+ * This is the layout that contains the title items for the autofill dialog.
+ * In principle it shouldn't contain any logic related with the
+ * actual workflow, but rather respond to any UI update messages coming to it
+ * from the AutofillDialog. It should also be not dependent on the UI state of
+ * the content.
+ */
+public class AutofillDialogTitleView extends FrameLayout {
+ private static final List<String> mConstantItems = new ArrayList<String>();
+
+ private List<String> mAccountNames;
+ private ArrayAdapter<String> mAdapter;
+
+ public AutofillDialogTitleView(Context context) {
+ super(context);
+ if (mConstantItems.size() == 0) {
Ted C 2013/03/06 01:41:56 isEmpty?
Yusuf 2013/03/06 19:50:00 Done.
+ mConstantItems.add(getResources().getString(R.string.autofill_new_account));
+ mConstantItems.add(getResources().getString(R.string.autofill_use_local));
+ }
+
+ LayoutInflater.from(context).inflate(R.layout.autofill_dialog_title, this, true);
+ Spinner accounts_spinner = (Spinner)findViewById(R.id.accounts_spinner);
+ mAdapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_item);
+ mAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ mAdapter.addAll(mConstantItems);
+ accounts_spinner.setAdapter(mAdapter);
+ }
+
+ public AutofillDialogTitleView(Context context, List<String> accountNames) {
Ted C 2013/03/06 01:41:56 javadoc
Yusuf 2013/03/06 19:50:00 Done.
+ this(context);
+ mAccountNames = accountNames;
+ mAdapter.clear();
+ mAdapter.addAll(mAccountNames);
+ mAdapter.addAll(mConstantItems);
+ }
+
+ /**
+ * Set the listener for all the dropdown members in the layout.
+ * @param listener The listener object to attach to the dropdowns.
+ */
+ public void setOnItemSelectedListener(OnItemSelectedListener listener) {
+ Spinner accounts_spinner = (Spinner)findViewById(R.id.accounts_spinner);
+ accounts_spinner.setOnItemSelectedListener(listener);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698