summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ben Murdoch <benm@google.com> 2010-10-29 11:44:17 +0100
committer Ben Murdoch <benm@google.com> 2010-11-05 12:33:29 +0000
commitdb8d19c9cb6b3f0d595831a8fd648c468e70dfa6 (patch)
tree9c5cec3cfdc6b52a3f72f83725acb87824e7d4b9
parent202a2c974ee40db53adc5564d30d76a65040798d (diff)
Display the AutoFill preview string in the drop down box.
Native code now provides us with a preview string as well as an autofill query id. Display the preview string in the drop down box. Requires a change in external/webkit: https://android-git.corp.google.com/g/#change,77132 Change-Id: Ia5e26b98546cda1090142f1720f6a7836be6595c
-rw-r--r--core/java/android/webkit/WebView.java13
-rw-r--r--core/java/android/webkit/WebViewCore.java30
2 files changed, 35 insertions, 8 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index f5affe588180..9cb7aff24708 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -741,7 +741,7 @@ public class WebView extends AbsoluteLayout
// for event log
private long mLastTouchUpTime = 0;
- private int mAutoFillQueryId = WebTextView.FORM_NOT_AUTOFILLABLE;
+ private WebViewCore.AutoFillData mAutoFillData;
/**
* URI scheme for telephone number
@@ -3911,7 +3911,7 @@ public class WebView extends AbsoluteLayout
// At this point, we know we have found an input field, so go ahead
// and create the WebTextView if necessary.
if (mWebTextView == null) {
- mWebTextView = new WebTextView(mContext, WebView.this, mAutoFillQueryId);
+ mWebTextView = new WebTextView(mContext, WebView.this, mAutoFillData.getQueryId());
// Initialize our generation number.
mTextGeneration = 0;
}
@@ -4042,7 +4042,10 @@ public class WebView extends AbsoluteLayout
// on the AutoFill item being at the top of the drop down list. If you change
// the order, make sure to do it there too!
pastEntries.add(getResources().getText(
- com.android.internal.R.string.autofill_this_form).toString());
+ com.android.internal.R.string.autofill_this_form).toString() +
+ " " +
+ mAutoFillData.getPreviewString());
+ }
}
pastEntries.addAll(mDatabase.getFormData(mUrl, mName));
@@ -6843,9 +6846,9 @@ public class WebView extends AbsoluteLayout
break;
case SET_AUTOFILLABLE:
- mAutoFillQueryId = msg.arg1;
+ mAutoFillData = (WebViewCore.AutoFillData) msg.obj;
if (mWebTextView != null) {
- mWebTextView.setAutoFillable(mAutoFillQueryId);
+ mWebTextView.setAutoFillable(mAutoFillData.getQueryId());
rebuildWebTextView();
}
break;
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 9edb267c95f2..1b7eb2a1d5eb 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -732,6 +732,29 @@ final class WebViewCore {
int mSlop;
}
+ static class AutoFillData {
+ public AutoFillData() {
+ mQueryId = WebTextView.FORM_NOT_AUTOFILLABLE;
+ mPreview = "";
+ }
+
+ public AutoFillData(int queryId, String preview) {
+ mQueryId = queryId;
+ mPreview = preview;
+ }
+
+ public int getQueryId() {
+ return mQueryId;
+ }
+
+ public String getPreviewString() {
+ return mPreview;
+ }
+
+ private int mQueryId;
+ private String mPreview;
+ }
+
// mAction of TouchEventData can be MotionEvent.getAction() which uses the
// last two bytes or one of the following values
static final int ACTION_LONGPRESS = 0x100;
@@ -2431,10 +2454,11 @@ final class WebViewCore {
}
}
- private void setWebTextViewAutoFillable(int queryId) {
+ private void setWebTextViewAutoFillable(int queryId, String preview) {
if (mWebView != null) {
- Message.obtain(mWebView.mPrivateHandler, WebView.SET_AUTOFILLABLE, queryId,
- /* unused */0).sendToTarget();
+ Message.obtain(mWebView.mPrivateHandler, WebView.SET_AUTOFILLABLE,
+ new AutoFillData(queryId, preview))
+ .sendToTarget();
}
}