From ac5846a01531e11ed8e4fb1e8fddb34121400f98 Mon Sep 17 00:00:00 2001 From: Daniel Kao Date: Sat, 21 Oct 2023 14:30:45 +0800 Subject: [PATCH] fix: reset action mode menu state when action is triggered. --- .../plateaukao/einkbro/view/dialog/compose/ActionModeView.kt | 2 +- .../plateaukao/einkbro/viewmodel/ActionModeMenuViewModel.kt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/plateaukao/einkbro/view/dialog/compose/ActionModeView.kt b/app/src/main/java/info/plateaukao/einkbro/view/dialog/compose/ActionModeView.kt index 69d906fc0..f18efe668 100644 --- a/app/src/main/java/info/plateaukao/einkbro/view/dialog/compose/ActionModeView.kt +++ b/app/src/main/java/info/plateaukao/einkbro/view/dialog/compose/ActionModeView.kt @@ -57,7 +57,7 @@ class ActionModeView @JvmOverloads constructor( }) } - actionModeMenuViewModel.finish() + actionModeMenuViewModel.updateActionMode(null) } } } diff --git a/app/src/main/java/info/plateaukao/einkbro/viewmodel/ActionModeMenuViewModel.kt b/app/src/main/java/info/plateaukao/einkbro/viewmodel/ActionModeMenuViewModel.kt index 802e9cf5c..a5d82b3b6 100644 --- a/app/src/main/java/info/plateaukao/einkbro/viewmodel/ActionModeMenuViewModel.kt +++ b/app/src/main/java/info/plateaukao/einkbro/viewmodel/ActionModeMenuViewModel.kt @@ -111,6 +111,8 @@ class ActionModeMenuViewModel : ViewModel(), KoinComponent { (actionModeView?.parent as? ViewGroup)?.removeView(actionModeView) actionModeView = null } + + _actionModeMenuState.value = ActionModeMenuState.Idle } fun updateSelectedText(text: String) {