mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Add settings action to more easily access settings
This commit is contained in:
parent
6490e2941b
commit
94dfebca21
20
java/res/drawable/settings.xml
Normal file
20
java/res/drawable/settings.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12,12m-3,0a3,3 0,1 1,6 0a3,3 0,1 1,-6 0"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#ffffff"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M19.4,15a1.65,1.65 0,0 0,0.33 1.82l0.06,0.06a2,2 0,0 1,0 2.83,2 2,0 0,1 -2.83,0l-0.06,-0.06a1.65,1.65 0,0 0,-1.82 -0.33,1.65 1.65,0 0,0 -1,1.51V21a2,2 0,0 1,-2 2,2 2,0 0,1 -2,-2v-0.09A1.65,1.65 0,0 0,9 19.4a1.65,1.65 0,0 0,-1.82 0.33l-0.06,0.06a2,2 0,0 1,-2.83 0,2 2,0 0,1 0,-2.83l0.06,-0.06a1.65,1.65 0,0 0,0.33 -1.82,1.65 1.65,0 0,0 -1.51,-1H3a2,2 0,0 1,-2 -2,2 2,0 0,1 2,-2h0.09A1.65,1.65 0,0 0,4.6 9a1.65,1.65 0,0 0,-0.33 -1.82l-0.06,-0.06a2,2 0,0 1,0 -2.83,2 2,0 0,1 2.83,0l0.06,0.06a1.65,1.65 0,0 0,1.82 0.33H9a1.65,1.65 0,0 0,1 -1.51V3a2,2 0,0 1,2 -2,2 2,0 0,1 2,2v0.09a1.65,1.65 0,0 0,1 1.51,1.65 1.65,0 0,0 1.82,-0.33l0.06,-0.06a2,2 0,0 1,2.83 0,2 2,0 0,1 0,2.83l-0.06,0.06a1.65,1.65 0,0 0,-0.33 1.82V9a1.65,1.65 0,0 0,1.51 1H21a2,2 0,0 1,2 2,2 2,0 0,1 -2,2h-0.09a1.65,1.65 0,0 0,-1.51 1z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#ffffff"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
@ -73,6 +73,7 @@ import org.futo.inputmethod.latin.suggestions.SuggestionStripView
|
||||
import org.futo.inputmethod.latin.uix.actions.ClipboardAction
|
||||
import org.futo.inputmethod.latin.uix.actions.EmojiAction
|
||||
import org.futo.inputmethod.latin.uix.actions.RedoAction
|
||||
import org.futo.inputmethod.latin.uix.actions.SettingsAction
|
||||
import org.futo.inputmethod.latin.uix.actions.SystemVoiceInputAction
|
||||
import org.futo.inputmethod.latin.uix.actions.TextEditAction
|
||||
import org.futo.inputmethod.latin.uix.actions.ThemeAction
|
||||
@ -370,6 +371,7 @@ fun ActionItemSmall(action: Action, onSelect: (Action) -> Unit) {
|
||||
fun RowScope.ActionItems(onSelect: (Action) -> Unit) {
|
||||
val systemVoiceInput = useDataStore(key = USE_SYSTEM_VOICE_INPUT.key, default = USE_SYSTEM_VOICE_INPUT.default)
|
||||
|
||||
ActionItem(SettingsAction, onSelect)
|
||||
ActionItem(EmojiAction, onSelect)
|
||||
ActionItem(if(systemVoiceInput.value) { SystemVoiceInputAction } else { VoiceInputAction }, onSelect)
|
||||
ActionItem(ThemeAction, onSelect)
|
||||
|
@ -0,0 +1,22 @@
|
||||
package org.futo.inputmethod.latin.uix.actions
|
||||
|
||||
import android.content.Intent
|
||||
import org.futo.inputmethod.latin.R
|
||||
import org.futo.inputmethod.latin.uix.Action
|
||||
import org.futo.inputmethod.latin.uix.settings.SettingsActivity
|
||||
|
||||
val SettingsAction = Action(
|
||||
icon = R.drawable.settings,
|
||||
name = R.string.go_to_settings,
|
||||
simplePressImpl = { manager, _ ->
|
||||
val intent = Intent()
|
||||
intent.setClass(manager.getContext(), SettingsActivity::class.java)
|
||||
intent.setFlags(
|
||||
Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
or Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
|
||||
or Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
)
|
||||
manager.getContext().startActivity(intent)
|
||||
},
|
||||
windowImpl = null,
|
||||
)
|
Loading…
Reference in New Issue
Block a user