Fix hardware keyboards not being able to search in tracking

This commit is contained in:
Jays2Kings 2022-05-03 17:53:46 -04:00
parent e94059a1f4
commit a279053ac5

View file

@ -8,6 +8,7 @@ import android.text.Spannable
import android.text.SpannableString
import android.text.style.StyleSpan
import android.view.Gravity
import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -103,8 +104,10 @@ class TrackingBottomSheet(private val controller: MangaDetailsController) :
activity.openInBrowser(item.trackSearch.tracking_url)
}
binding.trackSearch.setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_SEARCH) {
binding.trackSearch.setOnEditorActionListener { _, actionId, keyEvent ->
if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_SEARCH ||
keyEvent.keyCode == KeyEvent.KEYCODE_ENTER
) {
val text = binding.trackSearch.text?.toString() ?: ""
if (text.isNotBlank()) {
startTransition()