From 7e4c3fbe2b36289b87df3c5d43838994357aa18f Mon Sep 17 00:00:00 2001 From: Roshan Varughese <40583749+Animeboynz@users.noreply.github.com> Date: Sun, 15 Sep 2024 02:43:03 +1200 Subject: [PATCH] Fix WheelPicker Manual Input (mihonapp/mihon#1209) * Fix WheelPicker Manual Input * Lambda * inline * Update WheelPicker.kt --------- Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> (cherry picked from commit 339dc33f5833b224c01577da3da081deecdbbca2) --- .../tachiyomi/presentation/core/components/WheelPicker.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/presentation-core/src/main/java/tachiyomi/presentation/core/components/WheelPicker.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/components/WheelPicker.kt index d7a47e7cf..49edce558 100644 --- a/presentation-core/src/main/java/tachiyomi/presentation/core/components/WheelPicker.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/components/WheelPicker.kt @@ -149,7 +149,7 @@ private fun WheelPicker( } val scope = rememberCoroutineScope() - fun onDone() { + val processManualInput: () -> Unit = { scope.launch { items .indexOfFirst { it.toString() == value.text } @@ -158,7 +158,6 @@ private fun WheelPicker( internalOnSelectionChanged(this) lazyListState.scrollToItem(this) } - showManualInput = false } } @@ -167,10 +166,10 @@ private fun WheelPicker( .align(Alignment.Center) .showSoftKeyboard(true) // KMK --> - .clearFocusOnSoftKeyboardHide { onDone() }, + .clearFocusOnSoftKeyboardHide(processManualInput), /* clearFocusOnSoftKeyboardHide doesn't work because onSoftKeyboardHide won't trigger a recomposition => use keyboardActions instead */ - onKeyboardAction = { onDone() }, + onKeyboardAction = { processManualInput() }, // KMK <-- state = value, lineLimits = TextFieldLineLimits.SingleLine,