mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Hide some special actions from editor
This commit is contained in:
parent
d2f1b1e358
commit
cee9548995
@ -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
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user