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

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

Issue 588333002: remove CountryAdapterAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/android/chrome_jni_registrar.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/autofill/CountryAdapter.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/CountryAdapter.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/CountryAdapter.java
deleted file mode 100644
index 5c8e512167e8fdfbbb4e312782492745ec020133..0000000000000000000000000000000000000000
--- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/CountryAdapter.java
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright 2014 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 android.database.DataSetObserver;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.SpinnerAdapter;
-import android.widget.TextView;
-
-import org.chromium.base.JNINamespace;
-import org.chromium.chrome.R;
-
-/**
- * Android wrapper for CountryComboboxModel.
- *
- * Only useable from the UI layer. Used in the Android settings UI.
- * See chrome/browser/ui/android/autofill/country_adapter_android.h for more details.
- */
-@JNINamespace("autofill")
-public class CountryAdapter implements SpinnerAdapter {
- /**
- * The items to show in the spinner.
- *
- * Even indices are display names, odd indices are country codes.
- */
- private String[] mItems;
-
- private LayoutInflater mInflater;
- private final long mCountryAdapterAndroid;
-
- public CountryAdapter(LayoutInflater inflater) {
- mInflater = inflater;
- mCountryAdapterAndroid = nativeInit();
- mItems = nativeGetItems(mCountryAdapterAndroid);
- }
-
- @Override
- public int getCount() {
- return mItems.length / 2;
- }
-
- @Override
- public Object getItem(int position) {
- return mItems[position * 2 + 1];
- }
-
- @Override
- public long getItemId(int position) {
- return position;
- }
-
- @Override
- public int getItemViewType(int position) {
- return 0;
- }
-
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- TextView textView = null;
- if (convertView instanceof TextView) {
- textView = (TextView) convertView;
- }
- if (textView == null) {
- textView = (TextView) mInflater.inflate(R.layout.country_text, parent, false);
- }
-
- textView.setText(mItems[position * 2]);
- return textView;
- }
-
- @Override
- public boolean hasStableIds() {
- return true;
- }
-
- @Override
- public int getViewTypeCount() {
- return 1;
- }
-
- @Override
- public boolean isEmpty() {
- return false;
- }
-
- @Override
- public void registerDataSetObserver(DataSetObserver observer) {}
-
- @Override
- public void unregisterDataSetObserver(DataSetObserver observer) {}
-
- @Override
- public View getDropDownView(int position, View convertView, ViewGroup parent) {
- TextView textView = null;
- if (convertView instanceof TextView) {
- textView = (TextView) convertView;
- }
- if (textView == null) {
- textView = (TextView) mInflater.inflate(R.layout.country_item, parent, false);
- }
-
- textView.setText(mItems[position * 2]);
- return textView;
- }
-
- /**
- * Gets the index in the model for the given country code.
- */
- public int getIndexForCountryCode(String countryCode) {
- for (int i = 0; i < getCount(); i++) {
- if (countryCode.equals(getItem(i))) {
- return i;
- }
- }
- return 0;
- }
-
- private native long nativeInit();
- private native String[] nativeGetItems(long nativeCountryAdapterAndroid);
-}
« no previous file with comments | « no previous file | chrome/browser/android/chrome_jni_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698