Automated import from //branches/master/...@141004,141004
This commit is contained in:
committed by
The Android Open Source Project
parent
36197e77c3
commit
51bf077883
@@ -135270,7 +135270,7 @@
|
||||
>
|
||||
<parameter name="targetView" type="android.view.View">
|
||||
</parameter>
|
||||
<parameter name="dummyMode" type="boolean">
|
||||
<parameter name="fullEditor" type="boolean">
|
||||
</parameter>
|
||||
</constructor>
|
||||
<method name="beginBatchEdit"
|
||||
@@ -136700,6 +136700,8 @@
|
||||
>
|
||||
<parameter name="target" type="android.view.inputmethod.InputConnection">
|
||||
</parameter>
|
||||
<parameter name="mutable" type="boolean">
|
||||
</parameter>
|
||||
</constructor>
|
||||
<method name="beginBatchEdit"
|
||||
return="boolean"
|
||||
@@ -136945,6 +136947,19 @@
|
||||
<parameter name="end" type="int">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setTarget"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="target" type="android.view.inputmethod.InputConnection">
|
||||
</parameter>
|
||||
</method>
|
||||
</class>
|
||||
<interface name="InputMethod"
|
||||
abstract="true"
|
||||
|
||||
@@ -2723,10 +2723,8 @@ class ApplicationContext extends Context {
|
||||
mTimestamp = mFileStatus.mtime;
|
||||
}
|
||||
|
||||
// Writing was successful, delete the backup file
|
||||
if (!mBackupFile.delete()) {
|
||||
Log.e(TAG, "Couldn't delete new backup file " + mBackupFile);
|
||||
}
|
||||
// Writing was successful, delete the backup file if there is one.
|
||||
mBackupFile.delete();
|
||||
return true;
|
||||
} catch (XmlPullParserException e) {
|
||||
Log.w(TAG, "writeFileLocked: Got exception:", e);
|
||||
|
||||
@@ -51,7 +51,6 @@ public class BaseInputConnection implements InputConnection {
|
||||
static final Object COMPOSING = new ComposingText();
|
||||
|
||||
final InputMethodManager mIMM;
|
||||
final Handler mH;
|
||||
final View mTargetView;
|
||||
final boolean mDummyMode;
|
||||
|
||||
@@ -60,19 +59,17 @@ public class BaseInputConnection implements InputConnection {
|
||||
Editable mEditable;
|
||||
KeyCharacterMap mKeyCharacterMap;
|
||||
|
||||
BaseInputConnection(InputMethodManager mgr, boolean dummyMode) {
|
||||
BaseInputConnection(InputMethodManager mgr, boolean fullEditor) {
|
||||
mIMM = mgr;
|
||||
mTargetView = null;
|
||||
mH = null;
|
||||
mDummyMode = dummyMode;
|
||||
mDummyMode = !fullEditor;
|
||||
}
|
||||
|
||||
public BaseInputConnection(View targetView, boolean dummyMode) {
|
||||
public BaseInputConnection(View targetView, boolean fullEditor) {
|
||||
mIMM = (InputMethodManager)targetView.getContext().getSystemService(
|
||||
Context.INPUT_METHOD_SERVICE);
|
||||
mH = targetView.getHandler();
|
||||
mTargetView = targetView;
|
||||
mDummyMode = dummyMode;
|
||||
mDummyMode = !fullEditor;
|
||||
}
|
||||
|
||||
public static final void removeComposingSpans(Spannable text) {
|
||||
@@ -403,7 +400,7 @@ public class BaseInputConnection implements InputConnection {
|
||||
*/
|
||||
public boolean sendKeyEvent(KeyEvent event) {
|
||||
synchronized (mIMM.mH) {
|
||||
Handler h = mH;
|
||||
Handler h = mTargetView != null ? mTargetView.getHandler() : null;
|
||||
if (h == null) {
|
||||
if (mIMM.mServedView != null) {
|
||||
h = mIMM.mServedView.getHandler();
|
||||
|
||||
@@ -24,9 +24,21 @@ import android.view.KeyEvent;
|
||||
* and have fun!
|
||||
*/
|
||||
public class InputConnectionWrapper implements InputConnection {
|
||||
private final InputConnection mTarget;
|
||||
private InputConnection mTarget;
|
||||
final boolean mMutable;
|
||||
|
||||
public InputConnectionWrapper(InputConnection target) {
|
||||
public InputConnectionWrapper(InputConnection target, boolean mutable) {
|
||||
mMutable = mutable;
|
||||
mTarget = target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the target of the input connection.
|
||||
*/
|
||||
public void setTarget(InputConnection target) {
|
||||
if (mTarget != null && !mMutable) {
|
||||
throw new SecurityException("not mutable");
|
||||
}
|
||||
mTarget = target;
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ import java.util.concurrent.TimeUnit;
|
||||
* </ul>
|
||||
*/
|
||||
public final class InputMethodManager {
|
||||
static final boolean DEBUG = false;
|
||||
static final boolean DEBUG = true;
|
||||
static final String TAG = "InputMethodManager";
|
||||
|
||||
static final Object mInstanceSync = new Object();
|
||||
@@ -426,7 +426,7 @@ public final class InputMethodManager {
|
||||
}
|
||||
};
|
||||
|
||||
final InputConnection mDummyInputConnection = new BaseInputConnection(this, true);
|
||||
final InputConnection mDummyInputConnection = new BaseInputConnection(this, false);
|
||||
|
||||
InputMethodManager(IInputMethodManager service, Looper looper) {
|
||||
mService = service;
|
||||
|
||||
@@ -41,8 +41,10 @@ import android.view.ViewConfiguration;
|
||||
import android.view.ViewDebug;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.inputmethod.BaseInputConnection;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.view.inputmethod.InputConnectionWrapper;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
|
||||
@@ -429,6 +431,9 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
||||
|
||||
private float mDensityScale;
|
||||
|
||||
private InputConnection mDefInputConnection;
|
||||
private InputConnectionWrapper mPublicInputConnection;
|
||||
|
||||
/**
|
||||
* Interface definition for a callback to be invoked when the list or grid
|
||||
* has been scrolled.
|
||||
@@ -2932,7 +2937,46 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
||||
// InputConnection to proxy to. Unfortunately this means we pretty
|
||||
// much need to make it as soon as a list view gets focus.
|
||||
createTextFilter(false);
|
||||
return mTextFilter.onCreateInputConnection(outAttrs);
|
||||
if (mPublicInputConnection == null) {
|
||||
mDefInputConnection = new BaseInputConnection(this, false);
|
||||
mPublicInputConnection = new InputConnectionWrapper(
|
||||
mTextFilter.onCreateInputConnection(outAttrs), true) {
|
||||
@Override
|
||||
public boolean reportFullscreenMode(boolean enabled) {
|
||||
// Use our own input connection, since it is
|
||||
// the "real" one the IME is talking with.
|
||||
return mDefInputConnection.reportFullscreenMode(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performEditorAction(int editorAction) {
|
||||
// The editor is off in its own window; we need to be
|
||||
// the one that does this.
|
||||
if (editorAction == EditorInfo.IME_ACTION_DONE) {
|
||||
InputMethodManager imm = (InputMethodManager)
|
||||
getContext().getSystemService(
|
||||
Context.INPUT_METHOD_SERVICE);
|
||||
if (imm != null) {
|
||||
imm.hideSoftInputFromWindow(getWindowToken(), 0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendKeyEvent(KeyEvent event) {
|
||||
// Use our own input connection, since the filter
|
||||
// text view may not be shown in a window so has
|
||||
// no ViewRoot to dispatch events with.
|
||||
return mDefInputConnection.sendKeyEvent(event);
|
||||
}
|
||||
};
|
||||
}
|
||||
outAttrs.inputType = EditorInfo.TYPE_CLASS_TEXT
|
||||
| EditorInfo.TYPE_TEXT_VARIATION_FILTER;
|
||||
outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE;
|
||||
return mPublicInputConnection;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -3019,14 +3063,16 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
||||
}
|
||||
|
||||
/**
|
||||
* For our text watcher that associated with the text filter
|
||||
* For our text watcher that is associated with the text filter. Does
|
||||
* nothing.
|
||||
*/
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
/**
|
||||
* For our text watcher that associated with the text filter. Performs the actual
|
||||
* filtering as the text changes.
|
||||
* For our text watcher that is associated with the text filter. Performs
|
||||
* the actual filtering as the text changes, and takes care of hiding and
|
||||
* showing the popup displaying the currently entered filter text.
|
||||
*/
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
if (mPopup != null && isTextFilterEnabled()) {
|
||||
@@ -3038,7 +3084,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
||||
mFiltered = true;
|
||||
} else if (showing && length == 0) {
|
||||
// Remove the filter popup if the user has cleared all text
|
||||
mPopup.dismiss();
|
||||
dismissPopup();
|
||||
mFiltered = false;
|
||||
}
|
||||
if (mAdapter instanceof Filterable) {
|
||||
@@ -3055,7 +3101,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
||||
}
|
||||
|
||||
/**
|
||||
* For our text watcher that associated with the text filter
|
||||
* For our text watcher that is associated with the text filter. Does
|
||||
* nothing.
|
||||
*/
|
||||
public void afterTextChanged(Editable s) {
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class EditableInputConnection extends BaseInputConnection {
|
||||
private final TextView mTextView;
|
||||
|
||||
public EditableInputConnection(TextView textview) {
|
||||
super(textview, false);
|
||||
super(textview, true);
|
||||
mTextView = textview;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user