summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Android (Google) Code Review <android-gerrit@google.com> 2009-07-14 16:03:23 -0700
committer The Android Open Source Project <initial-contribution@android.com> 2009-07-14 16:03:23 -0700
commit24b03ace12dab2c786d5ba33b92be3f5b162982b (patch)
tree7bf0c5582085e4de77a3f9849c566d8c18ca98e4
parent7d48ed897c0acc7cd7ac70ec570df89d492ca071 (diff)
parent00d3e361148133cea354d358757628b0acc01b75 (diff)
am 00d3e361: Merge change 7153 into donut
Merge commit '00d3e361148133cea354d358757628b0acc01b75' * commit '00d3e361148133cea354d358757628b0acc01b75': Restore PopupWindow's original behavior and add an API to control the soft input
-rw-r--r--api/current.xml24
-rw-r--r--core/java/android/widget/AutoCompleteTextView.java2
-rw-r--r--core/java/android/widget/PopupWindow.java28
3 files changed, 52 insertions, 2 deletions
diff --git a/api/current.xml b/api/current.xml
index a31208ab7a8e..75746c99329a 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -175418,6 +175418,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"
@@ -175623,6 +175634,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"
diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java
index be3dd1992439..ae509c503b01 100644
--- a/core/java/android/widget/AutoCompleteTextView.java
+++ b/core/java/android/widget/AutoCompleteTextView.java
@@ -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(
diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java
index 0c2cd55d2ee3..90fbb77d255e 100644
--- a/core/java/android/widget/PopupWindow.java
+++ b/core/java/android/widget/PopupWindow.java
@@ -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;