@@ -92,6 +92,8 @@ public class SimpleSearchView extends FrameLayout {
92
92
private OnQueryTextListener onQueryChangeListener ;
93
93
private SearchViewListener searchViewListener ;
94
94
95
+ private boolean searchIsClosing = false ;
96
+
95
97
public SimpleSearchView (Context context ) {
96
98
this (context , null );
97
99
}
@@ -209,7 +211,9 @@ private void initSearchEditText() {
209
211
searchEditText .addTextChangedListener (new SimpleTextWatcher () {
210
212
@ Override
211
213
public void onTextChanged (CharSequence s , int start , int before , int count ) {
212
- SimpleSearchView .this .onTextChanged (s );
214
+ if (!searchIsClosing ) {
215
+ SimpleSearchView .this .onTextChanged (s );
216
+ }
213
217
}
214
218
});
215
219
@@ -320,7 +324,9 @@ private void onSubmitQuery() {
320
324
if (submittedQuery != null && TextUtils .getTrimmedLength (submittedQuery ) > 0 ) {
321
325
if (onQueryChangeListener == null || !onQueryChangeListener .onQueryTextSubmit (submittedQuery .toString ())) {
322
326
closeSearch ();
327
+ searchIsClosing = true ;
323
328
searchEditText .setText (null );
329
+ searchIsClosing = false ;
324
330
}
325
331
}
326
332
}
@@ -394,7 +400,9 @@ public void closeSearch(boolean animate) {
394
400
return ;
395
401
}
396
402
403
+ searchIsClosing = true ;
397
404
searchEditText .setText (null );
405
+ searchIsClosing = false ;
398
406
clearFocus ();
399
407
400
408
if (animate ) {
0 commit comments