Skip to content
Snippets Groups Projects
Commit cee95489 authored by Aleksandras Kostarevas's avatar Aleksandras Kostarevas
Browse files

Hide some special actions from editor

parent d2f1b1e3
No related branches found
No related tags found
No related merge requests found
......@@ -110,4 +110,6 @@ data class Action(
val persistentState: ((KeyboardManagerForAction) -> PersistentActionState)? = null,
val persistentStateInitialization: PersistentStateInitialization = PersistentStateInitialization.OnActionTrigger,
val altPressImpl: ((KeyboardManagerForAction, PersistentActionState?) -> Unit)? = null,
val shownInEditor: Boolean = true
)
......@@ -122,7 +122,9 @@ fun ActionsEditor() {
val view = LocalView.current
val initialList: List<ActionEditorItem> = remember {
context.getSettingBlocking(ActionsSettings).toActionEditorItems().ensureWellFormed()
context.getSettingBlocking(ActionsSettings).toActionEditorItems().ensureWellFormed().filter {
it !is ActionEditorItem.Item || it.action.shownInEditor
}
}
val list = remember { initialList.toMutableStateList() }
......@@ -212,6 +214,7 @@ val MoreActionsAction = Action(
icon = R.drawable.more_horizontal,
name = R.string.more_actions_action_title,
simplePressImpl = null,
shownInEditor = false,
windowImpl = { manager, _ ->
object : ActionWindow {
@Composable
......
......@@ -171,7 +171,8 @@ fun Map<ActionCategory, List<Action>>.ensureAllActionsPresent(): Map<ActionCateg
val actionsMissing = actionsRequired.subtract(actionsPresent)
if(actionsMissing.isNotEmpty()) {
map[ActionCategory.More] = map[ActionCategory.More]!! + actionsMissing
map[ActionCategory.More] = map[ActionCategory.More]!! + actionsMissing.filter { it.shownInEditor }
map[ActionCategory.Disabled] = map[ActionCategory.Disabled]!! + actionsMissing.filter { !it.shownInEditor }
}
return map
......@@ -220,7 +221,7 @@ val DefaultActionSettings = mapOf(
ActionCategory.PinnedKey to listOf(VoiceInputAction),
ActionCategory.Favorites to listOf(SwitchLanguageAction, UndoAction, RedoAction, TextEditAction, ClipboardHistoryAction, ThemeAction),
ActionCategory.More to listOf(), // Remaining actions get populated automatically by ensureWellFormed
ActionCategory.Disabled to listOf(MemoryDebugAction)
ActionCategory.Disabled to listOf(MemoryDebugAction, SystemVoiceInputAction)
)
val ActionsSettings = SettingsKey(
......
......@@ -64,7 +64,8 @@ val SystemVoiceInputAction = Action(
it.triggerSystemVoiceInput()
},
persistentState = null,
windowImpl = null
windowImpl = null,
shownInEditor = false
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment