mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
fix(input): controller navigation works across the Controller tab and profile menus (#2231)
* fix(input): controller navigation works across the Controller tab and profile menus * fix(input): dialog choice rows expose their checked state
This commit is contained in:
1 parent
b474cba79e
commit
e5434117f2
5 files changed
+98
-38
No files matched your search
@@ -0,0 +1,47 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.foundation.LocalIndication
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.hoverable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.interaction.collectIsFocusedAsState
|
||||
import androidx.compose.foundation.interaction.collectIsHoveredAsState
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.Shape
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.semantics.selected
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.toggleableState
|
||||
import androidx.compose.ui.state.ToggleableState
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/** A row that shows focus and answers the controller's A button, like the rest of the settings widgets. */
|
||||
@Composable
|
||||
internal fun Modifier.focusRow(shape: Shape = RoundedCornerShape(10.dp), role: Role = Role.Button, enabled: Boolean = true, checked: Boolean? = null, onClick: () -> Unit): Modifier {
|
||||
val source = remember { MutableInteractionSource() }
|
||||
val hot = source.collectIsFocusedAsState().value || source.collectIsHoveredAsState().value
|
||||
return clip(shape)
|
||||
.background(if (hot && enabled) Color.White.copy(alpha = 0.07f) else Color.Transparent)
|
||||
.glideBorder(hot && enabled, shape, LocalPalette.current.signal)
|
||||
.semantics(mergeDescendants = true) {
|
||||
if (checked != null) {
|
||||
if (role == Role.RadioButton) selected = checked else toggleableState = if (checked) ToggleableState.On else ToggleableState.Off
|
||||
}
|
||||
}
|
||||
.hoverable(source)
|
||||
.clickable(interactionSource = source, indication = LocalIndication.current, enabled = enabled, role = role, onClick = onClick)
|
||||
.controllerConfirm(enabled = enabled, onClick = onClick)
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun PadTextButton(onClick: () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, content: @Composable RowScope.() -> Unit) {
|
||||
TextButton(onClick = onClick, enabled = enabled, modifier = modifier.controllerConfirm(enabled = enabled, onClick = onClick), content = content)
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import android.graphics.Canvas
|
||||
import android.view.View
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material3.*
|
||||
@@ -22,15 +21,17 @@ import com.droiddeck.launcher.input.*
|
||||
|
||||
@Composable
|
||||
internal fun InputLayoutRow(layout: SavedInputLayout, role: InputRole, detail: String?, onManage: () -> Unit, onPick: () -> Unit) {
|
||||
Row(Modifier.fillMaxWidth().clickable(onClick = onPick).padding(12.dp),
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
InputLayoutThumbnail(layout, role)
|
||||
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(4.dp)) {
|
||||
Text(layout.name, style = MaterialTheme.typography.titleMedium)
|
||||
Text(detail ?: stringResource(R.string.input_layout_count, layout.elements.size),
|
||||
style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
|
||||
Row(Modifier.weight(1f).focusRow(onClick = onPick).padding(12.dp),
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
InputLayoutThumbnail(layout, role)
|
||||
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(4.dp)) {
|
||||
Text(layout.name, style = MaterialTheme.typography.titleMedium)
|
||||
Text(detail ?: stringResource(R.string.input_layout_count, layout.elements.size),
|
||||
style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
}
|
||||
}
|
||||
TextButton(onClick = onManage, modifier = Modifier.testTag("layout-manage-${layout.id}")) { Text("⋮", style = MaterialTheme.typography.titleLarge) }
|
||||
PadTextButton(onClick = onManage, modifier = Modifier.testTag("layout-manage-${layout.id}")) { Text("⋮", style = MaterialTheme.typography.titleLarge) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.droiddeck.launcher.ui
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.BorderStroke
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.ui.Alignment
|
||||
@@ -40,7 +39,7 @@ internal fun InputQuickSettings(host: MenuHost, desktop: Boolean, onChanged: (In
|
||||
val profiles = listOf(InputProfiles.AUTO to stringResource(R.string.input_quick_auto, if (desktop) library.profile(library.desktop).name else library.profile(library.steam).name)) +
|
||||
library.profiles.map { it.id to it.name } + if (mixed) listOf("mixed" to stringResource(R.string.input_quick_mixed, active.name)) else emptyList()
|
||||
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
|
||||
Row(Modifier.weight(1f).clickable { expanded = !expanded }.padding(14.dp).testTag("input-profile-expand"),
|
||||
Row(Modifier.weight(1f).focusRow { expanded = !expanded }.padding(14.dp).testTag("input-profile-expand"),
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
Text(if (expanded) "▾" else "▸", color = MaterialTheme.colorScheme.onSurface)
|
||||
Text(stringResource(R.string.input_profile), style = MaterialTheme.typography.titleMedium, color = MaterialTheme.colorScheme.onSurface)
|
||||
@@ -74,9 +73,9 @@ internal fun InputQuickSettings(host: MenuHost, desktop: Boolean, onChanged: (In
|
||||
var name by remember { mutableStateOf("") }
|
||||
AlertDialog(onDismissRequest = { naming = false }, title = { Text(stringResource(R.string.input_save_combination)) },
|
||||
text = { OutlinedTextField(name, { name = it.take(80) }, singleLine = true, label = { Text(stringResource(R.string.input_name)) }) },
|
||||
confirmButton = { TextButton(enabled = name.isNotBlank(), onClick = { update(null) { it.saveSelection(desktop, name) }; naming = false }) { Text(stringResource(R.string.gesture_save_changes)) } },
|
||||
dismissButton = { TextButton(onClick = { naming = false }) { Text(stringResource(R.string.common_cancel)) } })
|
||||
confirmButton = { PadTextButton(enabled = name.isNotBlank(), onClick = { update(null) { it.saveSelection(desktop, name) }; naming = false }) { Text(stringResource(R.string.gesture_save_changes)) } },
|
||||
dismissButton = { PadTextButton(onClick = { naming = false }) { Text(stringResource(R.string.common_cancel)) } })
|
||||
}
|
||||
failure?.let { message -> AlertDialog(onDismissRequest = { failure = null }, title = { Text(stringResource(R.string.input_save_failed)) },
|
||||
text = { Text(message) }, confirmButton = { TextButton(onClick = { failure = null }) { Text(stringResource(R.string.common_ok)) } }) }
|
||||
text = { Text(message) }, confirmButton = { PadTextButton(onClick = { failure = null }) { Text(stringResource(R.string.common_ok)) } }) }
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.focusGroup
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
@@ -116,7 +118,17 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
}
|
||||
}
|
||||
fun editPart(nextRole: InputRole) { role = nextRole; bindingsTab = 0; go(InputPage.SOURCE) }
|
||||
val pageFocus = remember { androidx.compose.ui.focus.FocusRequester() }
|
||||
val inputMode = androidx.compose.ui.platform.LocalInputModeManager.current
|
||||
var settled by remember { mutableStateOf(false) }
|
||||
LaunchedEffect(page, role, profileId, edit != null, surface) {
|
||||
if (!settled) { settled = true; return@LaunchedEffect }
|
||||
if (surface || inputMode.inputMode != androidx.compose.ui.input.InputMode.Keyboard) return@LaunchedEffect
|
||||
repeat(2) { withFrameNanos { } }
|
||||
runCatching { pageFocus.requestFocus() }
|
||||
}
|
||||
val editing = edit
|
||||
Box(Modifier.focusRequester(pageFocus).focusGroup()) {
|
||||
if (editing != null) {
|
||||
val b = library.preset(editing.preset)
|
||||
var elementProperties by remember(editing) { mutableStateOf(editing.element) }
|
||||
@@ -177,7 +189,7 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
p.id == library.desktop -> stringResource(R.string.input_default_desktop)
|
||||
else -> null
|
||||
}, Modifier.testTag("input-profile-${p.id}")) { profileId = p.id; go(InputPage.PROFILE) }
|
||||
TextButton(onClick = { newProfile(false) }, modifier = Modifier.padding(8.dp)) { Text(stringResource(R.string.input_new_profile)) }
|
||||
PadTextButton(onClick = { newProfile(false) }, modifier = Modifier.padding(8.dp)) { Text(stringResource(R.string.input_new_profile)) }
|
||||
}
|
||||
SettingsGroup(stringResource(R.string.input_device_settings)) {
|
||||
ToggleRow(host, "controller-rumble", stringResource(R.string.ctrl_rumble), null, controller.rumble) { ControllerPrefs.setRumble(context, it); onChanged() }
|
||||
@@ -197,7 +209,7 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
text = { Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
Text(timing)
|
||||
Text(stringResource(R.string.input_measure_instructions), style = MaterialTheme.typography.bodySmall)
|
||||
} }, confirmButton = { TextButton(onClick = { reading = false }) { Text(stringResource(R.string.common_close)) } })
|
||||
} }, confirmButton = { PadTextButton(onClick = { reading = false }) { Text(stringResource(R.string.common_close)) } })
|
||||
}
|
||||
}
|
||||
InputPage.PROFILE -> {
|
||||
@@ -260,7 +272,7 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
else {
|
||||
for (b in preset.keys) {
|
||||
InputNavigationRow(b.key.label, actionLabel(b.action)) { edit = InputBindingEdit(preset.id, InputControl.A, key = b.key) }
|
||||
TextButton(onClick = { update { it.withPreset(preset.copy(keys = preset.keys - b)) } }) { Text(stringResource(R.string.input_remove_binding)) }
|
||||
PadTextButton(onClick = { update { it.withPreset(preset.copy(keys = preset.keys - b)) } }) { Text(stringResource(R.string.input_remove_binding)) }
|
||||
}
|
||||
InputNavigationRow(stringResource(R.string.input_capture), stringResource(R.string.input_capture_hint)) { capture = true }
|
||||
}
|
||||
@@ -287,10 +299,10 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
reuse = InputReuseRequest(saved.name, layoutOnly = true) { shared -> if (update { it.useLayout(profileId, role, saved.id, shared) }) go(InputPage.SOURCE) }
|
||||
}
|
||||
}
|
||||
if (other.isNotEmpty()) TextButton(onClick = { showOther = !showOther }, modifier = Modifier.padding(8.dp)) {
|
||||
if (other.isNotEmpty()) PadTextButton(onClick = { showOther = !showOther }, modifier = Modifier.padding(8.dp)) {
|
||||
Text(stringResource(if (showOther) R.string.input_hide_other_layouts else R.string.input_other_layouts, other.size))
|
||||
}
|
||||
TextButton(onClick = { naming = InputNameRequest(R.string.input_new_layout, "") { name, _, _ ->
|
||||
PadTextButton(onClick = { naming = InputNameRequest(R.string.input_new_layout, "") { name, _, _ ->
|
||||
val created = SavedInputLayout(newInputId(), name, screen = if (role == InputRole.PRIMARY) InputLayoutScreen.MAIN else InputLayoutScreen.SECONDARY)
|
||||
if (update { it.withLayout(created).useLayout(profileId, role, created.id, shared = true) }) { go(InputPage.SOURCE); surface = true }
|
||||
} }, modifier = Modifier.padding(8.dp)) { Text(stringResource(R.string.input_new_layout)) }
|
||||
@@ -309,6 +321,7 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
managingLayout?.let { saved -> AlertDialog(onDismissRequest = { managingLayout = null }, title = { Text(saved.name) },
|
||||
text = { Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
Text(stringResource(R.string.input_layout_count, saved.elements.size))
|
||||
@@ -321,7 +334,7 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
managingLayout = null
|
||||
confirmation = InputConfirmation(context.getString(R.string.input_delete), context.getString(R.string.input_delete_layout_detail, saved.name)) { update { it.removeLayout(saved.id) } }
|
||||
}
|
||||
} }, confirmButton = { TextButton(onClick = { managingLayout = null }) { Text(stringResource(R.string.common_close)) } }) }
|
||||
} }, confirmButton = { PadTextButton(onClick = { managingLayout = null }) { Text(stringResource(R.string.common_close)) } }) }
|
||||
if (capture) InputCaptureDialog(onDismiss = { capture = false }) { capture = false; edit = InputBindingEdit(preset.id, InputControl.A, key = it) }
|
||||
if (surface) InputSurfaceDialog(profileId, onDismiss = { surface = false; library = InputLibraries.read(context) }, onChanged = {
|
||||
library = InputLibraries.read(context); onChanged()
|
||||
@@ -329,10 +342,10 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
naming?.let { request -> key(request) { InputNameDialog(request) { naming = null } } }
|
||||
reuse?.let { request -> key(request) { InputReuseDialog(request) { reuse = null } } }
|
||||
confirmation?.let { request -> AlertDialog(onDismissRequest = { confirmation = null }, title = { Text(request.title) },
|
||||
text = { Text(request.detail) }, confirmButton = { TextButton(onClick = { confirmation = null; request.action() }) { Text(stringResource(R.string.common_ok)) } },
|
||||
dismissButton = { TextButton(onClick = { confirmation = null }) { Text(stringResource(R.string.common_cancel)) } }) }
|
||||
text = { Text(request.detail) }, confirmButton = { PadTextButton(onClick = { confirmation = null; request.action() }) { Text(stringResource(R.string.common_ok)) } },
|
||||
dismissButton = { PadTextButton(onClick = { confirmation = null }) { Text(stringResource(R.string.common_cancel)) } }) }
|
||||
error?.let { message -> AlertDialog(onDismissRequest = { error = null }, title = { Text(stringResource(R.string.input_save_failed)) },
|
||||
text = { Text(message) }, confirmButton = { TextButton(onClick = { error = null }) { Text(stringResource(R.string.common_ok)) } }) }
|
||||
text = { Text(message) }, confirmButton = { PadTextButton(onClick = { error = null }) { Text(stringResource(R.string.common_ok)) } }) }
|
||||
}
|
||||
|
||||
@Composable
|
||||
@@ -345,14 +358,14 @@ private fun InputNameDialog(request: InputNameRequest, onDismiss: () -> Unit) {
|
||||
OutlinedTextField(name, { name = it.take(80) }, label = { Text(stringResource(R.string.input_name)) }, singleLine = true, modifier = Modifier.testTag("input-name"))
|
||||
if (request.sources.isNotEmpty()) ChoiceRow(host, "input-copy-source", stringResource(R.string.input_start_from), null, request.sources, source) { source = it }
|
||||
if (request.offerSharing) {
|
||||
Row(Modifier.fillMaxWidth().clickable { shared = !shared }, verticalAlignment = Alignment.CenterVertically) {
|
||||
Checkbox(shared, { shared = it }, Modifier.testTag("input-share-physical"))
|
||||
Row(Modifier.fillMaxWidth().focusRow(role = Role.Checkbox, checked = shared) { shared = !shared }.testTag("input-share-physical"), verticalAlignment = Alignment.CenterVertically) {
|
||||
Checkbox(shared, null)
|
||||
Text(stringResource(R.string.input_share_physical))
|
||||
}
|
||||
Text(stringResource(R.string.input_new_independent_hint), style = MaterialTheme.typography.bodySmall)
|
||||
}
|
||||
} }, confirmButton = { TextButton(enabled = name.isNotBlank(), onClick = { request.save(name.trim(), source, shared); onDismiss() }) { Text(stringResource(R.string.gesture_save_changes)) } },
|
||||
dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.common_cancel)) } })
|
||||
} }, confirmButton = { PadTextButton(enabled = name.isNotBlank(), onClick = { request.save(name.trim(), source, shared); onDismiss() }) { Text(stringResource(R.string.gesture_save_changes)) } },
|
||||
dismissButton = { PadTextButton(onClick = onDismiss) { Text(stringResource(R.string.common_cancel)) } })
|
||||
}
|
||||
|
||||
@Composable
|
||||
@@ -360,12 +373,12 @@ private fun InputReuseDialog(request: InputReuseRequest, onDismiss: () -> Unit)
|
||||
var shared by remember { mutableStateOf(false) }
|
||||
AlertDialog(onDismissRequest = onDismiss, title = { Text(request.name) }, text = { Column(Modifier.verticalScroll(rememberScrollState())) {
|
||||
Text(stringResource(if (request.layoutOnly) R.string.input_reuse_layout_detail else R.string.input_reuse_part_detail))
|
||||
for (link in listOf(false, true)) Row(Modifier.fillMaxWidth().clickable { shared = link }, verticalAlignment = Alignment.CenterVertically) {
|
||||
RadioButton(shared == link, { shared = link })
|
||||
for (link in listOf(false, true)) Row(Modifier.fillMaxWidth().focusRow(role = Role.RadioButton, checked = shared == link) { shared = link }, verticalAlignment = Alignment.CenterVertically) {
|
||||
RadioButton(shared == link, null)
|
||||
Text(stringResource(if (link) R.string.input_keep_shared else R.string.input_independent_copy))
|
||||
}
|
||||
} }, confirmButton = { TextButton(onClick = { request.apply(shared); onDismiss() }) { Text(stringResource(R.string.common_ok)) } },
|
||||
dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.common_cancel)) } })
|
||||
} }, confirmButton = { PadTextButton(onClick = { request.apply(shared); onDismiss() }) { Text(stringResource(R.string.common_ok)) } },
|
||||
dismissButton = { PadTextButton(onClick = onDismiss) { Text(stringResource(R.string.common_cancel)) } })
|
||||
}
|
||||
|
||||
@Composable
|
||||
@@ -375,7 +388,7 @@ private fun InputControlGrid(preset: SavedInputBindings, available: List<InputCo
|
||||
val columns = if (maxWidth < 480.dp) 2 else 4
|
||||
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
for (row in controls.chunked(columns)) Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
for (control in row) OutlinedCard(onClick = { onPick(control) }, modifier = Modifier.weight(1f).testTag("input-binding-${control.id}")) {
|
||||
for (control in row) OutlinedCard(onClick = { onPick(control) }, modifier = Modifier.weight(1f).controllerConfirm { onPick(control) }.testTag("input-binding-${control.id}")) {
|
||||
Column(Modifier.padding(12.dp).heightIn(min = 48.dp)) {
|
||||
Text(control.label, style = MaterialTheme.typography.titleMedium)
|
||||
Text(actionLabel(preset.controls[control] ?: InputAction.Native()), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
@@ -389,7 +402,7 @@ private fun InputControlGrid(preset: SavedInputBindings, available: List<InputCo
|
||||
|
||||
@Composable
|
||||
private fun InputNavigationRow(title: String, detail: String?, modifier: Modifier = Modifier, leading: (@Composable () -> Unit)? = null, onClick: () -> Unit) {
|
||||
Row(modifier.fillMaxWidth().clickable(role = Role.Button, onClick = onClick).heightIn(min = 64.dp).padding(14.dp),
|
||||
Row(modifier.fillMaxWidth().focusRow(RoundedCornerShape(0.dp), onClick = onClick).heightIn(min = 64.dp).padding(14.dp),
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
leading?.invoke()
|
||||
Column(Modifier.weight(1f)) {
|
||||
|
||||
@@ -184,7 +184,7 @@ fun InputSurfaceDialog(profile: String, onDismiss: () -> Unit, onChanged: () ->
|
||||
}
|
||||
}
|
||||
if (draft.adding) AlertDialog(onDismissRequest = { draft.adding = false }, title = { Text(stringResource(R.string.input_add_element)) }, confirmButton = {}, text = { Column {
|
||||
for (kind in InputElementKind.entries) TextButton(onClick = { draft.checkpoint()
|
||||
for (kind in InputElementKind.entries) PadTextButton(onClick = { draft.checkpoint()
|
||||
val w = if (kind.control.dimensions == 2) .4f else .2f
|
||||
val h = .3f
|
||||
val name = context.getString(kind.label()) + " " + (draft.elements.count { it.kind == kind } + 1)
|
||||
@@ -193,10 +193,10 @@ fun InputSurfaceDialog(profile: String, onDismiss: () -> Unit, onChanged: () ->
|
||||
draft.adding = false; draft.toolsExpanded = false }) { Text(stringResource(kind.label())) }
|
||||
} })
|
||||
if (discard) AlertDialog(onDismissRequest = { discard = false }, title = { Text(stringResource(R.string.input_editor_discard)) },
|
||||
confirmButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.common_ok)) } },
|
||||
dismissButton = { TextButton(onClick = { discard = false }) { Text(stringResource(R.string.common_cancel)) } })
|
||||
confirmButton = { PadTextButton(onClick = onDismiss) { Text(stringResource(R.string.common_ok)) } },
|
||||
dismissButton = { PadTextButton(onClick = { discard = false }) { Text(stringResource(R.string.common_cancel)) } })
|
||||
failure?.let { AlertDialog(onDismissRequest = { failure = null }, title = { Text(stringResource(R.string.input_save_failed)) }, text = { Text(it) },
|
||||
confirmButton = { TextButton(onClick = { failure = null }) { Text(stringResource(R.string.common_ok)) } }) }
|
||||
confirmButton = { PadTextButton(onClick = { failure = null }) { Text(stringResource(R.string.common_ok)) } }) }
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
Reference in new issue
Block a user