On BACK in search, hide just IME if IME is fullscreen
Since a fullscreen IME covers the entire search dialog, there was no discoverable way to get back to the search dialog. Now, on BACK presses when the IME is fullscreen (e.g. in landscape mode without hard keyboard), we dismiss only the IME. A second BACK press will dismiss the search dialog. Fixes http://b/issue?id=2159132 Change-Id: I8e5736d83d7c35936a718929017ea04c6214700b
This commit is contained in:
@@ -1812,7 +1812,18 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
// If the input method is covering the search dialog completely,
|
||||
// e.g. in landscape mode with no hard keyboard, dismiss just the input method
|
||||
InputMethodManager imm = (InputMethodManager)getContext()
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (imm != null && imm.isFullscreenMode() &&
|
||||
imm.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), 0)) {
|
||||
return;
|
||||
}
|
||||
// Otherwise, go back to any previous source (e.g. back to QSB when
|
||||
// pivoted into a source.
|
||||
if (!backToPreviousComponent()) {
|
||||
// If no previous source, close search dialog
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user