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

Commit b03c4af0 authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

Merge "Fix bug 5087980 - MenuItem#expandActionView should work from within onCreateOptionsMenu"

parents 77d73900 ccdd4ee4
Loading
Loading
Loading
Loading
+23 −9
Original line number Diff line number Diff line
@@ -118,6 +118,21 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
    private SearchableInfo mSearchable;
    private Bundle mAppSearchData;

    /*
     * SearchView can be set expanded before the IME is ready to be shown during
     * initial UI setup. The show operation is asynchronous to account for this.
     */
    private Runnable mShowImeRunnable = new Runnable() {
        public void run() {
            InputMethodManager imm = (InputMethodManager)
                    getContext().getSystemService(Context.INPUT_METHOD_SERVICE);

            if (imm != null) {
                imm.showSoftInputUnchecked(0, null);
            }
        }
    };

    // For voice searching
    private final Intent mVoiceWebSearchIntent;
    private final Intent mVoiceAppSearchIntent;
@@ -650,16 +665,15 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
        mSubmitArea.getBackground().setState(focused ? FOCUSED_STATE_SET : EMPTY_STATE_SET);
    }

    private void setImeVisibility(boolean visible) {
    private void setImeVisibility(final boolean visible) {
        if (visible) {
            post(mShowImeRunnable);
        } else {
            removeCallbacks(mShowImeRunnable);
            InputMethodManager imm = (InputMethodManager)
                    getContext().getSystemService(Context.INPUT_METHOD_SERVICE);

        // We made sure the IME was displayed, so also make sure it is closed
        // when we go away.
            if (imm != null) {
            if (visible) {
                imm.showSoftInputUnchecked(0, null);
            } else {
                imm.hideSoftInputFromWindow(getWindowToken(), 0);
            }
        }
+0 −1
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.Log;
import android.util.SparseArray;
import android.view.ActionProvider;
import android.view.ContextMenu.ContextMenuInfo;
+7 −7
Original line number Diff line number Diff line
@@ -343,6 +343,13 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
                    }
                }

                if (mActionBar != null) {
                    if (mActionMenuPresenterCallback == null) {
                        mActionMenuPresenterCallback = new ActionMenuPresenterCallback();
                    }
                    mActionBar.setMenu(st.menu, mActionMenuPresenterCallback);
                }

                // Call callback, and return if it doesn't want to display menu.

                // Creating the panel menu will involve a lot of manipulation;
@@ -356,13 +363,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
                }
                
                st.refreshMenuContent = false;

                if (mActionBar != null) {
                    if (mActionMenuPresenterCallback == null) {
                        mActionMenuPresenterCallback = new ActionMenuPresenterCallback();
                    }
                    mActionBar.setMenu(st.menu, mActionMenuPresenterCallback);
                }
            }

            // Callback and return if the callback does not want to show the menu