Merge "Don't dismiss keyboard after clicking X button on the widgets search bar" into sc-dev am: 755723403b am: 02045feb20

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14748544

Change-Id: I3c7049fac82e9720cca73ffeb2f3779ca7925196
This commit is contained in:
Steven Ng authored and Automerger Merge Worker committed 2021-06-01 10:54:08 +00:00
commit fa8bbb43e6
2 files changed
+3 -10

No files matched your search

@@ -19,7 +19,6 @@ package com.android.launcher3.widget.picker.search;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions;
@@ -131,18 +130,14 @@ public class WidgetsSearchBarControllerTest {
public void cancelSearch_shouldInformSearchModeListenerToClearResultsAndExitSearch() { public void cancelSearch_shouldInformSearchModeListenerToClearResultsAndExitSearch() {
mCancelButton.performClick(); mCancelButton.performClick();
// 1 time explicitly from the cancel button on click listener. verify(mSearchModeListener).exitSearchMode();
// Another from the setText("") the cancel button on click listener causing afterTextChange.
verify(mSearchModeListener, times(2)).exitSearchMode();
} }
@Test @Test
public void cancelSearch_shouldCancelSearch() { public void cancelSearch_shouldCancelSearch() {
mCancelButton.performClick(); mCancelButton.performClick();
// 1 time explicitly from the cancel button on click listener. verify(mSearchAlgorithm).cancel(true);
// Another from the setText("") the cancel button on click listener causing afterTextChange.
verify(mSearchAlgorithm, times(2)).cancel(true);
verifyNoMoreInteractions(mSearchAlgorithm); verifyNoMoreInteractions(mSearchAlgorithm);
} }
@@ -101,10 +101,8 @@ public class WidgetsSearchBarController implements TextWatcher,
@Override @Override
public void clearSearchResult() { public void clearSearchResult() {
mSearchAlgorithm.cancel(/* interruptActiveRequests= */ true); // Any existing search session will be cancelled by setting text to empty.
mInput.setText(""); mInput.setText("");
clearFocus();
mSearchModeListener.exitSearchMode();
} }
/** /**