Cancel search on back

pull/199/head
M66B 4 years ago
parent a275e930da
commit c599b323b7

@ -5933,6 +5933,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
etSearch.setActionEnabled(hasNext); etSearch.setActionEnabled(hasNext);
} }
private boolean isSearching() {
return (searchView != null);
}
private void clearSearch() { private void clearSearch() {
if (searchView != null) if (searchView != null)
searchView.clearComposingText(); searchView.clearComposingText();
@ -6013,6 +6017,11 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override @Override
public boolean onBackPressed() { public boolean onBackPressed() {
if (isSearching()) {
endSearch();
return true;
}
if (selectionTracker != null && selectionTracker.hasSelection()) { if (selectionTracker != null && selectionTracker.hasSelection()) {
selectionTracker.clearSelection(); selectionTracker.clearSelection();
return true; return true;

Loading…
Cancel
Save