ui: move remaining launcher and second-screen copy to string resources

This commit is contained in:
xXJSONDeruloXx committed 2026-10-01 22:15:45 -04:00
1 parent 66e3ad812d
commit 3b9572d88e
12 files changed
+152 -73

No files matched your search

@@ -1,5 +1,6 @@
package com.droiddeck.launcher.ui
import com.droiddeck.launcher.R
import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Canvas
@@ -36,7 +37,7 @@ class DeckControlsPanel(
private val onSteamMenu: () -> Unit,
private val onQam: () -> Unit,
) : LinearLayout(context) {
private enum class Tab(val label: String) { GRIPS("Grips"), LEFT("Left pad"), RIGHT("Right pad"), BOTH("Both") }
private enum class Tab(val label: Int) { GRIPS(R.string.deck_tab_grips), LEFT(R.string.deck_tab_left), RIGHT(R.string.deck_tab_right), BOTH(R.string.deck_tab_both) }
private val content = FrameLayout(context)
private val tabViews = HashMap<Tab, TextView>()
@@ -58,14 +59,14 @@ class DeckControlsPanel(
orientation = HORIZONTAL
gravity = Gravity.CENTER_VERTICAL
setPadding(dp(12), dp(10), dp(12), dp(6))
addView(roundButton("×", "Close second-screen controls", onClose))
addView(roundButton("×", context.getString(R.string.deck_close), onClose))
val tabs = LinearLayout(context).apply {
orientation = HORIZONTAL
background = outline(CORNER_PILL, SURFACE)
setPadding(dp(4), dp(4), dp(4), dp(4))
for (tab in Tab.values()) {
val view = TextView(context).apply {
text = tab.label
text = context.getString(tab.label)
textSize = 14f
typeface = Typeface.create(Typeface.DEFAULT, Typeface.BOLD)
gravity = Gravity.CENTER
@@ -81,9 +82,9 @@ class DeckControlsPanel(
addView(tabs, FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, dp(44), Gravity.CENTER))
}
addView(centre, LayoutParams(0, LayoutParams.MATCH_PARENT, 1f))
addView(roundButton("STEAM", "Open Steam menu", onSteamMenu, wide = true))
addView(roundButton("STEAM", context.getString(R.string.deck_open_steam_menu), onSteamMenu, wide = true))
addView(space(dp(8)))
addView(roundButton("•••", "Open Quick Access Menu", onQam, wide = true))
addView(roundButton("•••", context.getString(R.string.drawer_open_qam), onQam, wide = true))
}
private fun select(tab: Tab) {
@@ -114,9 +115,9 @@ class DeckControlsPanel(
addView(upper, LayoutParams(LayoutParams.MATCH_PARENT, 0, 1f).apply { bottomMargin = dp(6) })
addView(lower, LayoutParams(LayoutParams.MATCH_PARENT, 0, 1f).apply { topMargin = dp(6) })
}
addView(column(GripButton(context, "L4", "Left · upper", DeckControls.L4), GripButton(context, "L5", "Left · lower", DeckControls.L5)),
addView(column(GripButton(context, "L4", context.getString(R.string.deck_left_upper), DeckControls.L4), GripButton(context, "L5", context.getString(R.string.deck_left_lower), DeckControls.L5)),
LayoutParams(0, LayoutParams.MATCH_PARENT, 1f).apply { rightMargin = dp(6) })
addView(column(GripButton(context, "R4", "Right · upper", DeckControls.R4), GripButton(context, "R5", "Right · lower", DeckControls.R5)),
addView(column(GripButton(context, "R4", context.getString(R.string.deck_right_upper), DeckControls.R4), GripButton(context, "R5", context.getString(R.string.deck_right_lower), DeckControls.R5)),
LayoutParams(0, LayoutParams.MATCH_PARENT, 1f).apply { leftMargin = dp(6) })
}
@@ -255,7 +256,7 @@ class DeckControlsPanel(
HoldButton(context, label, caption, { DeckControls.setGrip(bit, it) })
private class ClickBar(context: Context, right: Boolean) :
HoldButton(context, "Click", if (right) "Right trackpad" else "Left trackpad", { DeckControls.setClick(right, it) })
HoldButton(context, context.getString(R.string.deck_click), if (right) context.getString(R.string.deck_right_trackpad) else context.getString(R.string.deck_left_trackpad), { DeckControls.setClick(right, it) })
/**
* One trackpad: where the first finger is, as the Deck reports it (-1..1, y up), and a click
@@ -282,7 +283,7 @@ class DeckControlsPanel(
canvas.drawLine(cx, cy - reach, cx, cy + reach, guide)
captionPaint.textSize = 12 * density
captionPaint.color = if (touching) ACCENT else TEXT_DIM
canvas.drawText(if (right) "RIGHT TRACKPAD" else "LEFT TRACKPAD", cx, 28 * density, captionPaint)
canvas.drawText((if (right) context.getString(R.string.deck_right_trackpad) else context.getString(R.string.deck_left_trackpad)).uppercase(), cx, 28 * density, captionPaint)
if (touching) {
val radius = 56 * density
glow.shader = RadialGradient(fingerX, fingerY, radius, ACCENT_GLOW, Color.TRANSPARENT, Shader.TileMode.CLAMP)
@@ -1,5 +1,7 @@
package com.droiddeck.launcher.ui
import com.droiddeck.launcher.R
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.focus.focusRequester
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.animateColorAsState
@@ -107,16 +109,16 @@ internal fun SideRail(
verticalArrangement = Arrangement.spacedBy(4.dp),
modifier = Modifier.fillMaxSize().verticalScroll(rememberScrollState()),
) {
RailItem("Steam", Icons.Outlined.SportsEsports, "steam", selected == "steam", compact, iconOnly, fit, onFocus = { onFocusSelect("steam") }) { onSelect("steam") }
RailItem(stringResource(R.string.rail_steam), Icons.Outlined.SportsEsports, "steam", selected == "steam", compact, iconOnly, fit, onFocus = { onFocusSelect("steam") }) { onSelect("steam") }
// Always there, so the items below it never move; an empty library says how to fill it.
RailItem("Games", Icons.Outlined.VideoLibrary, "games", selected == "games", compact, iconOnly, fit, onFocus = { onFocusSelect("games") }) { onSelect("games") }
RailItem("Desktop", Icons.Outlined.DesktopWindows, "desktop", selected == "desktop", compact, iconOnly, fit, onFocus = { onFocusSelect("desktop") }) { onSelect("desktop") }
if (s.storeEnabled) RailItem("Store", Icons.Outlined.Storefront, "store", selected == "store", compact, iconOnly, fit, onFocus = { onFocusSelect("store") }) { onSelect("store") }
RailItem("Components", Icons.Outlined.Layers, "components", selected == "components", compact, iconOnly, fit, onFocus = { onFocusSelect("components") }) { onSelect("components") }
RailItem(stringResource(R.string.rail_games), Icons.Outlined.VideoLibrary, "games", selected == "games", compact, iconOnly, fit, onFocus = { onFocusSelect("games") }) { onSelect("games") }
RailItem(stringResource(R.string.rail_desktop), Icons.Outlined.DesktopWindows, "desktop", selected == "desktop", compact, iconOnly, fit, onFocus = { onFocusSelect("desktop") }) { onSelect("desktop") }
if (s.storeEnabled) RailItem(stringResource(R.string.rail_store), Icons.Outlined.Storefront, "store", selected == "store", compact, iconOnly, fit, onFocus = { onFocusSelect("store") }) { onSelect("store") }
RailItem(stringResource(R.string.rail_components), Icons.Outlined.Layers, "components", selected == "components", compact, iconOnly, fit, onFocus = { onFocusSelect("components") }) { onSelect("components") }
// Home mode's extra section goes last, so it shifts nothing above it.
if (s.isHomeApp) RailItem("Apps", Icons.Outlined.Apps, "android-apps", selected == "android-apps", compact, iconOnly, fit, onFocus = { onFocusSelect("android-apps") }) { onSelect("android-apps") }
RailItem("Setup", Icons.Outlined.Tune, "setup", selected == "setup", compact, iconOnly, fit, badge = setupNeedsAttention, onFocus = { onFocusSelect("setup") }) { onSelect("setup") }
RailItem("Updates", Icons.Outlined.SystemUpdate, "updates", selected == "updates", compact, iconOnly, fit, badge = s.updates.hasUpdate, onFocus = { onFocusSelect("updates") }) { onSelect("updates") }
if (s.isHomeApp) RailItem(stringResource(R.string.rail_apps), Icons.Outlined.Apps, "android-apps", selected == "android-apps", compact, iconOnly, fit, onFocus = { onFocusSelect("android-apps") }) { onSelect("android-apps") }
RailItem(stringResource(R.string.rail_setup), Icons.Outlined.Tune, "setup", selected == "setup", compact, iconOnly, fit, badge = setupNeedsAttention, onFocus = { onFocusSelect("setup") }) { onSelect("setup") }
RailItem(stringResource(R.string.rail_updates), Icons.Outlined.SystemUpdate, "updates", selected == "updates", compact, iconOnly, fit, badge = s.updates.hasUpdate, onFocus = { onFocusSelect("updates") }) { onSelect("updates") }
}
}
AnimatedVisibility(s.busy, enter = expandVertically(Motion.sp(1f)) + fadeIn(Motion.sp(1f)), exit = shrinkVertically(Motion.sp(1f)) + fadeOut(Motion.sp(1f))) {
@@ -124,7 +126,7 @@ internal fun SideRail(
val barWidth = if (iconOnly) 44.dp else 60.dp
if (s.percent >= 0) LinearProgressIndicator(progress = { s.percent / 100f }, modifier = Modifier.width(barWidth))
else LinearProgressIndicator(modifier = Modifier.width(barWidth))
Text(if (s.percent >= 0) "${s.percent}%" else if (iconOnly) "…" else "Working", fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 4.dp))
Text(if (s.percent >= 0) stringResource(R.string.rail_percent, s.percent) else if (iconOnly) "…" else stringResource(R.string.setup_check_busy), fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 4.dp))
}
}
var lastRunning by remember { mutableStateOf("") }
@@ -198,6 +200,7 @@ private fun ResumeRailItem(name: String, compact: Boolean, iconOnly: Boolean, on
val src = remember { MutableInteractionSource() }
val focused by src.collectIsFocusedAsState()
val hovered by src.collectIsHoveredAsState()
val resumeDescription = stringResource(R.string.rail_resume_named, name)
val pulse = rememberInfiniteTransition(label = "pulse")
val ringScale by pulse.animateFloat(0.4f, 1.6f, infiniteRepeatable(tween(1600, easing = Motion.Ease), RepeatMode.Restart), label = "ring")
// Animations off: the live dot alone, no pulsing ring.
@@ -213,7 +216,7 @@ private fun ResumeRailItem(name: String, compact: Boolean, iconOnly: Boolean, on
.glideBorder(focused, Shape14, pal.signal)
.hoverable(src)
.clickable(interactionSource = src, indication = LocalIndication.current, role = Role.Button, onClick = onResume)
.semantics { contentDescription = "Resume $name" }
.semantics { contentDescription = resumeDescription }
.padding(vertical = if (iconOnly) 15.dp else if (compact) 6.dp else 9.dp, horizontal = 4.dp),
) {
Box(modifier = Modifier.size(14.dp), contentAlignment = Alignment.Center) {
@@ -222,7 +225,7 @@ private fun ResumeRailItem(name: String, compact: Boolean, iconOnly: Boolean, on
}
// Icons only: the live dot alone says something is running; its description says what.
if (!iconOnly) {
Text("Resume", fontSize = 12.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, maxLines = 1, softWrap = false)
Text(stringResource(R.string.resume_session), fontSize = 12.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, maxLines = 1, softWrap = false)
Text(name, fontSize = 12.sp, color = colors.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis)
}
}
@@ -1,6 +1,8 @@
package com.droiddeck.launcher.ui
import java.io.File
import androidx.compose.ui.res.stringResource
import com.droiddeck.launcher.R
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.runtime.CompositionLocalProvider
@@ -501,7 +503,7 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
if (showDeveloperDisplayChoice) {
DeveloperDisplayChoiceDialog(
displays = s.secondScreenDisplays.map { display ->
display.id to if (s.secondScreenDisplays.size == 1) "Bottom screen" else display.label
display.id to if (s.secondScreenDisplays.size == 1) stringResource(R.string.screen_bottom) else display.label
},
onMainScreen = {
showDeveloperDisplayChoice = false
@@ -1,5 +1,7 @@
package com.droiddeck.launcher.ui
import com.droiddeck.launcher.R
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.layout.boundsInRoot
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.focus.focusRequester
@@ -233,5 +235,5 @@ internal fun Cog(size: androidx.compose.ui.unit.Dp = 48.dp, onClick: () -> Unit)
contentAlignment = Alignment.Center,
modifier = Modifier.paneItem("cog").downToFirstTile().size(size).clip(if (size > 48.dp) Shape14 else Shape12).background(Color.White.copy(alpha = 0.03f)).glideBorder(hot, if (size > 48.dp) Shape14 else Shape12, pal.signal, pal.line2)
.hoverable(src).clickable(interactionSource = src, indication = LocalIndication.current, onClick = onClick),
) { Icon(Icons.Filled.Settings, "Settings", tint = if (hot) pal.signal else colors.onBackground, modifier = Modifier.size(if (size > 48.dp) 20.dp else 18.dp).rotate(rot)) }
) { Icon(Icons.Filled.Settings, stringResource(R.string.drawer_page_settings), tint = if (hot) pal.signal else colors.onBackground, modifier = Modifier.size(if (size > 48.dp) 20.dp else 18.dp).rotate(rot)) }
}
@@ -1,5 +1,7 @@
package com.droiddeck.launcher.ui
import com.droiddeck.launcher.R
import androidx.compose.ui.res.stringResource
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
@@ -25,17 +27,17 @@ fun ChooseAppDisplayDialog(
) {
AlertDialog(
onDismissRequest = onDismiss,
title = { Text("Launch ${app.label}") },
title = { Text(stringResource(R.string.main_launch_named, app.label)) },
text = {
Text(
secondaryDisplay?.let { "Choose a screen. Secondary: ${it.label}." }
?: "The secondary display is no longer available.",
secondaryDisplay?.let { stringResource(R.string.main_choose_screen, it.label) }
?: stringResource(R.string.main_secondary_gone),
)
},
confirmButton = { TextButton(onClick = onPrimary) { Text("Primary screen") } },
confirmButton = { TextButton(onClick = onPrimary) { Text(stringResource(R.string.main_primary)) } },
dismissButton = {
TextButton(onClick = onSecondary, enabled = secondaryDisplay != null) {
Text("Secondary screen")
Text(stringResource(R.string.main_secondary))
}
},
)
@@ -48,6 +50,6 @@ fun ConfirmDialog(title: String, text: String, confirm: String, onConfirm: () ->
title = { Text(title) },
text = { Text(text) },
confirmButton = { TextButton(onClick = { onDismiss(); onConfirm() }) { Text(confirm) } },
dismissButton = { TextButton(onClick = onDismiss) { Text("Cancel") } },
dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.common_cancel)) } },
)
}
@@ -1,5 +1,7 @@
package com.droiddeck.launcher.ui
import com.droiddeck.launcher.R
import androidx.compose.ui.res.stringResource
import android.view.KeyEvent
import androidx.compose.animation.animateColorAsState
import androidx.compose.foundation.background
@@ -157,11 +159,11 @@ fun PcKeyboard(
) {
Column(verticalArrangement = Arrangement.spacedBy(3.dp)) {
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().height(24.dp)) {
Text("PC keyboard", fontSize = 12.sp, fontWeight = FontWeight.SemiBold, color = colors.onSurfaceVariant)
Text(stringResource(R.string.drawer_pc_keyboard), fontSize = 12.sp, fontWeight = FontWeight.SemiBold, color = colors.onSurfaceVariant)
Spacer(Modifier.weight(1f))
HeaderButton("Android keyboard", onAndroidKeyboard)
HeaderButton(stringResource(R.string.pckb_android), onAndroidKeyboard)
Spacer(Modifier.width(8.dp))
HeaderButton("Hide ✕", onClose)
HeaderButton(stringResource(R.string.pckb_hide), onClose)
}
ROWS.forEachIndexed { r, row ->
Row(horizontalArrangement = Arrangement.spacedBy(3.dp), modifier = Modifier.fillMaxWidth().height(rowHeight)) {
@@ -1,5 +1,7 @@
package com.droiddeck.launcher.ui
import com.droiddeck.launcher.R
import androidx.compose.ui.res.stringResource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
@@ -33,43 +35,43 @@ fun ProtonPage(
val colors = MaterialTheme.colorScheme
SettingsPage(
host,
title = "Proton versions",
eyebrow = "Setup",
lede = "Download and install an ARM64 Proton build now, then select it per game in Steam > Properties > Compatibility.",
title = stringResource(R.string.setup_tool_protons),
eyebrow = stringResource(R.string.setup_title),
lede = stringResource(R.string.proton_lede),
onBack = onBack,
) {
if (!runtimeReady) Text(
"Install the Linux runtime from Setup before managing compatibility tools.",
stringResource(R.string.content_needs_runtime),
fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 8.dp, bottom = 6.dp),
)
if (sessionRunning) Text(
"Stop the active session before installing or removing a compatibility tool.",
stringResource(R.string.proton_stop_first),
fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 8.dp, bottom = 6.dp),
)
SettingsGroup("Available builds") {
SettingsGroup(stringResource(R.string.proton_available)) {
for (row in rows) {
SettingsRow(
row.name,
when {
row.installed != null -> "Installed ${row.installed}"
row.queued -> "Pending from an earlier request"
else -> "Not installed"
row.installed != null -> stringResource(R.string.proton_installed, row.installed)
row.queued -> stringResource(R.string.proton_queued)
else -> stringResource(R.string.proton_not_installed)
},
) {
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
when {
row.installed != null -> SecondaryButton("Remove", enabled = busyId == null && runtimeReady && !sessionRunning) { onRemove(row.id) }
busyId != null -> SecondaryButton(if (busyId == row.id) "Installing…" else "Install", enabled = false) {}
else -> SecondaryButton("Install now", enabled = runtimeReady && !sessionRunning) { onInstall(row.id) }
row.installed != null -> SecondaryButton(stringResource(R.string.store_remove), enabled = busyId == null && runtimeReady && !sessionRunning) { onRemove(row.id) }
busyId != null -> SecondaryButton(if (busyId == row.id) stringResource(R.string.store_installing) else stringResource(R.string.store_install), enabled = false) {}
else -> SecondaryButton(stringResource(R.string.proton_install_now), enabled = runtimeReady && !sessionRunning) { onInstall(row.id) }
}
if (row.queued && row.installed == null && busyId == null) {
SecondaryButton("Cancel queued", enabled = !sessionRunning) { onCancel(row.id) }
SecondaryButton(stringResource(R.string.proton_cancel_queued), enabled = !sessionRunning) { onCancel(row.id) }
}
}
}
if (busyId == row.id) Column(modifier = Modifier.fillMaxWidth().padding(start = 12.dp, end = 12.dp, bottom = 10.dp)) {
Text(
if (stage != null && percent >= 0) "$stage · $percent%" else stage ?: "Starting…",
if (stage != null && percent >= 0) stringResource(R.string.store_busy_percent_short, stage, percent) else stage ?: stringResource(R.string.store_starting),
fontSize = 13.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(bottom = 5.dp),
)
if (percent >= 0) LinearProgressIndicator(progress = { percent / 100f }, modifier = Modifier.fillMaxWidth().height(4.dp))
@@ -1,5 +1,7 @@
package com.droiddeck.launcher.ui
import com.droiddeck.launcher.R
import androidx.compose.ui.res.stringResource
import androidx.compose.foundation.layout.Column
import androidx.compose.ui.Modifier
import androidx.compose.foundation.layout.Spacer
@@ -15,31 +17,31 @@ import androidx.compose.ui.unit.dp
fun RomsDialog(path: String?, onChoose: () -> Unit, onClear: () -> Unit, onDismiss: () -> Unit) {
AlertDialog(
onDismissRequest = onDismiss,
title = { Text("ROMs folder") },
title = { Text(stringResource(R.string.setup_tool_roms)) },
text = {
Column {
Text(
"This folder appears as /root/ROMs in each session. Internal storage is available at /root/Storage.",
stringResource(R.string.roms_text),
style = MaterialTheme.typography.bodyMedium,
)
Spacer(Modifier.height(10.dp))
Text(
path ?: "No folder chosen",
path ?: stringResource(R.string.roms_none),
style = MaterialTheme.typography.bodySmall,
color = if (path != null) MaterialTheme.colorScheme.onSurface else MaterialTheme.colorScheme.onSurfaceVariant,
)
Spacer(Modifier.height(6.dp))
Text(
"Applies next session. SD cards are supported.",
stringResource(R.string.roms_applies),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
},
confirmButton = { TextButton(onClick = onChoose) { Text(if (path == null) "Choose folder" else "Change folder") } },
confirmButton = { TextButton(onClick = onChoose) { Text(if (path == null) stringResource(R.string.roms_choose) else stringResource(R.string.roms_change)) } },
dismissButton = {
if (path != null) TextButton(onClick = onClear) { Text("Forget") }
else TextButton(onClick = onDismiss) { Text("Cancel") }
if (path != null) TextButton(onClick = onClear) { Text(stringResource(R.string.common_forget)) }
else TextButton(onClick = onDismiss) { Text(stringResource(R.string.common_cancel)) }
},
)
}
@@ -1,5 +1,6 @@
package com.droiddeck.launcher.ui
import com.droiddeck.launcher.R
import android.app.Presentation
import android.content.ClipboardManager
import android.content.Context
@@ -128,37 +129,37 @@ class SecondScreenPresentation(
}
controls.addView(Button(context).apply {
text = "×"
contentDescription = "Close second-screen controls"
contentDescription = context.getString(R.string.deck_close)
minWidth = dp(48)
setOnClickListener { onClose() }
})
controls.addView(TextView(context).apply {
text = "Trackpad"
text = context.getString(R.string.second_trackpad)
textSize = 14f
setTextColor(Color.WHITE)
}, LinearLayout.LayoutParams(0, -2, 1f))
val keyboardButton = Button(context).apply {
text = "Show keyboard"
text = context.getString(R.string.second_show_keyboard)
setOnClickListener {
val host = keyboardHost ?: return@setOnClickListener
if (host.shown) {
host.hide()
text = "Show keyboard"
text = context.getString(R.string.second_show_keyboard)
} else {
host.show()
text = "Hide keyboard"
text = context.getString(R.string.second_hide_keyboard)
}
}
}
controls.addView(keyboardButton)
controls.addView(Button(context).apply {
text = "STEAM"
contentDescription = "Open Steam menu"
contentDescription = context.getString(R.string.deck_open_steam_menu)
setOnClickListener { onSteamMenu() }
})
controls.addView(Button(context).apply {
text = "…"
contentDescription = "Open Quick Access Menu"
contentDescription = context.getString(R.string.drawer_open_qam)
setOnClickListener { onQam() }
})
panel.addView(controls, FrameLayout.LayoutParams(-1, -2, Gravity.TOP))
@@ -179,17 +180,17 @@ class SecondScreenPresentation(
}
bar.addView(Button(context).apply {
text = "×"
contentDescription = "Close second-screen controls"
contentDescription = context.getString(R.string.deck_close)
minWidth = dp(48)
setOnClickListener { onClose() }
})
bar.addView(TextView(context).apply {
text = "Linux terminal"
text = context.getString(R.string.second_terminal)
textSize = 14f
setTextColor(Color.WHITE)
}, LinearLayout.LayoutParams(0, -2, 1f))
bar.addView(Button(context).apply {
text = "Keyboard"
text = context.getString(R.string.drawer_keyboard)
setOnClickListener { showTerminalKeyboard() }
})
root.addView(bar, LinearLayout.LayoutParams(-1, -2))
@@ -205,7 +206,7 @@ class SecondScreenPresentation(
val session = SessionTerminal.create(terminalClient)
if (session == null) {
root.addView(TextView(context).apply {
text = "The Linux session is not ready for a terminal yet."
text = context.getString(R.string.second_terminal_not_ready)
setTextColor(Color.WHITE)
gravity = Gravity.CENTER
}, LinearLayout.LayoutParams(-1, 0, 1f))
@@ -1,5 +1,7 @@
package com.droiddeck.launcher.ui
import com.droiddeck.launcher.R
import androidx.compose.ui.res.stringResource
import android.view.KeyEvent
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.AnimatedVisibility
@@ -130,7 +132,7 @@ internal fun TabStrip(
val pal = LocalPalette.current
val shape = RoundedCornerShape(12.dp)
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp), modifier = modifier) {
BumperKey("LB", "Previous tab") { onSelect((selected + tabs.size - 1) % tabs.size) }
BumperKey("LB", stringResource(R.string.widgets_prev_tab)) { onSelect((selected + tabs.size - 1) % tabs.size) }
Row(
modifier = Modifier.weight(1f, fill = false).clip(shape).background(colors.surfaceVariant).border(1.dp, pal.line2, shape)
.horizontalScroll(rememberScrollState()).padding(3.dp),
@@ -155,7 +157,7 @@ internal fun TabStrip(
)
}
}
BumperKey("RB", "Next tab") { onSelect((selected + 1) % tabs.size) }
BumperKey("RB", stringResource(R.string.widgets_next_tab)) { onSelect((selected + 1) % tabs.size) }
}
}
@@ -401,6 +403,8 @@ fun ToggleSwitch(checked: Boolean, enabled: Boolean = true, label: String? = nul
val track by animateColorAsState(if (checked) pal.signal else colors.surfaceVariant, Motion.tw(180), label = "switchTrack")
val knob by animateFloatAsState(if (checked) 1f else 0f, Motion.sp(0.7f), label = "switchKnob")
val flip = { onChange(!checked) }
val onLabel = stringResource(R.string.widgets_on)
val offLabel = stringResource(R.string.widgets_off)
val shape = RoundedCornerShape(99.dp)
// 48dp tall to touch; the visible track sits inside it.
Box(
@@ -411,7 +415,7 @@ fun ToggleSwitch(checked: Boolean, enabled: Boolean = true, label: String? = nul
.hoverable(src)
.clickable(interactionSource = src, indication = null, enabled = enabled, role = Role.Switch, onClick = flip)
.controllerConfirm(enabled = enabled, onClick = flip)
.semantics { stateDescription = if (checked) "On" else "Off"; if (label != null) contentDescription = label },
.semantics { stateDescription = if (checked) onLabel else offLabel; if (label != null) contentDescription = label },
) {
Box(
Modifier.size(width = 52.dp, height = 30.dp).clip(shape).background(track)
@@ -435,9 +439,9 @@ fun MultiRow(
) {
val open = host.open == key
val summary = when {
selected.size >= items.size -> "All ${items.size}"
selected.isEmpty() -> "None"
else -> "${selected.size} of ${items.size}"
selected.size >= items.size -> stringResource(R.string.widgets_all_n, items.size)
selected.isEmpty() -> stringResource(R.string.widgets_none)
else -> stringResource(R.string.widgets_n_of_m, selected.size, items.size)
}
SettingsRow(label, hint, highlighted = open) {
Box {
@@ -490,7 +494,7 @@ fun SettingsPage(
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp),
modifier = Modifier.padding(bottom = 6.dp),
) {
BackLink("Back", compact = true, onClick = onBack)
BackLink(stringResource(R.string.mode_back), compact = true, onClick = onBack)
Text(
title, fontSize = 20.sp, fontWeight = FontWeight.Bold, color = colors.onBackground,
maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f),
@@ -502,7 +506,7 @@ fun SettingsPage(
} else {
Rise(0) {
Row(verticalAlignment = Alignment.CenterVertically) {
BackLink("Back", compact = compactLayout, onClick = onBack)
BackLink(stringResource(R.string.mode_back), compact = compactLayout, onClick = onBack)
if (eyebrow != null) {
Spacer(Modifier.width(10.dp))
Eyebrow(eyebrow)
@@ -1,5 +1,7 @@
package com.droiddeck.launcher.ui
import com.droiddeck.launcher.R
import androidx.compose.ui.res.stringResource
import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
@@ -94,7 +96,7 @@ internal fun SteamHome(s: FrontEndState, a: FrontEndActions, modifier: Modifier)
) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) {
Text(
"Steam", fontSize = if (narrow) 34.sp else 44.sp, lineHeight = if (narrow) 40.sp else 50.sp,
stringResource(R.string.rail_steam), fontSize = if (narrow) 34.sp else 44.sp, lineHeight = if (narrow) 40.sp else 50.sp,
fontWeight = FontWeight.Bold, color = colors.onBackground, maxLines = 1,
)
// Said only when something stands between Play and Steam; a ready runtime needs no words.
@@ -103,7 +105,7 @@ internal fun SteamHome(s: FrontEndState, a: FrontEndActions, modifier: Modifier)
Spacer(Modifier.height(18.dp))
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) {
// Enabled without a runtime: the session's loading screen installs it first.
PrimaryButton("Play Steam", enabled = !s.busy, main = true, large = true, icon = Icons.Filled.PlayArrow, onClick = a.onPlay)
PrimaryButton(stringResource(R.string.games_play_steam), enabled = !s.busy, main = true, large = true, icon = Icons.Filled.PlayArrow, onClick = a.onPlay)
Cog(size = 54.dp, onClick = a.onSteamSettings)
}
}