summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Zacharia <george.zcharia@gmail.com>2020-07-10 18:36:46 +0530
committerGeorge Zacharia <george.zcharia@gmail.com>2020-07-17 15:49:14 +0530
commit90d5e872df69ce0aace28e9d0a6cd88bd4b72f57 (patch)
tree5d94767a585ccdab2b5b79368273c2f59df90144
parent7f1bb277d70320a8f7c9926d9d40cda7692292c3 (diff)
Jelly: Fix find in page functionalityHEADq10.0
The KeyEvent parameter maybe null, state it in function declaration. Else leads to a crash when the feature is used. Test: - Open app, load a webpage. - Use the "Find in page" from options menu. - Enter a keyword into the search box, press search option on keyboard, app crashes With this change, no crash is observed, and the searched terms are highlighted on the page. Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/2165 Change-Id: Iad453173fa1417deb01de0b85cad8876ed68ccb1
-rw-r--r--app/src/main/java/org/lineageos/jelly/ui/SearchBarController.kt7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/src/main/java/org/lineageos/jelly/ui/SearchBarController.kt b/app/src/main/java/org/lineageos/jelly/ui/SearchBarController.kt
index 177bc3b..0f3b31b 100644
--- a/app/src/main/java/org/lineageos/jelly/ui/SearchBarController.kt
+++ b/app/src/main/java/org/lineageos/jelly/ui/SearchBarController.kt
@@ -40,6 +40,9 @@ class SearchBarController(
private var mHasStartedSearch = false
private var mCurrentResultPosition = 0
private var mTotalResultCount = 0
+ private val query: String?
+ get() = mEditor.text?.toString()
+
fun onShow() {
mEditor.requestFocus()
UiUtils.showKeyboard(mEditor)
@@ -61,7 +64,7 @@ class SearchBarController(
updateNextAndPrevButtonEnabledState()
}
- override fun onEditorAction(view: TextView, actionId: Int, event: KeyEvent): Boolean {
+ override fun onEditorAction(view: TextView, actionId: Int, event: KeyEvent?): Boolean {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
UiUtils.hideKeyboard(view)
startSearch()
@@ -127,8 +130,6 @@ class SearchBarController(
}
}
- private val query = mEditor.text?.toString()
-
interface OnCancelListener {
fun onCancelSearch()
}