mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 20:45:43 +00:00
Let the mode sheet follow the default again and undo rejected binder edits
This commit is contained in:
1 parent
dea32f3418
commit
5b17639831
36 files changed
+46
-3
No files matched your search
@@ -81,7 +81,7 @@ internal fun InputButtonsPane(bindingsId: String, scope: String, baseId: String?
|
||||
val draft = remember(selected) { InputActionDraft(current) }
|
||||
fun save(action: InputAction) {
|
||||
runCatching { InputLibraries.update(context) { l -> l.withPreset(l.preset(bindingsId).let { it.copy(controls = it.controls + (selected to action)) }) } }
|
||||
.onSuccess { onChanged() }.onFailure { failure = it.message ?: context.getString(R.string.input_save_failed) }
|
||||
.onSuccess { onChanged() }.onFailure { draft.action = current; failure = it.message ?: context.getString(R.string.input_save_failed) }
|
||||
}
|
||||
// Every change applies as it is made, as in the layout editor, so leaving never loses an edit.
|
||||
LaunchedEffect(draft.action) { if (draft.action != current && draft.action.validFor(selected)) save(draft.action) }
|
||||
|
||||
@@ -15,8 +15,11 @@ internal fun InputQuickSettings(host: MenuHost, desktop: Boolean, onChanged: (In
|
||||
val context = LocalContext.current
|
||||
val library by rememberInputLibrary()
|
||||
var failure by remember { mutableStateOf<String?>(null) }
|
||||
ChoiceRow(host, "input-profile", stringResource(R.string.input_profile), null, library.profiles.map { it.id to profileLabel(context, it) },
|
||||
library.activeId(desktop), chipModifier = track("input-profile")) { id ->
|
||||
val fallback = profileLabel(context, library.profile(library.defaultId(desktop)))
|
||||
val choices = listOf(InputProfiles.AUTO to stringResource(R.string.flow_default_profile, fallback)) +
|
||||
library.profiles.map { it.id to profileLabel(context, it) }
|
||||
ChoiceRow(host, "input-profile", stringResource(R.string.input_profile), null, choices,
|
||||
library.selection(desktop).profile, chipModifier = track("input-profile")) { id ->
|
||||
runCatching { InputLibraries.update(context) { it.selectProfile(desktop, id) } }.onSuccess { onChanged(null) }
|
||||
.onFailure { failure = it.message ?: context.getString(R.string.input_save_failed) }
|
||||
}
|
||||
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">الماوس واللمس</string>
|
||||
<string name="flow_editor_hint">اسحب للتحريك، واسحب زاوية لتغيير الحجم. انقر على عنصر لتحديد وظيفته.</string>
|
||||
<string name="flow_snap_controls">إلى عناصر التحكم الأخرى</string>
|
||||
<string name="flow_default_profile">الافتراضي (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Mouse y toque</string>
|
||||
<string name="flow_editor_hint">Arrastra para mover y arrastra una esquina para cambiar el tamaño. Toca un control para elegir qué hace.</string>
|
||||
<string name="flow_snap_controls">A otros controles</string>
|
||||
<string name="flow_default_profile">Predeterminado (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Мишка и докосване</string>
|
||||
<string name="flow_editor_hint">Плъзнете, за да преместите, или плъзнете ъгъл, за да промените размера. Докоснете контрола, за да зададете действието ѝ.</string>
|
||||
<string name="flow_snap_controls">Към другите контроли</string>
|
||||
<string name="flow_default_profile">По подразбиране (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Myš a dotyk</string>
|
||||
<string name="flow_editor_hint">Přetažením přesunete, tažením za roh změníte velikost. Klepnutím na ovládací prvek nastavíte, co dělá.</string>
|
||||
<string name="flow_snap_controls">K ostatním prvkům</string>
|
||||
<string name="flow_default_profile">Výchozí (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Mus og berøring</string>
|
||||
<string name="flow_editor_hint">Træk for at flytte, træk i et hjørne for at ændre størrelse. Tryk på en kontrol for at vælge, hvad den gør.</string>
|
||||
<string name="flow_snap_controls">Til andre kontroller</string>
|
||||
<string name="flow_default_profile">Standard (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Maus und Touch</string>
|
||||
<string name="flow_editor_hint">Ziehen zum Verschieben, an einer Ecke ziehen zum Skalieren. Tippe auf ein Element, um seine Aktion festzulegen.</string>
|
||||
<string name="flow_snap_controls">An anderen Elementen</string>
|
||||
<string name="flow_default_profile">Standard (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Ποντίκι και αφή</string>
|
||||
<string name="flow_editor_hint">Σύρετε για μετακίνηση, σύρετε μια γωνία για αλλαγή μεγέθους. Πατήστε ένα στοιχείο για να ορίσετε τι κάνει.</string>
|
||||
<string name="flow_snap_controls">Σε άλλα στοιχεία</string>
|
||||
<string name="flow_default_profile">Προεπιλογή (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Ratón y toque</string>
|
||||
<string name="flow_editor_hint">Arrastra para mover y arrastra una esquina para cambiar el tamaño. Toca un control para elegir qué hace.</string>
|
||||
<string name="flow_snap_controls">A otros controles</string>
|
||||
<string name="flow_default_profile">Predeterminado (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Hiiri ja kosketus</string>
|
||||
<string name="flow_editor_hint">Siirrä vetämällä, muuta kokoa vetämällä kulmasta. Valitse ohjaimen toiminto napauttamalla sitä.</string>
|
||||
<string name="flow_snap_controls">Muihin ohjaimiin</string>
|
||||
<string name="flow_default_profile">Oletus (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Souris et tactile</string>
|
||||
<string name="flow_editor_hint">Faites glisser pour déplacer, tirez un coin pour redimensionner. Touchez une commande pour choisir son action.</string>
|
||||
<string name="flow_snap_controls">Aux autres commandes</string>
|
||||
<string name="flow_default_profile">Par défaut (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">माउस और टच</string>
|
||||
<string name="flow_editor_hint">खिसकाने के लिए खींचें, आकार बदलने के लिए कोना खींचें। कंट्रोल का काम चुनने के लिए उस पर टैप करें।</string>
|
||||
<string name="flow_snap_controls">दूसरे कंट्रोल पर</string>
|
||||
<string name="flow_default_profile">डिफ़ॉल्ट (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Egér és érintés</string>
|
||||
<string name="flow_editor_hint">Húzd az áthelyezéshez, egy sarkot a méretezéshez. Koppints egy vezérlőre, hogy beállítsd, mit csinál.</string>
|
||||
<string name="flow_snap_controls">Más vezérlőkhöz</string>
|
||||
<string name="flow_default_profile">Alapértelmezett (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Mouse dan sentuh</string>
|
||||
<string name="flow_editor_hint">Seret untuk memindahkan, seret sudut untuk mengubah ukuran. Ketuk kontrol untuk mengatur fungsinya.</string>
|
||||
<string name="flow_snap_controls">Ke kontrol lain</string>
|
||||
<string name="flow_default_profile">Default (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Mouse e tocco</string>
|
||||
<string name="flow_editor_hint">Trascina per spostare, trascina un angolo per ridimensionare. Tocca un controllo per scegliere cosa fa.</string>
|
||||
<string name="flow_snap_controls">Agli altri controlli</string>
|
||||
<string name="flow_default_profile">Predefinito (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">マウスとタッチ</string>
|
||||
<string name="flow_editor_hint">ドラッグで移動、角をドラッグでサイズ変更。コントロールをタップして動作を設定します。</string>
|
||||
<string name="flow_snap_controls">ほかのコントロールに</string>
|
||||
<string name="flow_default_profile">デフォルト (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">마우스 및 터치</string>
|
||||
<string name="flow_editor_hint">드래그하여 이동하고 모서리를 드래그하여 크기를 조정하세요. 컨트롤을 탭하여 동작을 설정하세요.</string>
|
||||
<string name="flow_snap_controls">다른 컨트롤에 맞춤</string>
|
||||
<string name="flow_default_profile">기본값 (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Tetikus dan sentuhan</string>
|
||||
<string name="flow_editor_hint">Seret untuk alih, seret penjuru untuk ubah saiz. Ketik kawalan untuk menetapkan fungsinya.</string>
|
||||
<string name="flow_snap_controls">Ke kawalan lain</string>
|
||||
<string name="flow_default_profile">Lalai (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Mus og berøring</string>
|
||||
<string name="flow_editor_hint">Dra for å flytte, dra i et hjørne for å endre størrelse. Trykk på en kontroll for å velge hva den gjør.</string>
|
||||
<string name="flow_snap_controls">Til andre kontroller</string>
|
||||
<string name="flow_default_profile">Standard (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Muis en aanraken</string>
|
||||
<string name="flow_editor_hint">Sleep om te verplaatsen, sleep een hoek om het formaat te wijzigen. Tik op een bediening om in te stellen wat die doet.</string>
|
||||
<string name="flow_snap_controls">Aan andere bedieningen</string>
|
||||
<string name="flow_default_profile">Standaard (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Mysz i dotyk</string>
|
||||
<string name="flow_editor_hint">Przeciągnij, aby przesunąć, przeciągnij róg, aby zmienić rozmiar. Stuknij element, aby ustawić jego działanie.</string>
|
||||
<string name="flow_snap_controls">Do innych elementów</string>
|
||||
<string name="flow_default_profile">Domyślny (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Rato e toque</string>
|
||||
<string name="flow_editor_hint">Arraste para mover, arraste um canto para redimensionar. Toque num controlo para definir o que faz.</string>
|
||||
<string name="flow_snap_controls">Aos outros controlos</string>
|
||||
<string name="flow_default_profile">Predefinido (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Mouse e toque</string>
|
||||
<string name="flow_editor_hint">Arraste para mover, arraste um canto para redimensionar. Toque em um controle para definir o que ele faz.</string>
|
||||
<string name="flow_snap_controls">Aos outros controles</string>
|
||||
<string name="flow_default_profile">Padrão (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Mouse și atingere</string>
|
||||
<string name="flow_editor_hint">Trage pentru a muta, trage de un colț pentru a redimensiona. Atinge un control pentru a alege ce face.</string>
|
||||
<string name="flow_snap_controls">La alte controale</string>
|
||||
<string name="flow_default_profile">Implicit (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Мышь и касание</string>
|
||||
<string name="flow_editor_hint">Перетащите, чтобы переместить, потяните за угол, чтобы изменить размер. Нажмите на элемент, чтобы задать его действие.</string>
|
||||
<string name="flow_snap_controls">К другим элементам</string>
|
||||
<string name="flow_default_profile">По умолчанию (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Mus och pekskärm</string>
|
||||
<string name="flow_editor_hint">Dra för att flytta, dra i ett hörn för att ändra storlek. Tryck på en kontroll för att välja vad den gör.</string>
|
||||
<string name="flow_snap_controls">Till andra kontroller</string>
|
||||
<string name="flow_default_profile">Standard (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">เมาส์และการแตะ</string>
|
||||
<string name="flow_editor_hint">ลากเพื่อย้าย ลากมุมเพื่อปรับขนาด แตะตัวควบคุมเพื่อกำหนดสิ่งที่ทำ</string>
|
||||
<string name="flow_snap_controls">ไปยังตัวควบคุมอื่น</string>
|
||||
<string name="flow_default_profile">ค่าเริ่มต้น (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Fare ve dokunma</string>
|
||||
<string name="flow_editor_hint">Taşımak için sürükleyin, boyutlandırmak için bir köşeyi sürükleyin. Ne yapacağını seçmek için bir kontrole dokunun.</string>
|
||||
<string name="flow_snap_controls">Diğer kontrollere</string>
|
||||
<string name="flow_default_profile">Varsayılan (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Миша й дотик</string>
|
||||
<string name="flow_editor_hint">Перетягніть, щоб перемістити, потягніть за кут, щоб змінити розмір. Торкніться елемента, щоб задати його дію.</string>
|
||||
<string name="flow_snap_controls">До інших елементів</string>
|
||||
<string name="flow_default_profile">Типовий (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">Chuột và cảm ứng</string>
|
||||
<string name="flow_editor_hint">Kéo để di chuyển, kéo một góc để đổi kích thước. Chạm vào một nút để chọn chức năng của nó.</string>
|
||||
<string name="flow_snap_controls">Vào các nút khác</string>
|
||||
<string name="flow_default_profile">Mặc định (%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">鼠标和触摸</string>
|
||||
<string name="flow_editor_hint">拖动可移动,拖动角落可调整大小。点按控件可设置其功能。</string>
|
||||
<string name="flow_snap_controls">对齐其他控件</string>
|
||||
<string name="flow_default_profile">默认(%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">滑鼠及觸控</string>
|
||||
<string name="flow_editor_hint">拖曳可移動,拖曳角落可調整大小。輕按控制項可設定其功能。</string>
|
||||
<string name="flow_snap_controls">對齊其他控制項</string>
|
||||
<string name="flow_default_profile">預設(%1$s)</string>
|
||||
</resources>
|
||||
@@ -48,4 +48,5 @@
|
||||
<string name="flow_mouse_touch">滑鼠和觸控</string>
|
||||
<string name="flow_editor_hint">拖曳可移動,拖曳角落可調整大小。點一下控制項可設定其功能。</string>
|
||||
<string name="flow_snap_controls">對齊其他控制項</string>
|
||||
<string name="flow_default_profile">預設(%1$s)</string>
|
||||
</resources>
|
||||
@@ -49,4 +49,5 @@
|
||||
<string name="flow_mouse_touch">Mouse and touch</string>
|
||||
<string name="flow_editor_hint">Drag to move, drag a corner to resize. Tap a control to set what it does.</string>
|
||||
<string name="flow_snap_controls">To other controls</string>
|
||||
<string name="flow_default_profile">Default (%1$s)</string>
|
||||
</resources>
|
||||
@@ -80,6 +80,13 @@ class InputSettingsTest {
|
||||
assertEquals(original.profiles, changed.profiles)
|
||||
assertEquals(original.compileActive(false), changed.compileActive(false))
|
||||
}
|
||||
compose.onNodeWithTag("setting-input-profile").performClick()
|
||||
compose.onNodeWithText(context.getString(R.string.flow_default_profile, context.getString(R.string.flow_profile_desktop)), substring = false).performClick()
|
||||
compose.runOnIdle {
|
||||
val changed = InputLibraries.read(context)
|
||||
assertEquals(InputProfiles.AUTO, changed.selection(true).profile)
|
||||
assertEquals(InputProfile.DESKTOP, changed.activeId(true))
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun actionDraftSurvivesRouteAndTypeChanges() {
|
||||
|
||||
Reference in new issue
Block a user