This repository was archived by the owner on Jul 25, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
app/src/main/java/com/zulip/android/activities Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -334,6 +334,10 @@ public void onClick(View v) {
334
334
}
335
335
//set search editText text empty
336
336
etSearchPeople .setText ("" );
337
+ //hide soft keyboard
338
+ hideSoftKeyBoard ();
339
+ //remove focus
340
+ etSearchPeople .clearFocus ();
337
341
}
338
342
});
339
343
etSearchStream = (EditText )findViewById (R .id .stream_drawer_search );
@@ -349,6 +353,10 @@ public void onClick(View v) {
349
353
ZLog .logException (e );
350
354
}
351
355
etSearchStream .setText ("" );
356
+ //hide soft keyboard
357
+ hideSoftKeyBoard ();
358
+ //remove focus
359
+ etSearchStream .clearFocus ();
352
360
}
353
361
});
354
362
app .setZulipActivity (this );
@@ -534,6 +542,15 @@ public Cursor runQuery(CharSequence charSequence) {
534
542
}
535
543
}
536
544
545
+ private void hideSoftKeyBoard () {
546
+ // Check if no view has focus:
547
+ View view = this .getCurrentFocus ();
548
+ if (view != null ) {
549
+ InputMethodManager imm = (InputMethodManager )getSystemService (Context .INPUT_METHOD_SERVICE );
550
+ imm .hideSoftInputFromWindow (view .getWindowToken (), 0 );
551
+ }
552
+ }
553
+
537
554
private void onTextChangeOfStreamSearchEditText () {
538
555
etSearchStream .addTextChangedListener (new TextWatcher () {
539
556
@ Override
You can’t perform that action at this time.
0 commit comments