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

Commit ed9f4c4c authored by Satish Sampath's avatar Satish Sampath Committed by The Android Open Source Project
Browse files

am fef8d3e4: Make search UI open up quicker to the user.

Merge commit 'fef8d3e4'

* commit 'fef8d3e4':
  Make search UI open up quicker to the user.
parents ec0ab537 fef8d3e4
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -243,7 +243,14 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
        mStoredComponentName = null;
        mStoredAppSearchData = null;

        return doShow(initialQuery, selectInitialQuery, componentName, appSearchData, globalSearch);
        boolean success = doShow(initialQuery, selectInitialQuery, componentName, appSearchData,
                globalSearch);
        if (success) {
            // Display the drop down as soon as possible instead of waiting for the rest of the
            // pending UI stuff to get done, so that things appear faster to the user.
            mSearchAutoComplete.showDropDownAfterLayout();
        }
        return success;
    }
    
    /**
+24 −0
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
    private boolean mBlockCompletion;

    private AutoCompleteTextView.ListSelectorHider mHideSelector;
    private Runnable mShowDropDownRunnable;

    private AutoCompleteTextView.PassThroughClickListener mPassThroughClickListener;

@@ -1065,6 +1066,13 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
        return mDropDownAnchorView == null ? this : mDropDownAnchorView;
    }

    /**
     * Issues a runnable to show the dropdown as soon as possible.
     */
    public void showDropDownAfterLayout() {
        post(mShowDropDownRunnable);
    }

    /**
     * <p>Displays the drop down on screen.</p>
     */
@@ -1173,6 +1181,22 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe

            mHideSelector = new ListSelectorHider();

            /**
             * This Runnable exists for the sole purpose of checking if the view layout has got
             * completed and if so call showDropDown to display the drop down. This is used to show
             * the drop down as soon as possible after user opens up the search dialog, without
             * waiting for the normal UI pipeline to do it's job which is slower than this method.
             */
            mShowDropDownRunnable = new Runnable() {
                public void run() {
                    // View layout should be all done before displaying the drop down.
                    View view = getDropDownAnchorView();
                    if (view != null && view.getWindowToken() != null) {
                        showDropDown();
                    }
                }
            };

            mDropDownList = new DropDownListView(context);
            mDropDownList.setSelector(mDropDownListHighlight);
            mDropDownList.setAdapter(mAdapter);