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

Commit 332aaaf9 authored by Karl Rosaen's avatar Karl Rosaen Committed by Android Git Automerger
Browse files

am a7a3b6ef: Dismiss both the soft keyboard and the search dialog on back if...

am a7a3b6ef: Dismiss both the soft keyboard and the search dialog on back if there is no text entered and no shortcuts are being obscured by the soft keyboard.

Merge commit 'a7a3b6ef'

* commit 'a7a3b6ef':
  Dismiss both the soft keyboard and the search dialog on back if there is no text entered and no shortcuts are being obscured by the soft keyboard.
parents 6a411bbb a7a3b6ef
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -1743,7 +1743,14 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
                }
                // If the drop-down obscures the keyboard, the user wouldn't see anything
                // happening when pressing back, so we dismiss the entire dialog instead.
                if (isInputMethodNotNeeded()) {
                //
                // also: if there is no text entered, we also want to dismiss the whole dialog,
                // not just the soft keyboard.  the exception to this is if there are shortcuts
                // that aren't displayed (e.g are being obscured by the soft keyboard); in that
                // case we want to dismiss the soft keyboard so the user can see the rest of the
                // shortcuts.
                if (isInputMethodNotNeeded() ||
                        (isEmpty() && getDropDownChildCount() >= getAdapter().getCount())) {
                    mSearchDialog.cancel();
                    return true;
                }
+10 −0
Original line number Diff line number Diff line
@@ -848,6 +848,16 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
        return ListView.INVALID_POSITION;
    }


    /**
     * @hide
     * @return {@link android.widget.ListView#getChildCount()} of the drop down if it is showing,
     *         otherwise 0.
     */
    protected int getDropDownChildCount() {
        return mDropDownList == null ? 0 : mDropDownList.getChildCount();
    }

    /**
     * <p>Starts filtering the content of the drop down list. The filtering
     * pattern is the content of the edit box. Subclasses should override this