summaryrefslogtreecommitdiffstats
path: root/ui/android
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-27 22:00:30 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-27 22:00:30 +0000
commit456671a07d53630e53a80b1abbb019f3fac5f6f7 (patch)
tree79f8ee3874cd8d854c3c9c75824415a13f34bc2e /ui/android
parentc02f79da5f0b86bdef6a4104021e77ed77acc1b5 (diff)
downloadchromium_src-456671a07d53630e53a80b1abbb019f3fac5f6f7.zip
chromium_src-456671a07d53630e53a80b1abbb019f3fac5f6f7.tar.gz
chromium_src-456671a07d53630e53a80b1abbb019f3fac5f6f7.tar.bz2
Revert "Implement the autofill UI for chromium powered android webview."
This reverts r208986 Review URL: https://codereview.chromium.org/18121004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209008 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/android')
-rw-r--r--ui/android/java/res/drawable/autofill_popup_background.xml13
-rw-r--r--ui/android/java/res/layout/autofill_text.xml34
-rw-r--r--ui/android/java/res/values-v17/styles.xml13
-rw-r--r--ui/android/java/resource_map/org/chromium/ui/R.java6
-rw-r--r--ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java54
-rw-r--r--ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java210
-rw-r--r--ui/android/java/src/org/chromium/ui/autofill/AutofillSuggestion.java26
7 files changed, 0 insertions, 356 deletions
diff --git a/ui/android/java/res/drawable/autofill_popup_background.xml b/ui/android/java/res/drawable/autofill_popup_background.xml
deleted file mode 100644
index 0f8d38b..0000000
--- a/ui/android/java/res/drawable/autofill_popup_background.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright 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.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_above_anchor="true"
- android:drawable="@drawable/autofill_popup_background_up" />
- <item android:drawable="@drawable/autofill_popup_background_down" />
-</selector> \ No newline at end of file
diff --git a/ui/android/java/res/layout/autofill_text.xml b/ui/android/java/res/layout/autofill_text.xml
deleted file mode 100644
index 4a69862..0000000
--- a/ui/android/java/res/layout/autofill_text.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 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.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/autofill_menu_text"
- android:layout_width="fill_parent"
- android:layout_height="44dp"
- android:minHeight="44dp"
- android:orientation="vertical"
- android:gravity="center_vertical">
- <TextView android:id="@+id/autofill_label"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:ellipsize="end"
- android:singleLine="true"
- android:textSize="18sp"
- android:includeFontPadding="false"
- android:layout_marginStart="10dp"
- android:layout_marginEnd="10dp"/>
- <TextView android:id="@+id/autofill_sublabel"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="14sp"
- android:textColor="#8b8b8b"
- android:ellipsize="end"
- android:singleLine="true"
- android:includeFontPadding="false"
- android:layout_marginStart="10dp"
- android:layout_marginEnd="10dp"/>
-</LinearLayout>
diff --git a/ui/android/java/res/values-v17/styles.xml b/ui/android/java/res/values-v17/styles.xml
deleted file mode 100644
index 8295ddf..0000000
--- a/ui/android/java/res/values-v17/styles.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright 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.
--->
-
-<resources>
- <style name="AutofillPopupWindow" parent="@android:style/Widget.ListPopupWindow">
- <item name="android:popupBackground">@drawable/autofill_popup_background</item>
- </style>
-</resources> \ No newline at end of file
diff --git a/ui/android/java/resource_map/org/chromium/ui/R.java b/ui/android/java/resource_map/org/chromium/ui/R.java
index 0c61b4b..0577d39 100644
--- a/ui/android/java/resource_map/org/chromium/ui/R.java
+++ b/ui/android/java/resource_map/org/chromium/ui/R.java
@@ -27,8 +27,6 @@ public final class R {
public static int color_picker_dialog_title;
}
public static final class id {
- public static int autofill_label;
- public static int autofill_sublabel;
public static int selected_color_view;
public static int title;
public static int more_colors_button;
@@ -41,7 +39,6 @@ public final class R {
public static int seek_bar;
}
public static final class layout {
- public static int autofill_text;
public static int color_picker_dialog_title;
public static int color_picker_dialog_content;
public static int color_picker_advanced_component;
@@ -49,7 +46,4 @@ public final class R {
public static final class drawable {
public static int color_picker_advanced_select_handle;
}
- public static final class style {
- public static int AutofillPopupWindow;
- }
}
diff --git a/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java b/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java
deleted file mode 100644
index 62203dc..0000000
--- a/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 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.ui.autofill;
-
-import android.content.Context;
-import android.text.TextUtils;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.TextView;
-
-import org.chromium.ui.R;
-
-import java.util.ArrayList;
-
-/**
- * Autofill suggestion adapter for AutofillWindow.
- */
-public class AutofillListAdapter extends ArrayAdapter<AutofillSuggestion> {
- private Context mContext;
-
- AutofillListAdapter(Context context, ArrayList<AutofillSuggestion> objects) {
- super(context, R.layout.autofill_text, objects);
- mContext = context;
- }
-
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- View layout = convertView;
- if (convertView == null) {
- LayoutInflater inflater =
- (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- layout = inflater.inflate(R.layout.autofill_text, null);
- }
- TextView labelView = (TextView) layout.findViewById(R.id.autofill_label);
- labelView.setText(getItem(position).mLabel);
-
- TextView sublabelView = (TextView) layout.findViewById(R.id.autofill_sublabel);
- CharSequence sublabel = getItem(position).mSublabel;
- if (TextUtils.isEmpty(sublabel)) {
- sublabelView.setVisibility(View.GONE);
- } else {
- sublabelView.setText(sublabel);
- sublabelView.setVisibility(View.VISIBLE);
- }
-
- return layout;
- }
-}
diff --git a/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java b/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java
deleted file mode 100644
index 7cec3c1..0000000
--- a/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java
+++ /dev/null
@@ -1,210 +0,0 @@
-// Copyright 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.ui.autofill;
-
-import android.content.Context;
-import android.graphics.Paint;
-import android.graphics.Rect;
-import android.text.TextUtils;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnLayoutChangeListener;
-import android.widget.AdapterView;
-import android.widget.ListPopupWindow;
-import android.widget.TextView;
-
-import java.util.ArrayList;
-
-import org.chromium.ui.R;
-import org.chromium.ui.ViewAndroidDelegate;
-
-/**
- * The Autofill suggestion popup that lists relevant suggestions.
- */
-public class AutofillPopup extends ListPopupWindow implements AdapterView.OnItemClickListener {
-
- /**
- * Constants defining types of Autofill suggestion entries.
- * Has to be kept in sync with enum in WebAutofillClient.h
- *
- * Not supported: MenuItemIDWarningMessage, MenuItemIDSeparator, MenuItemIDClearForm, and
- * MenuItemIDAutofillOptions.
- */
- private static final int ITEM_ID_AUTOCOMPLETE_ENTRY = 0;
- private static final int ITEM_ID_PASSWORD_ENTRY = -2;
- private static final int ITEM_ID_DATA_LIST_ENTRY = -6;
-
- private static final int TEXT_PADDING_DP = 30;
-
- private final AutofillPopupDelegate mAutofillCallback;
- private final Context mContext;
- private final ViewAndroidDelegate mViewAndroidDelegate;
- private View mAnchorView;
- private float mAnchorWidth;
- private float mAnchorHeight;
- private float mAnchorX;
- private float mAnchorY;
- private Paint mLabelViewPaint;
- private Paint mSublabelViewPaint;
- private OnLayoutChangeListener mLayoutChangeListener;
-
- /**
- * An interface to handle the touch interaction with an AutofillPopup object.
- */
- public interface AutofillPopupDelegate {
- /**
- * Requests the controller to hide AutofillPopup.
- */
- public void requestHide();
-
- /**
- * Handles the selection of an Autofill suggestion from an AutofillPopup.
- * @param listIndex The index of the selected Autofill suggestion.
- */
- public void suggestionSelected(int listIndex);
- }
-
- /**
- * Creates an AutofillWindow with specified parameters.
- * @param context Application context.
- * @param viewAndroidDelegate View delegate used to add and remove views.
- * @param autofillCallback A object that handles the calls to the native AutofillPopupView.
- */
- public AutofillPopup(Context context, ViewAndroidDelegate viewAndroidDelegate,
- AutofillPopupDelegate autofillCallback) {
- super(context, null, 0, R.style.AutofillPopupWindow);
- mContext = context;
- mViewAndroidDelegate = viewAndroidDelegate ;
- mAutofillCallback = autofillCallback;
-
- setOnItemClickListener(this);
-
- mAnchorView = mViewAndroidDelegate.acquireAnchorView();
- mViewAndroidDelegate.setAnchorViewPosition(mAnchorView, mAnchorX, mAnchorY, mAnchorWidth,
- mAnchorHeight);
-
- mLayoutChangeListener = new OnLayoutChangeListener() {
- @Override
- public void onLayoutChange(View v, int left, int top, int right, int bottom,
- int oldLeft, int oldTop, int oldRight, int oldBottom) {
- if (v == mAnchorView) AutofillPopup.this.show();
- }
- };
-
- mAnchorView.addOnLayoutChangeListener(mLayoutChangeListener);
- setAnchorView(mAnchorView);
- }
-
- @Override
- public void show() {
- // An ugly hack to keep the popup from expanding on top of the keyboard.
- setInputMethodMode(INPUT_METHOD_NEEDED);
- super.show();
- }
-
- /**
- * Sets the location and the size of the anchor view that the AutofillPopup will use to attach
- * itself.
- * @param x X coordinate of the top left corner of the anchor view.
- * @param y Y coordinate of the top left corner of the anchor view.
- * @param width The width of the anchor view.
- * @param height The height of the anchor view.
- */
- public void setAnchorRect(float x, float y, float width, float height) {
- mAnchorWidth = width;
- mAnchorHeight = height;
- mAnchorX = x;
- mAnchorY = y;
- if (mAnchorView != null) {
- mViewAndroidDelegate.setAnchorViewPosition(mAnchorView, mAnchorX, mAnchorY,
- mAnchorWidth, mAnchorHeight);
- }
- }
-
- /**
- * Sets the Autofill suggestions to display in the popup and shows the popup.
- * @param suggestions Autofill suggestion data.
- */
- public void show(AutofillSuggestion[] suggestions) {
- // Remove the AutofillSuggestions with IDs that are not supported by Android
- ArrayList<AutofillSuggestion> cleanedData = new ArrayList<AutofillSuggestion>();
- for (int i = 0; i < suggestions.length; i++) {
- int itemId = suggestions[i].mUniqueId;
- if (itemId > 0 || itemId == ITEM_ID_AUTOCOMPLETE_ENTRY ||
- itemId == ITEM_ID_PASSWORD_ENTRY || itemId == ITEM_ID_DATA_LIST_ENTRY) {
- cleanedData.add(suggestions[i]);
- }
- }
- setAdapter(new AutofillListAdapter(mContext, cleanedData));
- // Once the mAnchorRect is resized and placed correctly, it will show the Autofill popup.
- mAnchorWidth = Math.max(getDesiredWidth(cleanedData), mAnchorWidth);
- mViewAndroidDelegate.setAnchorViewPosition(mAnchorView, mAnchorX, mAnchorY, mAnchorWidth,
- mAnchorHeight);
- }
-
- /**
- * Overrides the default dismiss behavior to request the controller to dismiss the view.
- */
- @Override
- public void dismiss() {
- mAutofillCallback.requestHide();
- }
-
- /**
- * Hides the popup and removes the anchor view from the ContainerView.
- */
- public void hide() {
- super.dismiss();
- mAnchorView.removeOnLayoutChangeListener(mLayoutChangeListener);
- mViewAndroidDelegate.releaseAnchorView(mAnchorView);
- }
-
- /**
- * Get desired popup window width by calculating the maximum text length from Autofill data.
- * @param data Autofill suggestion data.
- * @return The popup window width in DIP.
- */
- private float getDesiredWidth(ArrayList<AutofillSuggestion> data) {
- if (mLabelViewPaint == null || mSublabelViewPaint == null) {
- LayoutInflater inflater =
- (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- View layout = inflater.inflate(R.layout.autofill_text, null);
- TextView labelView = (TextView) layout.findViewById(R.id.autofill_label);
- mLabelViewPaint = labelView.getPaint();
- TextView sublabelView = (TextView) layout.findViewById(R.id.autofill_sublabel);
- mSublabelViewPaint = sublabelView.getPaint();
- }
-
- float maxTextWidth = 0;
- Rect bounds = new Rect();
- for (int i = 0; i < data.size(); ++i) {
- bounds.setEmpty();
- String label = data.get(i).mLabel;
- if (!TextUtils.isEmpty(label)) {
- mLabelViewPaint.getTextBounds(label, 0, label.length(), bounds);
- }
- float labelWidth = bounds.width();
-
- bounds.setEmpty();
- String sublabel = data.get(i).mSublabel;
- if (!TextUtils.isEmpty(sublabel)) {
- mSublabelViewPaint.getTextBounds(sublabel, 0, sublabel.length(), bounds);
- }
-
- float localMax = Math.max(labelWidth, bounds.width());
- maxTextWidth = Math.max(maxTextWidth, localMax);
- }
- // Scale it down to make it unscaled by screen density.
- maxTextWidth = maxTextWidth / mContext.getResources().getDisplayMetrics().density;
- // Adding padding.
- return maxTextWidth + TEXT_PADDING_DP;
- }
-
- @Override
- public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
- mAutofillCallback.suggestionSelected(position);
- }
-
-}
diff --git a/ui/android/java/src/org/chromium/ui/autofill/AutofillSuggestion.java b/ui/android/java/src/org/chromium/ui/autofill/AutofillSuggestion.java
deleted file mode 100644
index 51669ea..0000000
--- a/ui/android/java/src/org/chromium/ui/autofill/AutofillSuggestion.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 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.ui.autofill;
-
-/**
- * Autofill suggestion container used to store information needed for each Autofill popup entry.
- */
-public class AutofillSuggestion {
- final String mLabel;
- final String mSublabel;
- final int mUniqueId;
-
- /**
- * Constructs a Autofill suggestion container.
- * @param name The name of the Autofill suggestion.
- * @param label The describing label of the Autofill suggestion.
- * @param uniqueId The unique id used to identify the Autofill suggestion.
- */
- public AutofillSuggestion(String name, String label, int uniqueId) {
- mLabel = name;
- mSublabel = label;
- mUniqueId = uniqueId;
- }
-} \ No newline at end of file