Merge change 7153 into donut

* changes:
  Restore PopupWindow's original behavior and add an API to control the soft input mode.
This commit is contained in:
Android (Google) Code Review
2009-07-14 15:39:02 -07:00
3 changed files with 52 additions and 2 deletions

View File

@@ -171184,6 +171184,17 @@
<parameter name="yOffset" type="int">
</parameter>
</method>
<method name="getSoftInputMode"
return="int"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getWidth"
return="int"
abstract="false"
@@ -171389,6 +171400,19 @@
<parameter name="touchable" type="boolean">
</parameter>
</method>
<method name="setSoftInputMode"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="mode" type="int">
</parameter>
</method>
<method name="setTouchInterceptor"
return="void"
abstract="false"

View File

@@ -31,6 +31,7 @@ import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.CompletionInfo;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.EditorInfo;
@@ -141,6 +142,7 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
mPopup = new PopupWindow(context, attrs,
com.android.internal.R.attr.autoCompleteTextViewStyle);
mPopup.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
TypedArray a =
context.obtainStyledAttributes(

View File

@@ -27,7 +27,6 @@ import android.view.WindowManager;
import android.view.Gravity;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowManagerImpl;
import android.view.ViewTreeObserver.OnScrollChangedListener;
import android.view.View.OnTouchListener;
import android.graphics.PixelFormat;
@@ -82,6 +81,7 @@ public class PopupWindow {
private View mPopupView;
private boolean mFocusable;
private int mInputMethodMode = INPUT_METHOD_FROM_FOCUSABLE;
private int mSoftInputMode;
private boolean mTouchable = true;
private boolean mOutsideTouchable = false;
private boolean mClippingEnabled = true;
@@ -446,6 +446,30 @@ public class PopupWindow {
public void setInputMethodMode(int mode) {
mInputMethodMode = mode;
}
/**
* Sets the operating mode for the soft input area.
*
* @param mode The desired mode, see
* {@link android.view.WindowManager.LayoutParams#softInputMode}
* for the full list
*
* @see android.view.WindowManager.LayoutParams#softInputMode
* @see #getSoftInputMode()
*/
public void setSoftInputMode(int mode) {
mSoftInputMode = mode;
}
/**
* Returns the current value in {@link #setSoftInputMode(int)}.
*
* @see #setSoftInputMode(int)
* @see android.view.WindowManager.LayoutParams#softInputMode
*/
public int getSoftInputMode() {
return mSoftInputMode;
}
/**
* <p>Indicates whether the popup window receives touch events.</p>
@@ -822,7 +846,7 @@ public class PopupWindow {
p.flags = computeFlags(p.flags);
p.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
p.token = token;
p.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
p.softInputMode = mSoftInputMode;
p.setTitle("PopupWindow:" + Integer.toHexString(hashCode()));
return p;