summaryrefslogtreecommitdiff
path: root/core/java/android/view
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-03 14:04:24 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-03 14:04:24 -0800
commit076357b8567458d4b6dfdcf839ef751634cd2bfb (patch)
treeefbb2fd6f1dc67d2d606382fc3b82983e7cb2e1f /core/java/android/view
parent3dec7d563a2f3e1eb967ce2054a00b6620e3558c (diff)
auto import from //depot/cupcake/@132589
Diffstat (limited to 'core/java/android/view')
-rw-r--r--core/java/android/view/GestureDetector.java91
-rw-r--r--core/java/android/view/KeyEvent.java6
-rw-r--r--core/java/android/view/View.java47
-rw-r--r--core/java/android/view/ViewConfiguration.java18
-rw-r--r--core/java/android/view/ViewRoot.java39
-rw-r--r--core/java/android/view/inputmethod/BaseInputConnection.java7
-rw-r--r--core/java/android/view/inputmethod/EditorInfo.java106
-rw-r--r--core/java/android/view/inputmethod/InputConnection.java14
-rw-r--r--core/java/android/view/inputmethod/InputMethodManager.java18
9 files changed, 72 insertions, 274 deletions
diff --git a/core/java/android/view/GestureDetector.java b/core/java/android/view/GestureDetector.java
index e0231a7b99f4..679c683cfeea 100644
--- a/core/java/android/view/GestureDetector.java
+++ b/core/java/android/view/GestureDetector.java
@@ -113,48 +113,20 @@ public class GestureDetector {
}
/**
- * The listener that is used to notify when a double-tap or a confirmed
- * single-tap occur.
+ * @hide pending API council
*/
public interface OnDoubleTapListener {
- /**
- * Notified when a single-tap occurs.
- * <p>
- * Unlike {@link OnGestureListener#onSingleTapUp(MotionEvent)}, this
- * will only be called after the detector is confident that the user's
- * first tap is not followed by a second tap leading to a double-tap
- * gesture.
- *
- * @param e The down motion event of the single-tap.
- * @return true if the event is consumed, else false
- */
boolean onSingleTapConfirmed(MotionEvent e);
-
- /**
- * Notified when a double-tap occurs.
- *
- * @param e The down motion event of the first tap of the double-tap.
- * @return true if the event is consumed, else false
- */
- boolean onDoubleTap(MotionEvent e);
-
- /**
- * Notified when an event within a double-tap gesture occurs, including
- * the down, move, and up events.
- *
- * @param e The motion event that occurred during the double-tap gesture.
- * @return true if the event is consumed, else false
- */
boolean onDoubleTapEvent(MotionEvent e);
}
-
+
/**
- * A convenience class to extend when you only want to listen for a subset
- * of all the gestures. This implements all methods in the
- * {@link OnGestureListener} and {@link OnDoubleTapListener} but does
- * nothing and return {@code false} for all applicable methods.
+ * A convenience class to extend when you only want to listen for a
+ * subset of all the gestures. This implements all methods in the
+ * {@link OnGestureListener} but does nothing and return {@code false}
+ * for all applicable methods.
*/
- public static class SimpleOnGestureListener implements OnGestureListener, OnDoubleTapListener {
+ public static class SimpleOnGestureListener implements OnGestureListener {
public boolean onSingleTapUp(MotionEvent e) {
return false;
}
@@ -178,25 +150,13 @@ public class GestureDetector {
public boolean onDown(MotionEvent e) {
return false;
}
-
- public boolean onDoubleTap(MotionEvent e) {
- return false;
- }
-
- public boolean onDoubleTapEvent(MotionEvent e) {
- return false;
- }
-
- public boolean onSingleTapConfirmed(MotionEvent e) {
- return false;
- }
}
// TODO: ViewConfiguration
private int mBiggerTouchSlopSquare = 20 * 20;
-
+
private int mTouchSlopSquare;
- private int mDoubleTapSlopSquare;
+ private int mDoubleTapSlopSquare;
private int mMinimumFlingVelocity;
private static final int LONGPRESS_TIMEOUT = ViewConfiguration.getLongPressTimeout();
@@ -204,7 +164,7 @@ public class GestureDetector {
// TODO make new double-tap timeout, and define its events (i.e. either time
// between down-down or time between up-down)
private static final int DOUBLE_TAP_TIMEOUT = ViewConfiguration.getDoubleTapTimeout();
-
+
// constants for Message.what used by GestureHandler below
private static final int SHOW_PRESS = 1;
private static final int LONG_PRESS = 2;
@@ -221,13 +181,13 @@ public class GestureDetector {
private MotionEvent mCurrentDownEvent;
private MotionEvent mPreviousUpEvent;
-
+
/**
* True when the user is still touching for the second tap (down, move, and
* up events). Can only be true if there is a double tap listener attached.
*/
private boolean mIsDoubleTapping;
-
+
private float mLastMotionY;
private float mLastMotionX;
@@ -266,7 +226,7 @@ public class GestureDetector {
break;
default:
- throw new RuntimeException("Unknown message " + msg); //never
+ throw new RuntimeException("Unknown message " + msg); //never
}
}
}
@@ -343,9 +303,6 @@ public class GestureDetector {
mHandler = new GestureHandler();
}
mListener = listener;
- if (listener instanceof OnDoubleTapListener) {
- setOnDoubleTapListener((OnDoubleTapListener) listener);
- }
init(context);
}
@@ -374,11 +331,8 @@ public class GestureDetector {
}
/**
- * Sets the listener which will be called for double-tap and related
- * gestures.
- *
- * @param onDoubleTapListener the listener invoked for all the callbacks, or
- * null to stop listening for double-tap gestures.
+ * @hide pending API council
+ * @param onDoubleTapListener
*/
public void setOnDoubleTapListener(OnDoubleTapListener onDoubleTapListener) {
mDoubleTapListener = onDoubleTapListener;
@@ -433,10 +387,7 @@ public class GestureDetector {
isConsideredDoubleTap(mCurrentDownEvent, mPreviousUpEvent, ev)) {
// This is a second tap
mIsDoubleTapping = true;
- // Give a callback with the first tap of the double-tap
- handled |= mDoubleTapListener.onDoubleTap(mCurrentDownEvent);
- // Give a callback with down event of the double-tap
- handled |= mDoubleTapListener.onDoubleTapEvent(ev);
+ handled = mDoubleTapListener.onDoubleTapEvent(ev);
} else {
// This is a first tap
mHandler.sendEmptyMessageDelayed(TAP, DOUBLE_TAP_TIMEOUT);
@@ -467,8 +418,7 @@ public class GestureDetector {
final float scrollX = mLastMotionX - x;
final float scrollY = mLastMotionY - y;
if (mIsDoubleTapping) {
- // Give the move events of the double-tap
- handled |= mDoubleTapListener.onDoubleTapEvent(ev);
+ handled = mDoubleTapListener.onDoubleTapEvent(ev);
} else if (mAlwaysInTapRegion) {
final int deltaX = (int) (x - mCurrentDownEvent.getX());
final int deltaY = (int) (y - mCurrentDownEvent.getY());
@@ -496,8 +446,7 @@ public class GestureDetector {
mStillDown = false;
MotionEvent currentUpEvent = MotionEvent.obtain(ev);
if (mIsDoubleTapping) {
- // Finally, give the up event of the double-tap
- handled |= mDoubleTapListener.onDoubleTapEvent(ev);
+ handled = mDoubleTapListener.onDoubleTapEvent(ev);
mIsDoubleTapping = false;
break;
} else if (mInLongPress) {
@@ -546,7 +495,7 @@ public class GestureDetector {
if (!mAlwaysInBiggerTapRegion) {
return false;
}
-
+
if (secondDown.getEventTime() - firstUp.getEventTime() > DOUBLE_TAP_TIMEOUT) {
return false;
}
@@ -555,7 +504,7 @@ public class GestureDetector {
int deltaY = (int) firstDown.getY() - (int) secondDown.getY();
return (deltaX * deltaX + deltaY * deltaY < mDoubleTapSlopSquare);
}
-
+
private void dispatchLongPress() {
mHandler.removeMessages(TAP);
mInLongPress = true;
diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java
index 430cc71de610..d6ea91c4b5e3 100644
--- a/core/java/android/view/KeyEvent.java
+++ b/core/java/android/view/KeyEvent.java
@@ -229,12 +229,6 @@ public class KeyEvent implements Parcelable {
public static final int FLAG_SOFT_KEYBOARD = 0x2;
/**
- * This mask is set if we don't want the key event to cause us to leave
- * touch mode.
- */
- public static final int FLAG_KEEP_TOUCH_MODE = 0x4;
-
- /**
* Returns the maximum keycode.
*/
public static int getMaxKeyCode() {
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 406fad8e312d..5ed3a7ea6471 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -57,7 +57,6 @@ import com.android.internal.view.menu.MenuBuilder;
import java.util.ArrayList;
import java.util.Arrays;
-import java.lang.ref.SoftReference;
/**
* <p>
@@ -1564,7 +1563,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback {
private int[] mDrawableState = null;
- private SoftReference<Bitmap> mDrawingCache;
+ private Bitmap mDrawingCache;
/**
* When this view has focus and the next focus is {@link #FOCUS_LEFT},
@@ -3951,16 +3950,25 @@ public class View implements Drawable.Callback, KeyEvent.Callback {
}
if ((changed & WILL_NOT_CACHE_DRAWING) != 0) {
- destroyDrawingCache();
+ if (mDrawingCache != null) {
+ mDrawingCache.recycle();
+ }
+ mDrawingCache = null;
}
if ((changed & DRAWING_CACHE_ENABLED) != 0) {
- destroyDrawingCache();
+ if (mDrawingCache != null) {
+ mDrawingCache.recycle();
+ }
+ mDrawingCache = null;
mPrivateFlags &= ~DRAWING_CACHE_VALID;
}
if ((changed & DRAWING_CACHE_QUALITY_MASK) != 0) {
- destroyDrawingCache();
+ if (mDrawingCache != null) {
+ mDrawingCache.recycle();
+ }
+ mDrawingCache = null;
mPrivateFlags &= ~DRAWING_CACHE_VALID;
}
@@ -5407,10 +5415,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback {
if ((mViewFlags & WILL_NOT_CACHE_DRAWING) == WILL_NOT_CACHE_DRAWING) {
return null;
}
- if ((mViewFlags & DRAWING_CACHE_ENABLED) == DRAWING_CACHE_ENABLED) {
+ if ((mViewFlags & DRAWING_CACHE_ENABLED) == DRAWING_CACHE_ENABLED &&
+ ((mPrivateFlags & DRAWING_CACHE_VALID) == 0 || mDrawingCache == null)) {
buildDrawingCache();
}
- return mDrawingCache == null ? null : mDrawingCache.get();
+ return mDrawingCache;
}
/**
@@ -5425,8 +5434,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback {
*/
public void destroyDrawingCache() {
if (mDrawingCache != null) {
- final Bitmap bitmap = mDrawingCache.get();
- if (bitmap != null) bitmap.recycle();
+ mDrawingCache.recycle();
mDrawingCache = null;
}
}
@@ -5466,9 +5474,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback {
* @see #destroyDrawingCache()
*/
public void buildDrawingCache() {
- if ((mPrivateFlags & DRAWING_CACHE_VALID) == 0 || mDrawingCache == null ||
- mDrawingCache.get() == null) {
-
+ if ((mPrivateFlags & DRAWING_CACHE_VALID) == 0 || mDrawingCache == null) {
if (ViewDebug.TRACE_HIERARCHY) {
ViewDebug.trace(this, ViewDebug.HierarchyTraceType.BUILD_CACHE);
}
@@ -5486,12 +5492,15 @@ public class View implements Drawable.Callback, KeyEvent.Callback {
if (width <= 0 || height <= 0 ||
(width * height * (opaque ? 2 : 4) >= // Projected bitmap size in bytes
ViewConfiguration.get(mContext).getScaledMaximumDrawingCacheSize())) {
- destroyDrawingCache();
+ if (mDrawingCache != null) {
+ mDrawingCache.recycle();
+ }
+ mDrawingCache = null;
return;
}
boolean clear = true;
- Bitmap bitmap = mDrawingCache == null ? null : mDrawingCache.get();
+ Bitmap bitmap = mDrawingCache;
if (bitmap == null || bitmap.getWidth() != width || bitmap.getHeight() != height) {
@@ -5516,11 +5525,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback {
}
// Try to cleanup memory
- if (bitmap != null) bitmap.recycle();
+ if (mDrawingCache != null) {
+ mDrawingCache.recycle();
+ }
try {
- bitmap = Bitmap.createBitmap(width, height, quality);
- mDrawingCache = new SoftReference<Bitmap>(bitmap);
+ mDrawingCache = bitmap = Bitmap.createBitmap(width, height, quality);
} catch (OutOfMemoryError e) {
// If there is not enough memory to create the bitmap cache, just
// ignore the issue as bitmap caches are not required to draw the
@@ -8050,8 +8060,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback {
shader = new LinearGradient(0, 0, 0, 1, color, 0, Shader.TileMode.CLAMP);
paint.setShader(shader);
- // Restore the default transfer mode (src_over)
- paint.setXfermode(null);
+ paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER));
}
}
}
diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java
index d3f48c6a9a56..2f7b0d1a0068 100644
--- a/core/java/android/view/ViewConfiguration.java
+++ b/core/java/android/view/ViewConfiguration.java
@@ -56,7 +56,7 @@ public class ViewConfiguration {
/**
* Defines the duration in milliseconds we will wait to see if a touch event
- * is a tap or a scroll. If the user does not move within this interval, it is
+ * is a top or a scroll. If the user does not move within this interval, it is
* considered to be a tap.
*/
private static final int TAP_TIMEOUT = 100;
@@ -213,7 +213,7 @@ public class ViewConfiguration {
}
/**
- * @return the length of the fading edges in pixels
+ * @return Defines the length of the fading edges in pixels
*
* @deprecated Use {@link #getScaledFadingEdgeLength()} instead.
*/
@@ -223,14 +223,14 @@ public class ViewConfiguration {
}
/**
- * @return the length of the fading edges in pixels
+ * @return Defines the length of the fading edges in pixels
*/
public int getScaledFadingEdgeLength() {
return mFadingEdgeLength;
}
/**
- * @return the duration in milliseconds of the pressed state in child
+ * @return Defines the duration in milliseconds of the pressed state in child
* components.
*/
public static int getPressedStateDuration() {
@@ -238,7 +238,7 @@ public class ViewConfiguration {
}
/**
- * @return the duration in milliseconds before a press turns into
+ * @return Defines the duration in milliseconds before a press turns into
* a long press
*/
public static int getLongPressTimeout() {
@@ -246,8 +246,8 @@ public class ViewConfiguration {
}
/**
- * @return the duration in milliseconds we will wait to see if a touch event
- * is a tap or a scroll. If the user does not move within this interval, it is
+ * @return Defines the duration in milliseconds we will wait to see if a touch event
+ * is a top or a scroll. If the user does not move within this interval, it is
* considered to be a tap.
*/
public static int getTapTimeout() {
@@ -255,7 +255,7 @@ public class ViewConfiguration {
}
/**
- * @return the duration in milliseconds we will wait to see if a touch event
+ * @return Defines the duration in milliseconds we will wait to see if a touch event
* is a jump tap. If the user does not move within this interval, it is
* considered to be a tap.
*/
@@ -264,7 +264,7 @@ public class ViewConfiguration {
}
/**
- * @return the duration in milliseconds between the first tap's up event and
+ * @return Defines the duration in milliseconds between the first tap's up event and
* the second tap's down event for an interaction to be considered a
* double-tap.
* @hide pending API council
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java
index de64d0e4ca00..3cfaf1b4c27c 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewRoot.java
@@ -143,7 +143,6 @@ public final class ViewRoot extends Handler implements ViewParent,
boolean mFullRedrawNeeded;
boolean mNewSurfaceNeeded;
boolean mHasHadWindowFocus;
- boolean mLastWasImTarget;
boolean mWindowAttributesChanged = false;
@@ -999,21 +998,6 @@ public final class ViewRoot extends Handler implements ViewParent,
mNewSurfaceNeeded = false;
mViewVisibility = viewVisibility;
- if (mAttachInfo.mHasWindowFocus) {
- final boolean imTarget = WindowManager.LayoutParams
- .mayUseInputMethod(mWindowAttributes.flags);
- if (imTarget != mLastWasImTarget) {
- mLastWasImTarget = imTarget;
- InputMethodManager imm = InputMethodManager.peekInstance();
- if (imm != null && imTarget) {
- imm.startGettingWindowFocus(mView);
- imm.onWindowFocus(mView, mView.findFocus(),
- mWindowAttributes.softInputMode,
- !mHasHadWindowFocus, mWindowAttributes.flags);
- }
- }
- }
-
boolean cancelDraw = attachInfo.mTreeObserver.dispatchOnPreDraw();
if (!cancelDraw && !newSurface) {
@@ -1192,7 +1176,7 @@ public final class ViewRoot extends Handler implements ViewParent,
// properly re-composite its drawing on a transparent
// background. This automatically respects the clip/dirty region
if (!canvas.isOpaque()) {
- canvas.drawColor(0x00000000, PorterDuff.Mode.CLEAR);
+ canvas.drawColor(0xff0000ff, PorterDuff.Mode.CLEAR);
} else if (yoff != 0) {
// If we are applying an offset, we need to clear the area
// where the offset doesn't appear to avoid having garbage
@@ -1624,13 +1608,10 @@ public final class ViewRoot extends Handler implements ViewParent,
}
}
- mLastWasImTarget = WindowManager.LayoutParams
- .mayUseInputMethod(mWindowAttributes.flags);
-
InputMethodManager imm = InputMethodManager.peekInstance();
if (mView != null) {
- if (hasWindowFocus && imm != null && mLastWasImTarget) {
- imm.startGettingWindowFocus(mView);
+ if (hasWindowFocus && imm != null) {
+ imm.startGettingWindowFocus();
}
mView.dispatchWindowFocusChanged(hasWindowFocus);
}
@@ -1638,7 +1619,7 @@ public final class ViewRoot extends Handler implements ViewParent,
// Note: must be done after the focus change callbacks,
// so all of the view state is set up correctly.
if (hasWindowFocus) {
- if (imm != null && mLastWasImTarget) {
+ if (imm != null) {
imm.onWindowFocus(mView, mView.findFocus(),
mWindowAttributes.softInputMode,
!mHasHadWindowFocus, mWindowAttributes.flags);
@@ -1995,9 +1976,6 @@ public final class ViewRoot extends Handler implements ViewParent,
if (event.getAction() != KeyEvent.ACTION_DOWN) {
return false;
}
- if ((event.getFlags()&KeyEvent.FLAG_KEEP_TOUCH_MODE) != 0) {
- return false;
- }
// only relevant if we are in touch mode
if (!mAttachInfo.mInTouchMode) {
@@ -2117,7 +2095,8 @@ public final class ViewRoot extends Handler implements ViewParent,
// If it is possible for this window to interact with the input
// method window, then we want to first dispatch our key events
// to the input method.
- if (mLastWasImTarget) {
+ if (WindowManager.LayoutParams.mayUseInputMethod(
+ mWindowAttributes.flags)) {
InputMethodManager imm = InputMethodManager.peekInstance();
if (imm != null && mView != null) {
int seq = enqueuePendingEvent(event, sendDone);
@@ -2147,10 +2126,6 @@ public final class ViewRoot extends Handler implements ViewParent,
sWindowSession.finishKey(mWindow);
} catch (RemoteException e) {
}
- } else {
- Log.w("ViewRoot", "handleFinishedEvent(seq=" + seq
- + " handled=" + handled + " ev=" + event
- + ") neither delivering nor finishing key");
}
}
}
@@ -2473,8 +2448,6 @@ public final class ViewRoot extends Handler implements ViewParent,
final ViewRoot viewRoot = mViewRoot.get();
if (viewRoot != null) {
viewRoot.dispatchKey(event);
- } else {
- Log.w("ViewRoot.W", "Key event " + event + " but no ViewRoot available!");
}
}
diff --git a/core/java/android/view/inputmethod/BaseInputConnection.java b/core/java/android/view/inputmethod/BaseInputConnection.java
index 52b410734808..6fbc174bab49 100644
--- a/core/java/android/view/inputmethod/BaseInputConnection.java
+++ b/core/java/android/view/inputmethod/BaseInputConnection.java
@@ -341,13 +341,6 @@ public class BaseInputConnection implements InputConnection {
/**
* The default implementation does nothing.
*/
- public boolean performEditorAction(int actionCode) {
- return false;
- }
-
- /**
- * The default implementation does nothing.
- */
public boolean performContextMenuAction(int id) {
return false;
}
diff --git a/core/java/android/view/inputmethod/EditorInfo.java b/core/java/android/view/inputmethod/EditorInfo.java
index 0405371d6db7..b2f26d7304dc 100644
--- a/core/java/android/view/inputmethod/EditorInfo.java
+++ b/core/java/android/view/inputmethod/EditorInfo.java
@@ -25,100 +25,17 @@ public class EditorInfo implements InputType, Parcelable {
public int inputType = TYPE_NULL;
/**
- * Set of bits in {@link #imeOptions} that provide alternative actions
- * associated with the "enter" key. This both helps the IME provide
- * better feedback about what the enter key will do, and also allows it
- * to provide alternative mechanisms for providing that command.
- */
- public static final int IME_MASK_ACTION = 0x000000ff;
-
- /**
- * Bits of {@link #IME_MASK_ACTION}: there is no special action
- * associated with this editor.
- */
- public static final int IME_ACTION_NONE = 0x00000000;
-
- /**
- * Bits of {@link #IME_MASK_ACTION}: the action key performs a "go"
- * operation to take the user to the target of the text they typed.
- * Typically used, for example, when entering a URL.
- */
- public static final int IME_ACTION_GO = 0x00000001;
-
- /**
- * Bits of {@link #IME_MASK_ACTION}: the action key performs a "search"
- * operation, taking the user to the results of searching for the text
- * the have typed (in whatever context is appropriate).
- */
- public static final int IME_ACTION_SEARCH = 0x00000002;
-
- /**
- * Bits of {@link #IME_MASK_ACTION}: the action key performs a "send"
- * operation, delivering the text to its target. This is typically used
- * when composing a message.
- */
- public static final int IME_ACTION_SEND = 0x00000003;
-
- /**
- * Bits of {@link #IME_MASK_ACTION}: the action key performs a "next"
- * operation, taking the user to the next field that will accept text.
- */
- public static final int IME_ACTION_NEXT = 0x00000004;
-
- /**
- * Flag of {@link #imeOptions}: used in conjunction with
- * {@link #IME_MASK_ACTION}, this indicates that the action should not
- * be available in-line as the same as a "enter" key. Typically this is
- * because the action has such a significant impact or is not recoverable
- * enough that accidentally hitting it should be avoided, such as sending
- * a message.
- */
- public static final int IME_FLAG_NO_ENTER_ACTION = 0x40000000;
-
- /**
- * Generic non-special type for {@link #imeOptions}.
- */
- public static final int IME_NORMAL = 0x00000000;
-
- /**
- * Special code for when the ime option has been undefined. This is not
- * used with the EditorInfo structure, but can be used elsewhere.
- */
- public static final int IME_UNDEFINED = 0x80000000;
-
- /**
- * Extended type information for the editor, to help the IME better
- * integrate with it.
- */
- public int imeOptions = IME_NORMAL;
-
- /**
- * A string supplying additional information options that are
- * private to a particular IME implementation. The string must be
+ * A string supplying additional information about the content type that
+ * is private to a particular IME implementation. The string must be
* scoped to a package owned by the implementation, to ensure there are
* no conflicts between implementations, but other than that you can put
* whatever you want in it to communicate with the IME. For example,
* you could have a string that supplies an argument like
* <code>"com.example.myapp.SpecialMode=3"</code>. This field is can be
- * filled in from the {@link android.R.attr#privateImeOptions}
+ * filled in from the {@link android.R.attr#editorPrivateContentType}
* attribute of a TextView.
*/
- public String privateImeOptions = null;
-
- /**
- * In some cases an IME may be able to display an arbitrary label for
- * a command the user can perform, which you can specify here. You can
- * not count on this being used.
- */
- public CharSequence actionLabel = null;
-
- /**
- * If {@link #actionLabel} has been given, this is the id for that command
- * when the user presses its button that is delivered back with
- * {@link InputConnection#performEditorAction(int)
- * InputConnection.performEditorAction()}.
- */
- public int actionId = 0;
+ public String privateContentType = null;
/**
* The text offset of the start of the selection at the time editing
@@ -189,10 +106,7 @@ public class EditorInfo implements InputType, Parcelable {
*/
public void dump(Printer pw, String prefix) {
pw.println(prefix + "inputType=0x" + Integer.toHexString(inputType)
- + " imeOptions=0x" + Integer.toHexString(imeOptions)
- + " privateImeOptions=" + privateImeOptions);
- pw.println(prefix + "actionLabel=" + actionLabel
- + " actionId=" + actionId);
+ + " privateContentType=" + privateContentType);
pw.println(prefix + "initialSelStart=" + initialSelStart
+ " initialSelEnd=" + initialSelEnd
+ " initialCapsMode=0x"
@@ -213,10 +127,7 @@ public class EditorInfo implements InputType, Parcelable {
*/
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(inputType);
- dest.writeInt(imeOptions);
- dest.writeString(privateImeOptions);
- TextUtils.writeToParcel(actionLabel, dest, flags);
- dest.writeInt(actionId);
+ dest.writeString(privateContentType);
dest.writeInt(initialSelStart);
dest.writeInt(initialSelEnd);
dest.writeInt(initialCapsMode);
@@ -235,10 +146,7 @@ public class EditorInfo implements InputType, Parcelable {
public EditorInfo createFromParcel(Parcel source) {
EditorInfo res = new EditorInfo();
res.inputType = source.readInt();
- res.imeOptions = source.readInt();
- res.privateImeOptions = source.readString();
- res.actionLabel = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source);
- res.actionId = source.readInt();
+ res.privateContentType = source.readString();
res.initialSelStart = source.readInt();
res.initialSelEnd = source.readInt();
res.initialCapsMode = source.readInt();
diff --git a/core/java/android/view/inputmethod/InputConnection.java b/core/java/android/view/inputmethod/InputConnection.java
index 32cce35608d4..530127d1ecee 100644
--- a/core/java/android/view/inputmethod/InputConnection.java
+++ b/core/java/android/view/inputmethod/InputConnection.java
@@ -208,24 +208,10 @@ public interface InputConnection {
/**
* Set the selection of the text editor. To set the cursor position,
* start and end should have the same value.
- * @return Returns true on success, false if the input connection is no longer
- * valid.
*/
public boolean setSelection(int start, int end);
/**
- * Have the editor perform an action it has said it can do.
- *
- * @param editorAction This must be one of the action constants for
- * {@link EditorInfo#imeOptions EditorInfo.editorType}, such as
- * {@link EditorInfo#IME_ACTION_GO EditorInfo.EDITOR_ACTION_GO}.
- *
- * @return Returns true on success, false if the input connection is no longer
- * valid.
- */
- public boolean performEditorAction(int editorAction);
-
- /**
* Perform a context menu action on the field. The given id may be one of:
* {@link android.R.id#selectAll},
* {@link android.R.id#startSelectingText}, {@link android.R.id#stopSelectingText},
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index e9e470304228..91fa2115d272 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -222,11 +222,6 @@ public final class InputMethodManager {
// -----------------------------------------------------------
/**
- * This is the root view of the overall window that currently has input
- * method focus.
- */
- View mCurRootView;
- /**
* This is the view that should currently be served by an input method,
* regardless of the state of setting that up.
*/
@@ -845,13 +840,6 @@ public final class InputMethodManager {
void focusInLocked(View view) {
if (DEBUG) Log.v(TAG, "focusIn: " + view);
-
- if (mCurRootView != view.getRootView()) {
- // This is a request from a window that isn't in the window with
- // IME focus, so ignore it.
- return;
- }
-
// Okay we have a new view that is being served.
if (mServedView != view) {
mCurrentTextBoxAttribute = null;
@@ -925,7 +913,7 @@ public final class InputMethodManager {
}
/**
- * Called by ViewRoot when its window gets input focus.
+ * Called by ViewRoot the first time it gets window focus.
* @hide
*/
public void onWindowFocus(View rootView, View focusedView, int softInputMode,
@@ -958,10 +946,9 @@ public final class InputMethodManager {
}
/** @hide */
- public void startGettingWindowFocus(View rootView) {
+ public void startGettingWindowFocus() {
synchronized (mH) {
mWindowFocusedView = null;
- mCurRootView = rootView;
}
}
@@ -1178,7 +1165,6 @@ public final class InputMethodManager {
+ " mBindSequence=" + mBindSequence
+ " mCurId=" + mCurId);
p.println(" mCurMethod=" + mCurMethod);
- p.println(" mCurRootView=" + mCurRootView);
p.println(" mServedView=" + mServedView);
p.println(" mLastServedView=" + mLastServedView);
p.println(" mServedConnecting=" + mServedConnecting);