Assign a field name for textfields in the browser.

Fix for http://b/issue?id=1605291.  Store the url and name of the
textfield in EditorInfo.fieldName.
This commit is contained in:
Leon Scroggins
2009-06-26 17:45:29 -04:00
parent 0658e8fe45
commit 0ca70883d7
2 changed files with 16 additions and 3 deletions

View File

@@ -25,13 +25,14 @@ import android.text.Spannable;
import android.text.TextUtils;
import android.text.method.MovementMethod;
import android.util.Log;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputConnection;
import android.widget.AbsoluteLayout.LayoutParams;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
@@ -269,6 +270,18 @@ import java.util.ArrayList;
return ptr == mNodePointer;
}
@Override public InputConnection onCreateInputConnection(
EditorInfo outAttrs) {
InputConnection connection = super.onCreateInputConnection(outAttrs);
if (mWebView != null) {
// Use the name of the textfield + the url. Use backslash as an
// arbitrary separator.
outAttrs.fieldName = mWebView.nativeFocusCandidateName() + "\\"
+ mWebView.getUrl();
}
return connection;
}
@Override
protected void onSelectionChanged(int selStart, int selEnd) {
if (mWebView != null) {

View File

@@ -5368,7 +5368,7 @@ public class WebView extends AbsoluteLayout
private native boolean nativeFocusCandidateIsTextField();
private native boolean nativeFocusCandidateIsTextInput();
private native int nativeFocusCandidateMaxLength();
private native String nativeFocusCandidateName();
/* package */ native String nativeFocusCandidateName();
private native Rect nativeFocusCandidateNodeBounds();
/* package */ native int nativeFocusCandidatePointer();
private native String nativeFocusCandidateText();