Skip to content

Commit 22bef9a

Browse files
fix: Search bar not closing on pressing android's back button (#2460)
* Fix bug where keyboard does not hide when search is cancelled * Fix bug where search did not close on nav back press Co-authored-by: Amartya Mondal <[email protected]>
1 parent 9bb916a commit 22bef9a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

app/src/main/java/org/fossasia/susi/ai/skills/SkillsActivity.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,13 @@ class SkillsActivity : AppCompatActivity(), SkillFragmentCallback {
294294
}
295295
edtSearch?.requestFocus()
296296

297+
edtSearch?.setOnKeyListener { v, keyCode, event ->
298+
if (keyCode == KeyEvent.KEYCODE_BACK) {
299+
onBackPressed()
300+
}
301+
true
302+
}
303+
297304
// open the keyboard focused in the edtSearch
298305
val inputMethodManager = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
299306
inputMethodManager.showSoftInput(edtSearch, InputMethodManager.SHOW_IMPLICIT)

0 commit comments

Comments
 (0)