Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 374aaaed authored by Romain Guy's avatar Romain Guy
Browse files

Restore PopupWindow's original behavior and add an API to control the soft input

mode.
parent 4caac2bb
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -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"
+2 −0
Original line number Diff line number Diff line
@@ -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(
+26 −2
Original line number Diff line number Diff line
@@ -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;
@@ -447,6 +447,30 @@ public class PopupWindow {
        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;