From 31f9b042fe935e927ea6380a2f235f68fca3967f Mon Sep 17 00:00:00 2001 From: FaSheep <63046584+FaSheep@users.noreply.github.com> Date: Sun, 3 Sep 2023 23:18:09 +0800 Subject: [PATCH] fix: invalidate options menu after closing files (related #1176) (#1251) --- .../itsaky/androidide/actions/file/CloseAllFilesAction.kt | 1 + .../com/itsaky/androidide/actions/file/CloseFileAction.kt | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/itsaky/androidide/actions/file/CloseAllFilesAction.kt b/app/src/main/java/com/itsaky/androidide/actions/file/CloseAllFilesAction.kt index 9b647de2fc..e9453b17aa 100644 --- a/app/src/main/java/com/itsaky/androidide/actions/file/CloseAllFilesAction.kt +++ b/app/src/main/java/com/itsaky/androidide/actions/file/CloseAllFilesAction.kt @@ -39,6 +39,7 @@ class CloseAllFilesAction(context: Context) : FileTabAction() { override fun EditorHandlerActivity.doAction(data: ActionData): Boolean { closeAll() + this.invalidateOptionsMenu() return true } } diff --git a/app/src/main/java/com/itsaky/androidide/actions/file/CloseFileAction.kt b/app/src/main/java/com/itsaky/androidide/actions/file/CloseFileAction.kt index 1051c363ce..ae8a738b25 100644 --- a/app/src/main/java/com/itsaky/androidide/actions/file/CloseFileAction.kt +++ b/app/src/main/java/com/itsaky/androidide/actions/file/CloseFileAction.kt @@ -38,7 +38,10 @@ class CloseFileAction(context: Context) : FileTabAction() { } override fun EditorHandlerActivity.doAction(data: ActionData): Boolean { - binding.tabs.selectedTabPosition.let { closeFile(it) } + binding.tabs.selectedTabPosition.let { + closeFile(it) + this.invalidateOptionsMenu() + } return true } }