mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
Fix #277: Disable action menu if all of its children are disabled
This commit is contained in:
+8
-2
@@ -102,14 +102,20 @@ class DefaultActionsRegistry : ActionsRegistry() {
|
||||
val item: MenuItem =
|
||||
if (action is ActionMenu) {
|
||||
val sub = menu.addSubMenu(action.label)
|
||||
|
||||
|
||||
var shouldBeEnabled = false
|
||||
for (subItem in action.children) {
|
||||
subItem.prepare(data)
|
||||
if (subItem.visible) {
|
||||
addActionToMenu(sub, subItem, data)
|
||||
}
|
||||
|
||||
if (action.enabled && subItem.enabled && !shouldBeEnabled) {
|
||||
shouldBeEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
action.enabled = shouldBeEnabled
|
||||
sub.item
|
||||
} else {
|
||||
menu.add(action.label)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user