mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
feat(hud): every reading gets its own switch and a row order (#2454)
* feat: every HUD reading has its own switch and a row order * feat: readings get a reorder dialog of their own * refactor: drag alone moves a reading * fix: the readings list is one column with a switch per row * fix: one scrolling readings list, titled HUD info * refactor: derive the readings order from the defaults instead of a second list * fix: the readings dialog loses its doubled title and follows the saved order * refactor: no title in the readings dialog, its actions sit beside the list * refactor: readings dialog actions take the free side on landscape, the foot on portrait * fix: the readings list follows the size it draws and drags with a live gap * fix: the readings dialog fills the window and keeps scrolling under a held drag * fix: reset restores every size's order, and the new HUD strings are translated * refactor: one table for each size's rows and one for its text sizes * refactor: the readings list swaps rows as the drag passes them, and the list animates the rest * refactor: give the readings rows test tags for the local UI test * refactor: HUD readings follow one configurable row table * refactor: the Strip HUD draws its rows from the same table * refactor: each size orders its rows by its own table, and the frame graph is a row * fix: the readings dialog keeps the row order a drag leaves * fix: each size keeps its own row order, and reset clears only the order * refactor: the graph's size lives in one place, and the section markers are gone * fix: a size change and the first save of a legacy config both keep the order * chore: retrigger the build * feat: a reading can be grabbed with Y and shuffled with the d-pad * feat: controller hints float beside the dialog, and a moved row stays in view * feat: Y grabs on a hold and drops on release, and a touch no longer flips the dialog * fix: keep the key hints off the rows on narrow windows, and let Enter toggle a row
This commit is contained in:
1 parent
d8b3c66b95
commit
269d462825
42 files changed
+1322
-625
No files matched your search
@@ -1330,7 +1330,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
selectedSecondScreenDisplay = selectedSecondScreenDisplay,
|
||||
onHud = { on -> SessionPrefs.setHudEnabled(this@SessionActivity, on); hudOn = on; hud.refresh() },
|
||||
onHudSetting = { key, value -> hudConfig = DroidDeckHudConfig.set(this@SessionActivity, key, value); hud.applyConfig() },
|
||||
onHudOrder = { switches, order -> hudConfig = DroidDeckHudConfig.choose(this@SessionActivity, switches, order); hud.applyConfig() },
|
||||
onHudReset = { hudConfig = DroidDeckHudConfig.reset(this@SessionActivity); hud.applyConfig() },
|
||||
onHudOrderReset = { hudConfig = DroidDeckHudConfig.clearOrder(this@SessionActivity); hud.applyConfig() },
|
||||
onHudExport = { exportHudDiagnostics() },
|
||||
onUpscaler = { m ->
|
||||
SessionPrefs.setUpscaler(this@SessionActivity, m); upscaler = m
|
||||
|
||||
@@ -7,15 +7,21 @@ internal object DroidDeckHudConfig {
|
||||
val DEFAULTS: Map<String, String> = linkedMapOf(
|
||||
"hudSize" to "minimal", "hudLocked" to "1", "hudSnap" to "1", "hudScale" to "100", "hudDock" to "none", "hudOpacity" to "80", "hudColor" to "mid",
|
||||
"hudOutline" to "40", "hudOutlineAccent" to "1",
|
||||
"showFPS" to "1", "showFPSGraph" to "1", "showCPUUsage" to "1", "showCPULoad" to "1", "showGPULoad" to "1",
|
||||
"showVram" to "1", "showRAM" to "1", "showPower" to "1", "showTemp" to "1", "showBatteryTemp" to "1",
|
||||
"showGpuTemp" to "0", "showBattery" to "0", "showBatteryTime" to "0", "showLow1" to "1", "showLow01" to "1", "showLow001" to "1", "fpsDecimal" to "1", "showPerCore" to "1",
|
||||
"showSwap" to "1", "showNet" to "1", "showResolution" to "1", "showProton" to "1", "showSession" to "1",
|
||||
"showClock" to "1", "showEngine" to "1", "showRenderer" to "1", "showGpuModel" to "1",
|
||||
"showGpuModel" to "1", "showGPULoad" to "1", "showCPUUsage" to "1", "showCPULoad" to "1",
|
||||
"showPerCore" to "1", "showTemp" to "1", "showBatteryTemp" to "1", "showGpuTemp" to "0",
|
||||
"showVram" to "1", "showRAM" to "1", "showSwap" to "1", "showBattery" to "0", "showBatteryTime" to "0", "showPower" to "1",
|
||||
"showFPS" to "1", "showFPSGraph" to "1", "fpsDecimal" to "1",
|
||||
"showLatency" to "1", "showAvg" to "1", "showLow1" to "1", "showLow01" to "1", "showLow001" to "1",
|
||||
"showEngine" to "1", "showRenderer" to "1",
|
||||
"showDisplay" to "1", "showHdr" to "1", "showNet" to "1", "showResolution" to "1",
|
||||
"showProton" to "1", "showSession" to "1", "showClock" to "1", "hudOrder" to "",
|
||||
"tempUnit" to "c", "tempBands" to "1", "tempAuto" to "1", "tempRedCpu" to "90", "tempRedGpu" to "90", "tempRedBat" to "48",
|
||||
)
|
||||
|
||||
private val TWINS = mapOf("showCPUUsage" to "showCPULoad", "showTemp" to "showBatteryTemp", "showEngine" to "showRenderer")
|
||||
private val NOT_READINGS = setOf("showCPULoad", "showRenderer", "fpsDecimal")
|
||||
|
||||
/** Orders saved before the GPU switch was named after the alias the HUD actually reads. */
|
||||
private val RENAMED = mapOf("showGPU" to "showGPULoad")
|
||||
|
||||
fun load(context: Context): MutableMap<String, String> {
|
||||
val values = LinkedHashMap(DEFAULTS)
|
||||
@@ -36,7 +42,31 @@ internal object DroidDeckHudConfig {
|
||||
val values = load(context)
|
||||
if (key !in DEFAULTS) return values
|
||||
values[key] = value
|
||||
TWINS[key]?.let { values[it] = value }
|
||||
SessionPrefs.setDroidDeckHudConfig(context, encode(values))
|
||||
return values
|
||||
}
|
||||
|
||||
/** Writes several switches and the row order in one go, so the HUD is rebuilt once. */
|
||||
fun choose(context: Context, switches: Map<String, Boolean>, order: List<String>): Map<String, String> {
|
||||
val values = load(context)
|
||||
for ((key, on) in switches) if (key in DEFAULTS) {
|
||||
values[key] = flag(on)
|
||||
}
|
||||
val size = DroidDeckHudSize.from(values["hudSize"])
|
||||
val groups = sizeOrders(values).toMutableMap()
|
||||
if (groups.isEmpty()) {
|
||||
val legacy = legacyOrder(values)
|
||||
if (legacy.isNotEmpty()) for (each in DroidDeckHudSize.values()) groups[each] = legacy.filter { it in each.rows }
|
||||
}
|
||||
groups[size] = order.filter { it in ORDER }
|
||||
values["hudOrder"] = encodeOrders(groups)
|
||||
SessionPrefs.setDroidDeckHudConfig(context, encode(values))
|
||||
return values
|
||||
}
|
||||
|
||||
fun clearOrder(context: Context): Map<String, String> {
|
||||
val values = load(context)
|
||||
values["hudOrder"] = ""
|
||||
SessionPrefs.setDroidDeckHudConfig(context, encode(values))
|
||||
return values
|
||||
}
|
||||
@@ -46,5 +76,37 @@ internal object DroidDeckHudConfig {
|
||||
return DEFAULTS
|
||||
}
|
||||
|
||||
/** Every metric switch, in the order the HUD lists them before the user moves any. Derived from
|
||||
* [DEFAULTS], so a switch added there shows up here without a second list to keep in step. */
|
||||
val ORDER: List<String> = DEFAULTS.keys.filter { it.startsWith("show") && it !in NOT_READINGS }
|
||||
|
||||
/** Only the rows the user moved for [size], in the order they left them. */
|
||||
fun storedOrder(values: Map<String, String>, size: DroidDeckHudSize): List<String> =
|
||||
sizeOrders(values)[size] ?: legacyOrder(values)
|
||||
|
||||
/** Orders saved before each size kept its own: one list, applied to every size. */
|
||||
private fun legacyOrder(values: Map<String, String>): List<String> {
|
||||
val raw = values["hudOrder"].orEmpty()
|
||||
if (raw.isBlank() || raw.contains(':')) return emptyList()
|
||||
return raw.split('|').map { RENAMED[it] ?: it }.filter { it in ORDER }
|
||||
}
|
||||
|
||||
private fun sizeOrders(values: Map<String, String>): Map<DroidDeckHudSize, List<String>> {
|
||||
val raw = values["hudOrder"].orEmpty()
|
||||
if (raw.isBlank()) return emptyMap()
|
||||
val groups = LinkedHashMap<DroidDeckHudSize, List<String>>()
|
||||
for (group in raw.split(';')) {
|
||||
val colon = group.indexOf(':')
|
||||
if (colon <= 0) continue
|
||||
val size = DroidDeckHudSize.values().firstOrNull { it.token == group.substring(0, colon) } ?: continue
|
||||
groups[size] = group.substring(colon + 1).split('|').map { RENAMED[it] ?: it }.filter { it in ORDER }
|
||||
}
|
||||
return groups
|
||||
}
|
||||
|
||||
private fun encodeOrders(groups: Map<DroidDeckHudSize, List<String>>): String =
|
||||
groups.entries.filter { it.value.isNotEmpty() }
|
||||
.joinToString(";") { "${it.key.token}:${it.value.joinToString("|")}" }
|
||||
|
||||
private fun flag(on: Boolean) = if (on) "1" else "0"
|
||||
}
|
||||
@@ -13,6 +13,27 @@
|
||||
|
||||
package com.droiddeck.launcher.hud
|
||||
|
||||
/**
|
||||
* Size modes for the DroidDeck HUD (the 4th selectable in-game overlay style). One shared color-coded
|
||||
* visual language, four amounts of detail — see the approved mockup. The config value is the lower-case
|
||||
* token stored under the `hudSize` key; the label is the user-facing string.
|
||||
*/
|
||||
/** The text sizes and spacing a [DroidDeckHudSize] lays its rows out with, in sp. */
|
||||
data class DroidDeckHudStyle(
|
||||
val row: Float,
|
||||
val unit: Float,
|
||||
val pad: Float,
|
||||
val lineGap: Float,
|
||||
val labelGap: Float,
|
||||
val key: Float = 0f,
|
||||
val sub: Float = 0f,
|
||||
val foot: Float = 0f,
|
||||
val band: Float = 0f,
|
||||
val gutter: Float = 0f,
|
||||
val tileGap: Float = 0f,
|
||||
val innerPad: Float = 0f,
|
||||
)
|
||||
|
||||
enum class DroidDeckHudSize(val token: String, val label: String) {
|
||||
FULL("full", "Full"),
|
||||
TILES("tiles", "Tiles"),
|
||||
@@ -26,27 +47,73 @@ enum class DroidDeckHudSize(val token: String, val label: String) {
|
||||
return all[(ordinal + 1) % all.size]
|
||||
}
|
||||
|
||||
fun supportedChips(): Set<String> = when (this) {
|
||||
MINIMAL -> MINIMAL_CHIPS
|
||||
PILL -> PILL_CHIPS
|
||||
FULL, TILES, STRIP -> STANDARD_CHIPS
|
||||
MEGA -> MEGA_CHIPS
|
||||
}
|
||||
/**
|
||||
* The rows this size draws, in the order it draws them before the user moves any. This is the single
|
||||
* source of truth for both surfaces: [DroidDeckHudView] draws exactly these and the settings screen
|
||||
* offers exactly these. A switch outside the set is ignored by the size, so the two cannot drift.
|
||||
*/
|
||||
val rows: List<String> get() = ROWS.getValue(this)
|
||||
|
||||
/** This size's rows: the ones the user moved first, then the rest in the order [rows] lists them. */
|
||||
fun rowsIn(stored: List<String>): List<String> =
|
||||
stored.filter { it in rows } + rows.filter { it !in stored }
|
||||
/**
|
||||
* The numbers each size sets its text in, in sp. One table so a size's scale can be read (and changed)
|
||||
* in one place instead of hunting the `sp(...)` literals scattered through its builder.
|
||||
*/
|
||||
val style: DroidDeckHudStyle get() = STYLE.getValue(this)
|
||||
|
||||
|
||||
companion object {
|
||||
fun from(token: String?): DroidDeckHudSize =
|
||||
values().firstOrNull { it.token.equals(token, ignoreCase = true) } ?: FULL
|
||||
|
||||
val MINIMAL_CHIPS = setOf("FPS", "Battery time", "FPS graph", "1% low", "0.1% low", "0.01% low", "FPS .1", "Engine", "Clock")
|
||||
val PILL_CHIPS = setOf("FPS", "Battery time", "FPS graph", "GPU", "CPU", "VRAM", "RAM", "Battery", "GPU model", "FPS .1", "Engine", "Clock")
|
||||
val STANDARD_CHIPS = setOf(
|
||||
"FPS", "FPS graph", "GPU", "GPU temp", "CPU", "VRAM", "RAM", "Power", "Temp",
|
||||
"Battery", "Battery time", "GPU model", "Engine", "1% low", "0.1% low", "0.01% low", "FPS .1", "Clock",
|
||||
private val EXTRAS = setOf("showClock")
|
||||
|
||||
val ROWS: Map<DroidDeckHudSize, List<String>> = mapOf(
|
||||
FULL to listOf(
|
||||
"showFPS", "showFPSGraph", "showGpuModel", "showDisplay", "showHdr", "showGPULoad", "showGpuTemp",
|
||||
"showCPUUsage", "showTemp", "showVram", "showRAM", "showBattery", "showBatteryTemp", "showBatteryTime",
|
||||
"showPower", "showLatency", "showAvg", "showLow1", "showLow01", "showLow001",
|
||||
),
|
||||
TILES to listOf(
|
||||
"showFPS", "showFPSGraph", "showLatency", "showGPULoad", "showGpuTemp", "showCPUUsage", "showTemp",
|
||||
"showVram", "showRAM", "showEngine", "showDisplay", "showHdr", "showAvg", "showLow1",
|
||||
"showLow01", "showLow001", "showGpuModel", "showBattery", "showBatteryTemp", "showBatteryTime", "showPower",
|
||||
),
|
||||
PILL to listOf(
|
||||
"showFPS", "showFPSGraph", "showGpuModel", "showGPULoad", "showGpuTemp", "showCPUUsage", "showTemp",
|
||||
"showRAM", "showBattery", "showBatteryTemp", "showBatteryTime", "showPower", "showLatency", "showDisplay",
|
||||
"showVram", "showHdr",
|
||||
),
|
||||
MINIMAL to listOf(
|
||||
"showFPS", "showBatteryTime", "showFPSGraph", "showLow1", "showLow01", "showLow001", "showAvg", "showLatency",
|
||||
"showEngine", "showDisplay", "showHdr",
|
||||
),
|
||||
MEGA to DroidDeckHudConfig.ORDER.filter { it !in EXTRAS },
|
||||
STRIP to listOf(
|
||||
"showFPS", "showFPSGraph", "showLow1", "showLow01", "showLow001", "showGPULoad", "showGpuTemp",
|
||||
"showCPUUsage", "showTemp", "showVram", "showRAM", "showBattery", "showBatteryTemp", "showBatteryTime",
|
||||
"showPower", "showDisplay", "showHdr", "showGpuModel",
|
||||
),
|
||||
)
|
||||
val MEGA_ONLY = setOf(
|
||||
"Per-core", "Swap", "Network", "Resolution", "Proton", "Wrapper", "DX ver", "Session",
|
||||
|
||||
|
||||
val STYLE: Map<DroidDeckHudSize, DroidDeckHudStyle> = mapOf(
|
||||
FULL to DroidDeckHudStyle(row = 12f, unit = 12f * 0.62f, pad = 10f, lineGap = 4f, labelGap = 8f),
|
||||
TILES to DroidDeckHudStyle(row = 18f, unit = 11f, pad = 9f, lineGap = 4f, labelGap = 8f,
|
||||
key = 10f, sub = 10f, tileGap = 6f, innerPad = 8f),
|
||||
PILL to DroidDeckHudStyle(row = 30f, unit = 30f * 0.36f, pad = 10f, lineGap = 3f, labelGap = 12f,
|
||||
sub = 11.5f),
|
||||
MINIMAL to DroidDeckHudStyle(row = 34f, unit = 34f * 0.32f, pad = 10f, lineGap = 4f, labelGap = 8f,
|
||||
sub = 11.5f, foot = 9.5f),
|
||||
MEGA to DroidDeckHudStyle(row = 11.5f, unit = 11.5f * 0.62f, pad = 10f, lineGap = 3.5f, labelGap = 7f,
|
||||
band = 9.5f, gutter = 16f),
|
||||
STRIP to DroidDeckHudStyle(row = 11.5f, unit = 11.5f * 0.8f, pad = 10f, lineGap = 0f, labelGap = 13f),
|
||||
)
|
||||
val MEGA_CHIPS = STANDARD_CHIPS + MEGA_ONLY
|
||||
|
||||
fun rowsFor(size: DroidDeckHudSize, values: Map<String, String>): List<String> =
|
||||
size.rowsIn(DroidDeckHudConfig.storedOrder(values, size))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
|
||||
private val density = resources.displayMetrics.density
|
||||
|
||||
private var cfg: KeyValueSet = KeyValueSet()
|
||||
private var size = DroidDeckHudSize.FULL
|
||||
private var scale = 1f
|
||||
private var bgOpacity = 0.8f
|
||||
@@ -87,7 +88,6 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
private var showVram = true
|
||||
private var showRAM = true
|
||||
private var showBattery = true
|
||||
private var showBatteryTime = true
|
||||
private var showPower = true
|
||||
private var showBatteryTemp = false
|
||||
private var showGraph = false
|
||||
@@ -96,13 +96,16 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
private var showLow001 = true
|
||||
private var fpsDecimal = true
|
||||
private var showClockTime = true
|
||||
private var showLatency = true
|
||||
private var showAvg = true
|
||||
private var showDisplay = true
|
||||
private var showHdr = true
|
||||
private var storedOrder: List<String> = emptyList()
|
||||
private var showPerCore = true
|
||||
private var showSwap = true
|
||||
private var showNet = true
|
||||
private var showResolution = true
|
||||
private var showProton = true
|
||||
private var showWrapper = true
|
||||
private var showDxVer = true
|
||||
private var showSession = true
|
||||
|
||||
private var engineLabel = ""
|
||||
@@ -178,7 +181,7 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
fun moved(dx: Float, dy: Float) = Glyph(x + dx, baseline + dy, text, color, sizePx, glow)
|
||||
}
|
||||
private class Span(val text: String, val color: Int, val sizePx: Float, val glow: Boolean = false)
|
||||
private class HudRow(val label: Span, val vals: List<Span>, val inline: Boolean = false)
|
||||
private class HudRow(val key: String, val label: Span, val vals: List<Span>, val inline: Boolean = false)
|
||||
private val glyphs = ArrayList<Glyph>()
|
||||
private val tileRects = ArrayList<RectF>()
|
||||
private var graphRect: RectF? = null
|
||||
@@ -290,42 +293,52 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
|
||||
private fun cycleSize() {
|
||||
size = size.next()
|
||||
refreshOrder()
|
||||
onSizeCycledListener?.accept(size.token)
|
||||
rebuildAndInvalidate()
|
||||
}
|
||||
|
||||
private fun refreshOrder() {
|
||||
storedOrder = DroidDeckHudConfig.storedOrder(mapOf("hudOrder" to cfg.get("hudOrder", "")), size)
|
||||
}
|
||||
|
||||
private fun switchOn(key: String): Boolean =
|
||||
cfg.get(key, DroidDeckHudConfig.DEFAULTS[key] ?: "1") == "1"
|
||||
|
||||
fun applyConfig(configString: String?) {
|
||||
if (configString.isNullOrEmpty()) return
|
||||
val cfg = KeyValueSet(configString)
|
||||
cfg = KeyValueSet(configString)
|
||||
|
||||
size = DroidDeckHudSize.from(cfg.get("hudSize", "minimal"))
|
||||
showFPS = cfg.get("showFPS", "1") == "1"
|
||||
showEngine = cfg.get("showEngine", "1") == "1"
|
||||
showGpuModel = cfg.get("showGpuModel", "1") == "1"
|
||||
showCPU = cfg.get("showCPUUsage", cfg.get("showCPULoad", "1")) == "1"
|
||||
showGPU = cfg.get("showGPULoad", "1") == "1"
|
||||
showCpuTemp = cfg.get("showTemp", "1") == "1"
|
||||
showGpuTemp = cfg.get("showGpuTemp", "0") == "1"
|
||||
showVram = cfg.get("showVram", "1") == "1"
|
||||
showRAM = cfg.get("showRAM", "1") == "1"
|
||||
showBattery = cfg.get("showBattery", "1") == "1"
|
||||
showBatteryTime = cfg.get("showBatteryTime", "1") == "1"
|
||||
showPower = cfg.get("showPower", "1") == "1"
|
||||
showBatteryTemp = cfg.get("showBatteryTemp", "0") == "1"
|
||||
showGraph = cfg.get("showFPSGraph", "0") == "1"
|
||||
showLow1 = cfg.get("showLow1", "1") == "1"
|
||||
showLow01 = cfg.get("showLow01", "1") == "1"
|
||||
showLow001 = cfg.get("showLow001", "1") == "1"
|
||||
showFPS = switchOn("showFPS")
|
||||
showEngine = switchOn("showEngine")
|
||||
showGpuModel = switchOn("showGpuModel")
|
||||
showCPU = switchOn("showCPUUsage")
|
||||
showGPU = switchOn("showGPULoad")
|
||||
showCpuTemp = switchOn("showTemp")
|
||||
showGpuTemp = switchOn("showGpuTemp")
|
||||
showVram = switchOn("showVram")
|
||||
showRAM = switchOn("showRAM")
|
||||
showBattery = switchOn("showBattery")
|
||||
showPower = switchOn("showPower")
|
||||
showBatteryTemp = switchOn("showBatteryTemp")
|
||||
showGraph = switchOn("showFPSGraph")
|
||||
showLow001 = switchOn("showLow001")
|
||||
fpsDecimal = cfg.get("fpsDecimal", "1") == "1"
|
||||
showClockTime = cfg.get("showClock", "1") == "1"
|
||||
showPerCore = cfg.get("showPerCore", "1") == "1"
|
||||
showSwap = cfg.get("showSwap", "1") == "1"
|
||||
showNet = cfg.get("showNet", "1") == "1"
|
||||
showResolution = cfg.get("showResolution", "1") == "1"
|
||||
showProton = cfg.get("showProton", "1") == "1"
|
||||
showWrapper = cfg.get("showWrapper", "1") == "1"
|
||||
showDxVer = cfg.get("showDxVer", "1") == "1"
|
||||
showSession = cfg.get("showSession", "1") == "1"
|
||||
showClockTime = switchOn("showClock")
|
||||
showLatency = switchOn("showLatency")
|
||||
showAvg = switchOn("showAvg")
|
||||
showLow1 = switchOn("showLow1")
|
||||
showLow01 = switchOn("showLow01")
|
||||
showDisplay = switchOn("showDisplay")
|
||||
showHdr = switchOn("showHdr")
|
||||
refreshOrder()
|
||||
showPerCore = switchOn("showPerCore")
|
||||
showSwap = switchOn("showSwap")
|
||||
showNet = switchOn("showNet")
|
||||
showResolution = switchOn("showResolution")
|
||||
showProton = switchOn("showProton")
|
||||
showSession = switchOn("showSession")
|
||||
tempDisplay = HudMetrics.TempDisplay.from(cfg)
|
||||
lockController.setLocked(cfg.get("hudLocked", "1") == "1")
|
||||
dock = DroidDeckHudDock.from(cfg.get("hudDock", "none"))
|
||||
@@ -460,6 +473,8 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
return w
|
||||
}
|
||||
|
||||
private fun showHdrLine(): Boolean = showHdr && hdrState != DroidDeckHudHdr.NONE
|
||||
|
||||
private fun placeRun(startX: Float, baseline: Float, spans: List<Span>, glow: Boolean = false): Float {
|
||||
var x = startX
|
||||
for (s in spans) {
|
||||
@@ -541,13 +556,15 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
val s = snap
|
||||
if (s == null) { contentW = 0f; contentH = 0f; return }
|
||||
if (dock != DroidDeckHudDock.NONE) { buildDockTab(); return }
|
||||
if (size == DroidDeckHudSize.STRIP) { buildStrip(s); return }
|
||||
buildRows(s)
|
||||
if (contentW <= 0f || contentH <= 0f) return
|
||||
if (size == DroidDeckHudSize.PILL) addSubtleClock(sp(10f), leftAligned = true)
|
||||
val pad = sp(size.style.pad)
|
||||
when (size) {
|
||||
DroidDeckHudSize.FULL -> { buildFull(s); intoPanel(sp(10f), header = true) }
|
||||
DroidDeckHudSize.TILES -> { buildTiles(s); intoPanel(sp(9f), header = true) }
|
||||
DroidDeckHudSize.PILL -> { buildPill(s); intoPanel(sp(10f), header = false) }
|
||||
DroidDeckHudSize.MINIMAL -> buildMinimal(s)
|
||||
DroidDeckHudSize.MEGA -> { buildMega(s); intoPanel(sp(10f), header = true) }
|
||||
DroidDeckHudSize.STRIP -> buildStrip(s)
|
||||
DroidDeckHudSize.MINIMAL -> intoPanel(pad, header = true, halfRound = true)
|
||||
DroidDeckHudSize.PILL -> intoPanel(pad, header = false)
|
||||
else -> intoPanel(pad, header = true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -617,7 +634,12 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
return Pair(dDividerTop + max(1f, density), x)
|
||||
}
|
||||
|
||||
private fun intoPanel(pad: Float, header: Boolean) {
|
||||
/**
|
||||
* Moves a size's content, laid out from [pad] at the origin, into the panel: under the header, or after
|
||||
* the logo chip on the Pill. Lines that start on the content's left edge are lined up by their ink, so
|
||||
* the logo, labels and numbers share one edge.
|
||||
*/
|
||||
private fun intoPanel(pad: Float, header: Boolean, halfRound: Boolean = !header) {
|
||||
if (contentW <= 0f || contentH <= 0f) return
|
||||
for (i in glyphs.indices) {
|
||||
val g = glyphs[i]
|
||||
@@ -643,7 +665,7 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
val panel = RectF(panelLeft(), panelInset(), max(contentW - pad + dx, headerRight) + sp(18f),
|
||||
contentH - pad + dy + sp(10f) + stroke)
|
||||
chipRect?.let { it.offsetTo(it.left, panel.centerY() - it.height() / 2f) }
|
||||
finishPanel(panel, halfRound = !header)
|
||||
finishPanel(panel, halfRound = halfRound)
|
||||
}
|
||||
|
||||
private fun finishPanel(panel: RectF, halfRound: Boolean) {
|
||||
@@ -714,289 +736,188 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
contentW = max(contentW, pad + w + pad)
|
||||
}
|
||||
|
||||
private fun hasGpuStats(s: HudMetrics.Snapshot): Boolean =
|
||||
s.gpuPercent != null || s.gpuTempC != null || s.gpuClockMhz != null
|
||||
|
||||
private fun buildFull(s: HudMetrics.Snapshot) {
|
||||
val rowPx = sp(12f); val unitPx = rowPx * 0.62f
|
||||
val pad = sp(10f); val lineGap = sp(4f); val lvGap = sp(8f)
|
||||
val rows = ArrayList<HudRow>()
|
||||
|
||||
if (showGpuModel && gpuNameText().isNotBlank())
|
||||
rows.add(HudRow(Span("GPU", colGpu, rowPx), gpuModelSpans(rowPx, colValue)))
|
||||
if (displayServer.isNotBlank())
|
||||
rows.add(HudRow(Span("DISP", colDisp, rowPx), listOf(Span(displayServer, colValue, rowPx))))
|
||||
if (hdrState != DroidDeckHudHdr.NONE)
|
||||
rows.add(HudRow(Span("HDR", colHdr, rowPx), hdrValue(rowPx)))
|
||||
if (showGPU && hasGpuStats(s)) {
|
||||
val v = ArrayList<Span>()
|
||||
v += numUnit(s.gpuPercent?.toString(), "%", rowPx, unitPx)
|
||||
if (showGpuTemp) tempSpans(s.gpuTempC, HudMetrics.TempSensor.GPU, rowPx, unitPx)
|
||||
.let { if (it.isNotEmpty()) { v += gap(unitPx); v += it } }
|
||||
v += gap(unitPx); v += numUnit(s.gpuClockMhz?.toString(), "MHz", rowPx, unitPx)
|
||||
rows.add(HudRow(Span("GPU", colGpu, rowPx), v))
|
||||
}
|
||||
if (showCPU) {
|
||||
val v = ArrayList<Span>()
|
||||
v += numUnit(s.cpuPercent?.toString(), "%", rowPx, unitPx)
|
||||
v += gap(unitPx); v += numUnit(s.cpuClockMhz?.toString(), "MHz", rowPx, unitPx)
|
||||
if (showCpuTemp) tempSpans(s.cpuTempC, HudMetrics.TempSensor.CPU, rowPx, unitPx)
|
||||
.let { if (it.isNotEmpty()) { v += gap(unitPx); v += it } }
|
||||
rows.add(HudRow(Span("CPU", colCpu, rowPx), v))
|
||||
}
|
||||
if (showVram && s.vramText() != null)
|
||||
rows.add(HudRow(Span("VRAM", colVram, rowPx), valueUnit(s.vramText()!!, rowPx, unitPx)))
|
||||
if (showRAM) {
|
||||
val v = ArrayList<Span>()
|
||||
v += valueUnit(s.ramUsedText(), rowPx, unitPx)
|
||||
v += gap(unitPx); v += numUnit(s.ramPercent.roundToInt().toString(), "%", rowPx, unitPx)
|
||||
rows.add(HudRow(Span("RAM", colRam, rowPx), v))
|
||||
}
|
||||
if (showBattery || showPower || showBatteryTemp) {
|
||||
val v = ArrayList<Span>(); var any = false
|
||||
if (showBattery && s.battery.percent != null) { v += numUnit(s.battery.percent.toString(), "%", rowPx, unitPx); any = true }
|
||||
if (showBatteryTemp) tempSpans(s.battery.tempC, HudMetrics.TempSensor.BATTERY, rowPx, unitPx)
|
||||
.let { if (it.isNotEmpty()) { if (any) v += gap(unitPx); v += it; any = true } }
|
||||
if (showPower && s.battery.watts > 0f) { if (any) v += gap(unitPx); v += numUnit(fmt1(s.battery.watts), "W", rowPx, unitPx); any = true }
|
||||
if (any) rows.add(HudRow(Span("BAT", colBat, rowPx), v))
|
||||
}
|
||||
if (showBatteryTime) rows.add(HudRow(Span("TIME", colBat, rowPx), listOf(Span(s.battery.runtimeText ?: "—", colValue, rowPx))))
|
||||
if (showFPS) {
|
||||
val v = ArrayList<Span>()
|
||||
v += glowing(numUnit(fpsText(fpsNow), "FPS", rowPx, unitPx))
|
||||
v += gap(unitPx); v += numUnit(fmt1(1000f / max(fpsNow, 1f)), "ms", rowPx, unitPx)
|
||||
rows.add(HudRow(Span(apiLabel(), colFps, rowPx), v))
|
||||
rows.add(HudRow(Span("AVG", colLo, rowPx), numUnit(fmt1(fpsAvg), "FPS", rowPx, unitPx)))
|
||||
if (showLow1)
|
||||
rows.add(HudRow(Span("1%", colLo, rowPx), numUnit(lowText(lows.low1Fps), "FPS", rowPx, unitPx)))
|
||||
if (showLow01)
|
||||
rows.add(HudRow(Span("0.1%", colLo, rowPx), numUnit(lowText(lows.low01Fps), "FPS", rowPx, unitPx)))
|
||||
if (showLow001)
|
||||
rows.add(HudRow(Span("0.01%", colLo, rowPx), numUnit(lowText(lows.low001Fps), "FPS", rowPx, unitPx)))
|
||||
}
|
||||
|
||||
var labelCol = 0f
|
||||
for (r in rows) if (!r.inline) labelCol = max(labelCol, measure(r.label.text, rowPx))
|
||||
val h = lineH(rowPx); val asc = ascent(rowPx)
|
||||
var y = pad; var maxRight = pad
|
||||
for (r in rows) {
|
||||
val baseline = y - asc
|
||||
placeRun(pad, baseline, listOf(r.label))
|
||||
val valX = if (r.inline) pad + measure(r.label.text, rowPx) + lvGap
|
||||
else pad + labelCol + lvGap
|
||||
val end = placeRun(valX, baseline, r.vals)
|
||||
maxRight = max(maxRight, end)
|
||||
y += h + lineGap
|
||||
}
|
||||
|
||||
if (showFPS && showGraph) {
|
||||
val ftPx = unitPx * 1.15f
|
||||
val baseline = y - asc
|
||||
placeRun(pad, baseline, listOf(Span("Frametime", colFps, ftPx)))
|
||||
val stat = "min:${fmt1(graphMinMs)} max:${fmt1(graphMaxMs)}"
|
||||
val statX = pad + max(labelCol, measure("Frametime", ftPx)) + lvGap
|
||||
val end = placeRun(statX, baseline, listOf(Span(stat, colDim, unitPx)))
|
||||
maxRight = max(maxRight, end)
|
||||
y += h + lineGap
|
||||
val gh = sp(22f)
|
||||
val right = max(maxRight, pad + sp(160f))
|
||||
graphRect = RectF(pad, y, right, y + gh)
|
||||
maxRight = max(maxRight, right)
|
||||
y += gh
|
||||
}
|
||||
|
||||
contentW = maxRight + pad
|
||||
contentH = y + pad
|
||||
addSubtleClock(pad)
|
||||
private fun switchLabel(key: String): Pair<String, Int> = when (key) {
|
||||
"showGpuModel" -> "MODEL" to colGpu
|
||||
"showGPULoad" -> "GPU" to colGpu
|
||||
"showGpuTemp" -> "GPU.T" to colGpu
|
||||
"showCPUUsage" -> "CPU" to colCpu
|
||||
"showTemp" -> "CPU.T" to colCpu
|
||||
"showBatteryTemp" -> "BAT.T" to colBat
|
||||
"showPower" -> "PWR" to colBat
|
||||
"showBattery" -> "BAT" to colBat
|
||||
"showBatteryTime" -> "BAT TIME" to colBat
|
||||
"showVram" -> "VRAM" to colVram
|
||||
"showRAM" -> "RAM" to colRam
|
||||
"showSwap" -> "SWP" to colRam
|
||||
"showNet" -> "NET" to colFps
|
||||
"showPerCore" -> "CORE" to colCpu
|
||||
"showFPS" -> "FPS" to colFps
|
||||
"showLatency" -> "MS" to colDim
|
||||
"showAvg" -> "AVG" to colLo
|
||||
"showLow1" -> "1%" to colLo
|
||||
"showLow01" -> "0.1%" to colLo
|
||||
"showLow001" -> "0.01%" to colLo
|
||||
"showEngine" -> "API" to colFps
|
||||
"showDisplay" -> "DISP" to colDisp
|
||||
"showHdr" -> "HDR" to colHdr
|
||||
"showResolution" -> "RES" to colDim
|
||||
"showProton" -> "PROTON" to colVram
|
||||
"showSession" -> "TIME" to colDim
|
||||
else -> key.removePrefix("show") to colDim
|
||||
}
|
||||
|
||||
private fun buildTiles(s: HudMetrics.Snapshot) {
|
||||
val keyPx = sp(10f); val valPx = sp(18f); val subPx = sp(10f); val unitPx = sp(11f)
|
||||
val pad = sp(9f); val innerPad = sp(8f); val tileGap = sp(6f); val lineGap = sp(4f)
|
||||
|
||||
class Tile(val key: String, val keyColor: Int, val value: List<Span>, val sub: String?, val wide: Boolean)
|
||||
val tiles = ArrayList<Tile>()
|
||||
|
||||
if (showFPS) tiles.add(Tile("FPS", colFps, listOf(Span(fpsText(fpsNow), colValue, valPx, glow = true)),
|
||||
"${fmt1(fpsAvg)} avg" + (if (showLow1) " · ${lowText(lows.low1Fps) ?: "—"} 1%" else ""), false))
|
||||
if (showFPS) tiles.add(Tile("FRAME", colDim, numUnit(fmt1(1000f / max(fpsNow, 1f)), "ms", valPx, unitPx),
|
||||
"${fmt1(graphMinMs)} – ${fmt1(graphMaxMs)}", false))
|
||||
if (showGPU && hasGpuStats(s)) tiles.add(Tile("GPU", colGpu, numUnit(s.gpuPercent?.toString(), "%", valPx, unitPx),
|
||||
if (showGpuTemp && s.gpuTempC != null) HudMetrics.formatTemp(s.gpuTempC.toFloat(), tempDisplay, false)
|
||||
else s.gpuClockMhz?.let { "${it}MHz" }, false))
|
||||
if (showCPU) tiles.add(Tile("CPU", colCpu, numUnit(s.cpuPercent?.toString(), "%", valPx, unitPx),
|
||||
listOfNotNull(s.cpuClockMhz?.let { "${it}MHz" },
|
||||
if (showCpuTemp) s.cpuTempC?.let { HudMetrics.formatTemp(it.toFloat(), tempDisplay, false) } else null)
|
||||
.joinToString(" · ").ifBlank { null }, false))
|
||||
if (showVram && s.vramText() != null) tiles.add(Tile("VRAM", colVram, valueUnit(s.vramText()!!, valPx, unitPx), null, false))
|
||||
if (showRAM) tiles.add(Tile("RAM", colRam, numUnit(s.ramPercent.roundToInt().toString(), "%", valPx, unitPx),
|
||||
"${s.ramUsedText()} / ${s.ramTotalText()}", false))
|
||||
if (showEngine && engineLabel.isNotBlank())
|
||||
tiles.add(Tile("API", colFps, listOf(Span(engineLabel, colValue, valPx)),
|
||||
dxVersion().ifBlank { null }, false))
|
||||
if (displayServer.isNotBlank())
|
||||
tiles.add(Tile("DISPLAY", colDisp, listOf(Span(displayServer, colValue, valPx)),
|
||||
if (hdrState != DroidDeckHudHdr.NONE) hdrText() else null, false))
|
||||
if (showGpuModel && gpuNameText().isNotBlank())
|
||||
tiles.add(Tile("GPU", colGpu, gpuModelSpans(valPx, colValue), null, true))
|
||||
if (showBattery || showPower || showBatteryTemp) {
|
||||
val parts = ArrayList<Span>(); var any = false
|
||||
if (showBattery && s.battery.percent != null) { parts += numUnit(s.battery.percent.toString(), "%", valPx, unitPx); any = true }
|
||||
if (showBatteryTemp && s.battery.tempC != null) { if (any) parts += Span(" · ", colDim, subPx); parts += tempSpans(s.battery.tempC, HudMetrics.TempSensor.BATTERY, valPx, unitPx); any = true }
|
||||
if (showPower && s.battery.watts > 0f) { if (any) parts += Span(" · ", colDim, subPx); parts += numUnit(fmt1(s.battery.watts), "W", valPx, unitPx); any = true }
|
||||
if (any) tiles.add(Tile("BAT", colBat, parts, null, true))
|
||||
private fun reading(key: String, s: HudMetrics.Snapshot, labelPx: Float, valuePx: Float, unitPx: Float): HudRow {
|
||||
if (key == "showFPSGraph") return HudRow(key, Span("", colDim, 0f), emptyList())
|
||||
val (label, color) = switchLabel(key)
|
||||
val values: List<Span> = when (key) {
|
||||
"showGpuModel" -> if (gpuNameText().isBlank()) numUnit(null, "", valuePx, unitPx)
|
||||
else gpuModelSpans(valuePx, colValue)
|
||||
"showGPULoad" -> numUnit(s.gpuPercent?.toString(), "%", valuePx, unitPx)
|
||||
"showGpuTemp" -> tempSpans(s.gpuTempC, HudMetrics.TempSensor.GPU, valuePx, unitPx)
|
||||
"showCPUUsage" -> numUnit(s.cpuPercent?.toString(), "%", valuePx, unitPx)
|
||||
"showTemp" -> tempSpans(s.cpuTempC, HudMetrics.TempSensor.CPU, valuePx, unitPx)
|
||||
"showBatteryTemp" -> tempSpans(s.battery.tempC, HudMetrics.TempSensor.BATTERY, valuePx, unitPx)
|
||||
"showPower" -> numUnit(if (s.battery.watts > 0f) fmt1(s.battery.watts) else null, "W", valuePx, unitPx)
|
||||
"showBattery" -> numUnit(s.battery.percent?.toString(), "%", valuePx, unitPx)
|
||||
"showBatteryTime" -> valueUnit(s.battery.runtimeText ?: "—", valuePx, unitPx)
|
||||
"showVram" -> valueUnit(s.vramText() ?: "—", valuePx, unitPx)
|
||||
"showRAM" -> numUnit(s.ramPercent.roundToInt().toString(), "%", valuePx, unitPx)
|
||||
"showSwap" -> valueUnit(s.swapUsedText() ?: "—", valuePx, unitPx)
|
||||
"showNet" -> listOf(
|
||||
Span("↓", colDim, unitPx), Span(((s.netDownBps ?: 0L) / 1024L).toString(), colValue, valuePx),
|
||||
Span(" ↑", colDim, unitPx), Span(((s.netUpBps ?: 0L) / 1024L).toString(), colValue, valuePx),
|
||||
)
|
||||
"showPerCore" -> listOf(Span(s.perCorePercent.size.toString(), colValue, valuePx))
|
||||
"showFPS" -> glowing(numUnit(fpsText(fpsNow), "", valuePx, unitPx))
|
||||
"showLatency" -> numUnit(fmt1(1000f / max(fpsNow, 1f)), "ms", valuePx, unitPx)
|
||||
"showAvg" -> numUnit(fmt1(fpsAvg), "", valuePx, unitPx)
|
||||
"showLow1" -> numUnit(lowText(lows.low1Fps), "", valuePx, unitPx)
|
||||
"showLow01" -> numUnit(lowText(lows.low01Fps), "", valuePx, unitPx)
|
||||
"showLow001" -> numUnit(lowText(lows.low001Fps), "", valuePx, unitPx)
|
||||
"showEngine" -> listOf(Span(engineLabel.ifBlank { "—" }, colValue, valuePx))
|
||||
"showDisplay" -> listOf(Span(displayServer.ifBlank { "—" }, colDisp, valuePx))
|
||||
"showHdr" -> if (showHdrLine()) hdrValue(valuePx) else listOf(Span("off", colDim, valuePx))
|
||||
"showResolution" -> listOf(Span(resolutionString(), colValue, valuePx))
|
||||
"showProton" -> listOf(Span(wineVersion.ifBlank { "—" }, colVram, valuePx))
|
||||
"showSession" -> listOf(Span(elapsedString(), colValue, valuePx))
|
||||
else -> listOf(Span("—", colDim, valuePx))
|
||||
}
|
||||
if (showBatteryTime) tiles.add(Tile("BAT TIME", colBat, listOf(Span(s.battery.runtimeText ?: "—", colValue, valPx)), "", true))
|
||||
if (tiles.isEmpty()) { contentW = 0f; contentH = 0f; return }
|
||||
return HudRow(key, Span(label, color, labelPx), values.ifEmpty { listOf(Span("—", colDim, valuePx)) })
|
||||
}
|
||||
|
||||
val keyH = lineH(keyPx); val valH = lineH(valPx); val subH = lineH(subPx)
|
||||
fun tileW(t: Tile) = max(max(measure(t.key, keyPx), runWidth(t.value)),
|
||||
t.sub?.let { measure(it, subPx) } ?: 0f) + innerPad * 2
|
||||
var normalW = 0f
|
||||
for (t in tiles) if (!t.wide) normalW = max(normalW, tileW(t))
|
||||
if (normalW == 0f) for (t in tiles) normalW = max(normalW, tileW(t) / 2f)
|
||||
val tileH = innerPad * 2 + keyH + lineGap + valH + lineGap + subH
|
||||
val fullW = normalW * 2 + tileGap
|
||||
private fun buildRows(s: HudMetrics.Snapshot) {
|
||||
val st = size.style
|
||||
val pad = sp(st.pad); val lineGap = sp(st.lineGap); val lvGap = sp(st.labelGap)
|
||||
val gutter = sp(if (st.gutter > 0f) st.gutter else 14f)
|
||||
val unitPx = sp(if (st.unit > 0f) st.unit else st.row * 0.62f)
|
||||
val basePx = sp(if (st.sub > 0f) st.sub else st.row)
|
||||
|
||||
var x = pad; var y = pad; var col = 0
|
||||
fun place(t: Tile, tx: Float, ty: Float, tw: Float) {
|
||||
tileRects.add(RectF(tx, ty, tx + tw, ty + tileH))
|
||||
var by = ty + innerPad - ascent(keyPx)
|
||||
placeRun(tx + innerPad, by, listOf(Span(t.key, t.keyColor, keyPx)))
|
||||
by = ty + innerPad + keyH + lineGap - ascent(valPx)
|
||||
placeRun(tx + innerPad, by, t.value)
|
||||
if (t.sub != null) {
|
||||
by = ty + innerPad + keyH + lineGap + valH + lineGap - ascent(subPx)
|
||||
placeRun(tx + innerPad, by, listOf(Span(t.sub, colDim, subPx)))
|
||||
val keys = size.rowsIn(storedOrder).filter { switchOn(it) }
|
||||
if (keys.isEmpty()) { contentW = 0f; contentH = 0f; return }
|
||||
val hero = (size == DroidDeckHudSize.PILL || size == DroidDeckHudSize.MINIMAL) && keys.firstOrNull() == "showFPS"
|
||||
val tiles = size == DroidDeckHudSize.TILES
|
||||
val bigPx = sp(st.row); val bigUnitPx = sp(st.unit)
|
||||
val heroSpans = listOf(
|
||||
Span(fpsText(fpsNow), colValue, bigPx, glow = true),
|
||||
Span("fps", colDim, bigUnitPx),
|
||||
)
|
||||
val listed = keys.filter { !hero || it != "showFPS" }.flatMap { key ->
|
||||
val labelPx = if (tiles) sp(st.key) else basePx
|
||||
val valuePx = if (tiles) sp(st.row) else basePx
|
||||
if (key == "showPerCore" && size == DroidDeckHudSize.MEGA)
|
||||
perCoreRows(s, labelPx, valuePx, unitPx)
|
||||
else listOf(reading(key, s, labelPx, valuePx, unitPx))
|
||||
}
|
||||
val maxCols = if (size == DroidDeckHudSize.MEGA) 3 else 2
|
||||
val cols = when {
|
||||
listed.size >= 9 -> maxCols
|
||||
listed.size >= 4 -> minOf(2, maxCols)
|
||||
else -> 1
|
||||
}
|
||||
|
||||
if (tiles) {
|
||||
val innerPad = sp(st.innerPad); val tileGap = sp(st.tileGap)
|
||||
val keyH = lineH(sp(st.key)); val valH = lineH(sp(st.row))
|
||||
val cellW = listed.maxOf { max(measure(it.label.text, it.label.sizePx), runWidth(it.vals)) } + innerPad * 2f
|
||||
val graphMin = if (listed.any { it.key == "showFPSGraph" }) sp(GRAPH_MIN_WIDTH_SP) else 0f
|
||||
val cellMin = graphMin + innerPad * 2f
|
||||
val cellH = innerPad * 2f + keyH + lineGap + valH
|
||||
for ((i, r) in listed.withIndex()) {
|
||||
val x = pad + (i % cols) * (cellW + tileGap)
|
||||
val y = pad + (i / cols) * (cellH + tileGap)
|
||||
tileRects.add(RectF(x, y, x + cellW, y + cellH))
|
||||
if (r.key == "showFPSGraph") {
|
||||
graphRect = RectF(x + innerPad, y + innerPad, x + max(cellW, cellMin) - innerPad, y + cellH - innerPad)
|
||||
continue
|
||||
}
|
||||
placeRun(x + innerPad, y + innerPad - ascent(r.label.sizePx), listOf(r.label))
|
||||
placeRun(x + innerPad, y + innerPad + keyH + lineGap - ascent(sp(st.row)), r.vals)
|
||||
}
|
||||
}
|
||||
for (t in tiles) {
|
||||
if (t.wide) {
|
||||
if (col != 0) { y += tileH + tileGap; col = 0; x = pad }
|
||||
place(t, pad, y, fullW)
|
||||
y += tileH + tileGap; col = 0; x = pad
|
||||
} else {
|
||||
place(t, x, y, normalW)
|
||||
col++; x += normalW + tileGap
|
||||
if (col == 2) { col = 0; x = pad; y += tileH + tileGap }
|
||||
val lines = (listed.size + cols - 1) / cols
|
||||
contentW = pad + cols * (cellW + tileGap) - tileGap + pad
|
||||
contentH = pad + lines * (cellH + tileGap) - tileGap + pad
|
||||
} else {
|
||||
val columns = (0 until cols).map { c -> listed.filterIndexed { i, _ -> i % cols == c } }
|
||||
val labelW = columns.map { col -> col.maxOfOrNull { measure(it.label.text, it.label.sizePx) } ?: 0f }
|
||||
val colW = columns.mapIndexed { c, col ->
|
||||
val body = if (col.isEmpty()) 0f else labelW[c] + lvGap + (col.maxOfOrNull { runWidth(it.vals) } ?: 0f)
|
||||
val graph = if (col.any { it.key == "showFPSGraph" }) sp(GRAPH_MIN_WIDTH_SP) + labelW[c] + lvGap else 0f
|
||||
max(body, graph)
|
||||
}
|
||||
val gaps = (0 until cols).count { columns[it].isNotEmpty() }.coerceAtLeast(1) - 1
|
||||
val bodyW = colW.sum() + gutter * gaps
|
||||
var bodyH = 0f
|
||||
for (col in columns) {
|
||||
var y = 0f
|
||||
for (r in col) y += rowHeight(r) + lineGap
|
||||
if (col.isNotEmpty()) bodyH = max(bodyH, y - lineGap)
|
||||
}
|
||||
val heroW = if (hero) runWidth(heroSpans) else 0f
|
||||
val heroH = if (hero) lineH(bigPx) else 0f
|
||||
val x0 = pad + if (hero && listed.isNotEmpty()) heroW + gutter else 0f
|
||||
val top = pad + (max(bodyH, heroH) - bodyH) / 2f
|
||||
var x = x0
|
||||
for (c in 0 until cols) {
|
||||
if (columns[c].isEmpty()) continue
|
||||
var y = top
|
||||
for (r in columns[c]) {
|
||||
if (r.key == "showFPSGraph") {
|
||||
val left = x + labelW[c] + lvGap
|
||||
graphRect = RectF(left, y, max(x + colW[c], left + sp(GRAPH_MIN_WIDTH_SP)), y + sp(GRAPH_HEIGHT_SP))
|
||||
y += sp(GRAPH_HEIGHT_SP) + lineGap
|
||||
continue
|
||||
}
|
||||
val px = maxOf(r.label.sizePx, r.vals.maxOfOrNull { it.sizePx } ?: 0f)
|
||||
val baseline = y - ascent(px)
|
||||
placeRun(x, baseline, listOf(r.label))
|
||||
placeRun(x + labelW[c] + lvGap, baseline, r.vals)
|
||||
y += lineH(px) + lineGap
|
||||
}
|
||||
x += colW[c] + gutter
|
||||
}
|
||||
if (hero) {
|
||||
val baseline = pad + (max(bodyH, heroH) - heroH) / 2f - ascent(bigPx)
|
||||
placeRun(pad, baseline, heroSpans, glow = true)
|
||||
}
|
||||
contentW = max(x0 + bodyW, pad + heroW) + pad
|
||||
contentH = pad + max(bodyH, heroH) + pad
|
||||
}
|
||||
if (col != 0) y += tileH + tileGap
|
||||
if (showFPS && showGraph) {
|
||||
graphRect = RectF(pad, y, pad + fullW, y + sp(22f))
|
||||
y += sp(22f) + tileGap
|
||||
}
|
||||
contentW = pad + fullW + pad
|
||||
contentH = y + (pad - tileGap)
|
||||
addSubtleClock(pad)
|
||||
}
|
||||
|
||||
private fun buildPill(s: HudMetrics.Snapshot) {
|
||||
val bigPx = sp(30f); val bigUnitPx = bigPx * 0.36f; val stkPx = sp(11.5f)
|
||||
val pad = sp(10f); val midGap = sp(12f); val stkLineGap = sp(3f)
|
||||
val left = ArrayList<Span>()
|
||||
val generating = differs(fpsNow)
|
||||
val fpsPx = if (generating) bigPx * 0.55f else bigPx
|
||||
if (showFPS) {
|
||||
left += Span(fpsText(fpsNow), colValue, fpsPx, glow = true)
|
||||
left += Span("fps", colDim, if (generating) bigUnitPx * 0.8f else bigUnitPx)
|
||||
} else if (showBatteryTime) left += Span(s.battery.runtimeText ?: "TIME —", colBat, bigPx * 0.8f)
|
||||
private fun rowHeight(r: HudRow): Float =
|
||||
if (r.key == "showFPSGraph") sp(GRAPH_HEIGHT_SP)
|
||||
else lineH(maxOf(r.label.sizePx, r.vals.maxOfOrNull { it.sizePx } ?: 0f))
|
||||
|
||||
val stack = ArrayList<List<Span>>()
|
||||
val gpuName = if (showGpuModel && gpuNameText().isNotBlank()) gpuModelSpans(stkPx, colDim, compact = true) else null
|
||||
run {
|
||||
val l = ArrayList<Span>()
|
||||
if (showGPU && s.gpuPercent != null) l += Span("GPU ${s.gpuPercent}%", colGpu, stkPx)
|
||||
if (showCPU) { if (l.isNotEmpty()) l += Span(" · ", colDim, stkPx); l += Span("CPU ${s.cpuPercent ?: "—"}%", colCpu, stkPx) }
|
||||
if (l.isNotEmpty()) stack.add(l)
|
||||
private fun perCoreRows(s: HudMetrics.Snapshot, labelPx: Float, valuePx: Float, unitPx: Float): List<HudRow> {
|
||||
val pct = s.perCorePercent
|
||||
val clk = s.perCoreClockMhz
|
||||
return (0 until max(pct.size, clk.size)).map { i ->
|
||||
val vals = ArrayList<Span>()
|
||||
vals += numUnit(if (i < pct.size && pct[i] >= 0) pct[i].toString() else null, "%", valuePx, unitPx)
|
||||
vals += Span(" ", colDim, unitPx)
|
||||
vals += numUnit(if (i < clk.size && clk[i] > 0) clk[i].toString() else null, "MHz", valuePx, unitPx)
|
||||
HudRow("showPerCore", Span("C$i", colCpu, labelPx), vals)
|
||||
}
|
||||
if (showRAM) stack.add(listOf(Span("RAM ${s.ramPercent.roundToInt()}%", colRam, stkPx)))
|
||||
if (showBattery || showPower || showBatteryTemp) {
|
||||
val l = ArrayList<Span>()
|
||||
fun part(spans: List<Span>) { l += if (l.isEmpty()) Span("BAT ", colBat, stkPx) else Span(" · ", colDim, stkPx); l += spans }
|
||||
if (showBattery && s.battery.percent != null) part(listOf(Span("${s.battery.percent}%", colBat, stkPx)))
|
||||
if (showBatteryTemp && s.battery.tempC != null) part(tempSpans(s.battery.tempC, HudMetrics.TempSensor.BATTERY, stkPx, stkPx * 0.62f))
|
||||
if (showPower && s.battery.watts > 0f) part(listOf(Span("${fmt1(s.battery.watts)}W", colDim, stkPx)))
|
||||
if (l.isNotEmpty()) stack.add(l)
|
||||
}
|
||||
if (showBatteryTime) stack.add(listOf(Span("BAT TIME ${s.battery.runtimeText ?: "—"}", colBat, stkPx)))
|
||||
run {
|
||||
val l = ArrayList<Span>()
|
||||
if (showFPS) l += Span("${fmt1(1000f / max(fpsNow, 1f))}ms", colDim, stkPx)
|
||||
if (showFPS && displayServer.isNotBlank()) { l += Span(" · ", colDim, stkPx); l += Span(displayServer, colDisp, stkPx) }
|
||||
else if (displayServer.isNotBlank()) l += Span(displayServer, colDisp, stkPx)
|
||||
if (showVram && s.vramText() != null) { if (l.isNotEmpty()) l += Span(" · ", colDim, stkPx); l += Span("${s.vramText()} vram", colDim, stkPx) }
|
||||
if (l.isNotEmpty()) stack.add(l)
|
||||
}
|
||||
if (hdrState != DroidDeckHudHdr.NONE) stack.add(hdrLine(stkPx))
|
||||
|
||||
var statsW = 0f
|
||||
for (l in stack) statsW = max(statsW, runWidth(l))
|
||||
val nameOnTop = gpuName != null && runWidth(gpuName) > statsW
|
||||
if (gpuName != null && !nameOnTop) stack.add(0, gpuName)
|
||||
val apiStr = apiLabel()
|
||||
val hasApi = showFPS && apiStr != "FPS"
|
||||
val apiH = if (hasApi) lineH(stkPx) else 0f
|
||||
val apiGap = if (hasApi) stkLineGap else 0f
|
||||
val leftW = runWidth(left); val leftH = if (left.isEmpty()) 0f else lineH(bigPx)
|
||||
val apiW = if (hasApi) measure(apiStr, stkPx) else 0f
|
||||
val leftBlockW = max(leftW, apiW)
|
||||
val leftColH = apiH + apiGap + leftH
|
||||
val stkH = lineH(stkPx)
|
||||
var stackW = 0f
|
||||
for (l in stack) stackW = max(stackW, runWidth(l))
|
||||
val stackTotalH = stack.size * stkH + (stack.size - 1).coerceAtLeast(0) * stkLineGap
|
||||
val innerH = max(leftColH, stackTotalH)
|
||||
val topLineH = if (nameOnTop) stkH + stkLineGap else 0f
|
||||
contentW = pad + leftBlockW + midGap + stackW + pad
|
||||
contentH = pad + topLineH + innerH + pad
|
||||
var ly = pad + topLineH + (innerH - leftColH) / 2f
|
||||
if (hasApi) { placeRun(pad, ly - ascent(stkPx), listOf(Span(apiStr, colFps, stkPx))); ly += apiH + apiGap }
|
||||
if (left.isNotEmpty()) placeRun(pad, ly - ascent(bigPx), left)
|
||||
var sy = pad + topLineH + (innerH - stackTotalH) / 2f
|
||||
for (l in stack) { placeRun(pad + leftBlockW + midGap, sy - ascent(stkPx), l); sy += stkH + stkLineGap }
|
||||
addSubtleClock(pad, leftAligned = true)
|
||||
if (nameOnTop && gpuName != null) { val end = placeRun(pad, pad - ascent(stkPx), gpuName); contentW = max(contentW, end + pad) }
|
||||
}
|
||||
|
||||
private fun buildMinimal(s: HudMetrics.Snapshot) {
|
||||
val bigPx = sp(34f); val bigUnitPx = bigPx * 0.32f; val subPx = sp(11.5f); val footPx = sp(9.5f)
|
||||
val stroke = outlineWidth()
|
||||
val left = contentLeft()
|
||||
val inner = panelInset() + stroke
|
||||
val runtime = if (showBatteryTime) s.battery.runtimeText ?: "TIME —" else null
|
||||
val minGenerating = differs(fpsNow)
|
||||
val big = when {
|
||||
showFPS -> listOf(Span(fpsText(fpsNow), colValue, if (minGenerating) bigPx * 0.55f else bigPx), Span("fps", colDim, if (minGenerating) bigUnitPx * 0.8f else bigUnitPx))
|
||||
runtime != null -> listOf(Span(runtime, colBat, sp(24f)))
|
||||
else -> emptyList()
|
||||
}
|
||||
val sub = ArrayList<Span>()
|
||||
fun low(label: String, value: Float) {
|
||||
if (sub.isNotEmpty()) sub += Span(" · ", colDim, subPx)
|
||||
sub += Span("$label ", colDim, subPx)
|
||||
sub += Span(lowText(value) ?: "—", colFps, subPx)
|
||||
}
|
||||
if (showFPS && showLow1) low("1%", lows.low1Fps)
|
||||
if (showFPS && showLow01) low("0.1%", lows.low01Fps)
|
||||
if (showFPS && showLow001) low("0.01%", lows.low001Fps)
|
||||
if (showBatteryTime) {
|
||||
if (sub.isNotEmpty()) sub += Span(" · ", colDim, subPx)
|
||||
sub += Span("BAT TIME ", colBat, subPx)
|
||||
sub += Span(s.battery.runtimeText ?: "—", colBat, subPx)
|
||||
}
|
||||
val footerLabel = listOf(if (showFPS && showEngine) engineLabel else "", if (showFPS) displayServer else "").filter { it.isNotBlank() }.joinToString(" · ")
|
||||
val hdr = if (hdrState != DroidDeckHudHdr.NONE) hdrLine(footPx) else emptyList()
|
||||
val (headerBottom, headerRight) = addPanelHeader(left, inner)
|
||||
val colW = maxOf(runWidth(big), runWidth(sub), headerRight - left, max(measure(footerLabel, footPx), runWidth(hdr)), if (showFPS && showGraph) sp(120f) else 0f)
|
||||
var last = headerBottom + sp(8f)
|
||||
if (big.isNotEmpty()) { last += capHeight(big[0].sizePx); placeRun(left - inkLeft(big[0].text, big[0].sizePx), last, big, glow = showFPS) }
|
||||
if (sub.isNotEmpty()) { last += sp(10f) + capHeight(subPx); placeRun(left - inkLeft(sub[0].text, subPx), last, sub) }
|
||||
if (showFPS && showGraph) { val top = last + sp(9f); graphRect = RectF(left, top, left + colW, top + sp(24f)); last = top + sp(24f) }
|
||||
if (footerLabel.isNotBlank()) { val base = last + sp(8f) + capHeight(footPx); glyphs.add(Glyph(left - inkLeft(footerLabel, footPx), base, footerLabel, blend(colDim), footPx)); last = base }
|
||||
if (hdr.isNotEmpty()) { val base = last + sp(6f) + capHeight(footPx); placeRun(left - inkLeft(hdr[0].text, footPx), base, hdr); last = base }
|
||||
measurePaint.textSize = footPx
|
||||
finishPanel(RectF(panelLeft(), panelInset(), left + colW + sp(34f), last + measurePaint.fontMetrics.descent + sp(9f) + stroke), halfRound = true)
|
||||
}
|
||||
|
||||
private fun buildStrip(s: HudMetrics.Snapshot) {
|
||||
@@ -1020,70 +941,28 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
right -= groupGap
|
||||
}
|
||||
|
||||
if (showFPS) {
|
||||
val generating = differs(fpsNow)
|
||||
val fps = ArrayList<Span>()
|
||||
if (apiLabel() != "FPS") fps += Span("${apiLabel()} ", colDim, rowPx)
|
||||
fps += Span(fpsText(fpsNow), colValue, if (generating) fpsPx * 0.8f else fpsPx, glow = true)
|
||||
fps += Span("fps", colDim, unitPx)
|
||||
x = placeRun(x, baseline, fps) + groupGap
|
||||
}
|
||||
|
||||
if (showFPS && showGraph) {
|
||||
val gw = sp(72f); val gh = h * 0.55f
|
||||
if (x + gw <= right) {
|
||||
val generating = differs(fpsNow)
|
||||
for (key in size.rowsIn(storedOrder)) {
|
||||
if (!switchOn(key)) continue
|
||||
if (key == "showFPSGraph") {
|
||||
val gw = sp(72f); val gh = h * 0.55f
|
||||
if (x + gw > right) break
|
||||
graphRect = RectF(x, mid - gh / 2f, x + gw, mid + gh / 2f)
|
||||
x += gw + groupGap
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
val groups = ArrayList<List<Span>>()
|
||||
run {
|
||||
val l = ArrayList<Span>()
|
||||
fun low(label: String, value: Float) {
|
||||
if (l.isNotEmpty()) l += Span(" ", colDim, rowPx)
|
||||
l += Span("$label ", colDim, rowPx)
|
||||
l += Span(lowText(value) ?: "—", colFps, rowPx)
|
||||
val spans = if (key == "showFPS") {
|
||||
val fps = ArrayList<Span>()
|
||||
if (apiLabel() != "FPS") fps += Span("${apiLabel()} ", colDim, rowPx)
|
||||
fps += Span(fpsText(fpsNow), colValue, if (generating) fpsPx * 0.8f else fpsPx, glow = true)
|
||||
fps += Span("fps", colDim, unitPx)
|
||||
fps
|
||||
} else {
|
||||
val row = reading(key, s, rowPx, rowPx, unitPx)
|
||||
listOf(row.label, Span(" ", colDim, rowPx)) + row.vals
|
||||
}
|
||||
if (showFPS && showLow1) low("1%", lows.low1Fps)
|
||||
if (showFPS && showLow01) low("0.1%", lows.low01Fps)
|
||||
if (showFPS && showLow001) low("0.01%", lows.low001Fps)
|
||||
if (l.isNotEmpty()) groups += l
|
||||
}
|
||||
if (showGPU || showGpuTemp) {
|
||||
val l = arrayListOf(Span("GPU", colGpu, rowPx))
|
||||
if (showGPU) l += Span(" ${s.gpuPercent ?: "—"}%", colGpu, rowPx)
|
||||
if (showGpuTemp && s.gpuTempC != null) { l += Span(" ", colDim, rowPx); l += tempSpans(s.gpuTempC, HudMetrics.TempSensor.GPU, rowPx, unitPx) }
|
||||
groups += l
|
||||
}
|
||||
if (showCPU || showCpuTemp) {
|
||||
val l = arrayListOf(Span("CPU", colCpu, rowPx))
|
||||
if (showCPU) l += Span(" ${s.cpuPercent ?: "—"}%", colCpu, rowPx)
|
||||
if (showCpuTemp && s.cpuTempC != null) { l += Span(" ", colDim, rowPx); l += tempSpans(s.cpuTempC, HudMetrics.TempSensor.CPU, rowPx, unitPx) }
|
||||
groups += l
|
||||
}
|
||||
if (showVram) s.vramText()?.let { groups += listOf(Span("VRAM $it", colVram, rowPx)) }
|
||||
if (showRAM) groups += listOf(Span("RAM ${s.ramPercent.roundToInt()}%", colRam, rowPx))
|
||||
if (showBattery || showPower || showBatteryTemp) {
|
||||
val l = ArrayList<Span>()
|
||||
fun part(spans: List<Span>) {
|
||||
l += if (l.isEmpty()) Span("BAT ", colBat, rowPx) else Span(" ", colDim, rowPx)
|
||||
l += spans
|
||||
}
|
||||
if (showBattery && s.battery.percent != null) part(listOf(Span("${s.battery.percent}%", colBat, rowPx)))
|
||||
if (showBatteryTemp && s.battery.tempC != null)
|
||||
part(tempSpans(s.battery.tempC, HudMetrics.TempSensor.BATTERY, rowPx, unitPx))
|
||||
if (showPower && s.battery.watts > 0f) part(listOf(Span("${fmt1(s.battery.watts)}W", colDim, rowPx)))
|
||||
if (l.isNotEmpty()) groups += l
|
||||
}
|
||||
if (showBatteryTime) groups += listOf(Span("BAT TIME ${s.battery.runtimeText ?: "—"}", colBat, rowPx))
|
||||
if (displayServer.isNotBlank()) groups += listOf(Span(displayServer, colDisp, rowPx))
|
||||
if (hdrState != DroidDeckHudHdr.NONE) groups += hdrLine(rowPx)
|
||||
if (showGpuModel && gpuNameText().isNotBlank()) groups += gpuModelSpans(rowPx, colDim, compact = true)
|
||||
|
||||
for (g in groups) {
|
||||
if (x + runWidth(g) > right) break
|
||||
x = placeRun(x, baseline, g) + groupGap
|
||||
if (x + runWidth(spans) > right) break
|
||||
x = placeRun(x, baseline, spans) + groupGap
|
||||
}
|
||||
|
||||
stripRect = RectF(0f, 0f, w, h)
|
||||
@@ -1103,169 +982,6 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
return inkRect.left.toFloat()
|
||||
}
|
||||
|
||||
private fun layoutColumn(rows: List<HudRow>, x: Float, y0: Float,
|
||||
rowPx: Float, lineGap: Float, lvGap: Float): Pair<Float, Float> {
|
||||
if (rows.isEmpty()) return Pair(y0, x)
|
||||
var labelCol = 0f
|
||||
for (r in rows) if (!r.inline) labelCol = max(labelCol, measure(r.label.text, rowPx))
|
||||
val h = lineH(rowPx); val asc = ascent(rowPx)
|
||||
var y = y0; var right = x
|
||||
for (r in rows) {
|
||||
val baseline = y - asc
|
||||
placeRun(x, baseline, listOf(r.label))
|
||||
val valX = if (r.inline) x + measure(r.label.text, rowPx) + lvGap
|
||||
else x + labelCol + lvGap
|
||||
val end = placeRun(valX, baseline, r.vals)
|
||||
right = max(right, end)
|
||||
y += h + lineGap
|
||||
}
|
||||
return Pair(y - lineGap, right)
|
||||
}
|
||||
|
||||
private fun layoutWrap(fragments: List<List<Span>>, x: Float, y0: Float, maxWidth: Float,
|
||||
px: Float, lineGap: Float): Pair<Float, Float> {
|
||||
if (fragments.isEmpty()) return Pair(y0, x)
|
||||
val h = lineH(px); val asc = ascent(px)
|
||||
val sepW = measure(" · ", px)
|
||||
var cx = x; var y = y0; var right = x; var firstOnLine = true
|
||||
for (frag in fragments) {
|
||||
val w = runWidth(frag)
|
||||
if (!firstOnLine && (cx + sepW + w - x) > maxWidth) { y += h + lineGap; cx = x; firstOnLine = true }
|
||||
if (!firstOnLine) { placeRun(cx, y - asc, listOf(Span(" · ", colDim, px))); cx += sepW }
|
||||
val end = placeRun(cx, y - asc, frag)
|
||||
cx = end; right = max(right, end); firstOnLine = false
|
||||
}
|
||||
return Pair(y + h, right)
|
||||
}
|
||||
|
||||
private fun buildMega(s: HudMetrics.Snapshot) {
|
||||
val rowPx = sp(11.5f); val unitPx = rowPx * 0.62f; val bandPx = sp(9.5f)
|
||||
val pad = sp(10f); val lineGap = sp(3.5f); val lvGap = sp(7f); val gutter = sp(16f)
|
||||
|
||||
val left = ArrayList<HudRow>()
|
||||
if (showGpuModel && gpuNameText().isNotBlank())
|
||||
left.add(HudRow(Span("GPU", colGpu, rowPx), gpuModelSpans(rowPx, colValue)))
|
||||
if (showGPU && hasGpuStats(s)) {
|
||||
val v = ArrayList<Span>()
|
||||
v += numUnit(s.gpuPercent?.toString(), "%", rowPx, unitPx)
|
||||
if (showGpuTemp) tempSpans(s.gpuTempC, HudMetrics.TempSensor.GPU, rowPx, unitPx)
|
||||
.let { if (it.isNotEmpty()) { v += gap(unitPx); v += it } }
|
||||
v += gap(unitPx); v += numUnit(s.gpuClockMhz?.toString(), "MHz", rowPx, unitPx)
|
||||
left.add(HudRow(Span("GPU", colGpu, rowPx), v))
|
||||
}
|
||||
if (showCPU) {
|
||||
val v = ArrayList<Span>()
|
||||
v += numUnit(s.cpuPercent?.toString(), "%", rowPx, unitPx)
|
||||
v += gap(unitPx); v += numUnit(s.cpuClockMhz?.toString(), "MHz", rowPx, unitPx)
|
||||
if (showCpuTemp) tempSpans(s.cpuTempC, HudMetrics.TempSensor.CPU, rowPx, unitPx)
|
||||
.let { if (it.isNotEmpty()) { v += gap(unitPx); v += it } }
|
||||
left.add(HudRow(Span("CPU", colCpu, rowPx), v))
|
||||
}
|
||||
if (showPerCore) {
|
||||
val pct = s.perCorePercent; val clk = s.perCoreClockMhz
|
||||
val n = max(pct.size, clk.size)
|
||||
for (i in 0 until n) {
|
||||
val v = ArrayList<Span>()
|
||||
v += numUnit(if (i < pct.size && pct[i] >= 0) pct[i].toString() else null, "%", rowPx, unitPx)
|
||||
v += gap(unitPx)
|
||||
v += numUnit(if (i < clk.size && clk[i] > 0) clk[i].toString() else null, "MHz", rowPx, unitPx)
|
||||
left.add(HudRow(Span("C$i", colCpu, rowPx), v))
|
||||
}
|
||||
}
|
||||
|
||||
val right = ArrayList<HudRow>()
|
||||
if (showVram && s.vramText() != null)
|
||||
right.add(HudRow(Span("VRAM", colVram, rowPx), valueUnit(s.vramText()!!, rowPx, unitPx)))
|
||||
if (showRAM) {
|
||||
val v = ArrayList<Span>()
|
||||
v += valueUnit(s.ramUsedText(), rowPx, unitPx)
|
||||
v += Span("/", colDim, unitPx); v += valueUnit(s.ramTotalText(), rowPx, unitPx)
|
||||
v += gap(unitPx); v += numUnit(s.ramPercent.roundToInt().toString(), "%", rowPx, unitPx)
|
||||
right.add(HudRow(Span("RAM", colRam, rowPx), v))
|
||||
}
|
||||
if (showSwap && s.swapUsedText() != null) {
|
||||
val v = ArrayList<Span>()
|
||||
v += valueUnit(s.swapUsedText()!!, rowPx, unitPx)
|
||||
s.swapTotalText()?.let { v += Span("/", colDim, unitPx); v += valueUnit(it, rowPx, unitPx) }
|
||||
right.add(HudRow(Span("SWP", colRam, rowPx), v))
|
||||
}
|
||||
if (showNet && s.netDownBps != null) {
|
||||
val d = (s.netDownBps ?: 0L) / 1024L
|
||||
val u = (s.netUpBps ?: 0L) / 1024L
|
||||
val v = ArrayList<Span>()
|
||||
v += Span("↓", colDim, unitPx); v += Span(d.toString(), colValue, rowPx)
|
||||
v += Span(" ↑", colDim, unitPx); v += Span(u.toString(), colValue, rowPx)
|
||||
v += Span("KB/s", colDim, unitPx)
|
||||
right.add(HudRow(Span("NET", colFps, rowPx), v))
|
||||
}
|
||||
if (showBattery || showPower || showBatteryTemp) {
|
||||
val v = ArrayList<Span>(); var any = false
|
||||
if (showBattery && s.battery.percent != null) { v += numUnit(s.battery.percent.toString(), "%", rowPx, unitPx); any = true }
|
||||
if (showBatteryTemp) tempSpans(s.battery.tempC, HudMetrics.TempSensor.BATTERY, rowPx, unitPx)
|
||||
.let { if (it.isNotEmpty()) { if (any) v += gap(unitPx); v += it; any = true } }
|
||||
if (showPower && s.battery.watts > 0f) { if (any) v += gap(unitPx); v += numUnit(fmt1(s.battery.watts), "W", rowPx, unitPx); any = true }
|
||||
if (any) right.add(HudRow(Span("BAT", colBat, rowPx), v))
|
||||
}
|
||||
if (showBatteryTime) right.add(HudRow(Span("TIME", colBat, rowPx), listOf(Span(s.battery.runtimeText ?: "—", colValue, rowPx))))
|
||||
if (showFPS) {
|
||||
val v = ArrayList<Span>()
|
||||
v += glowing(numUnit(fpsText(fpsNow), "FPS", rowPx, unitPx))
|
||||
v += gap(unitPx); v += numUnit(fmt1(1000f / max(fpsNow, 1f)), "ms", rowPx, unitPx)
|
||||
right.add(HudRow(Span(apiLabel(), colFps, rowPx), v))
|
||||
right.add(HudRow(Span("AVG", colLo, rowPx), numUnit(fmt1(fpsAvg), "FPS", rowPx, unitPx)))
|
||||
if (showLow1)
|
||||
right.add(HudRow(Span("1%", colLo, rowPx), numUnit(lowText(lows.low1Fps), "FPS", rowPx, unitPx)))
|
||||
if (showLow01)
|
||||
right.add(HudRow(Span("0.1%", colLo, rowPx), numUnit(lowText(lows.low01Fps), "FPS", rowPx, unitPx)))
|
||||
if (showLow001)
|
||||
right.add(HudRow(Span("0.01%", colLo, rowPx), numUnit(lowText(lows.low001Fps), "FPS", rowPx, unitPx)))
|
||||
}
|
||||
|
||||
val (leftBottom, leftRight) = layoutColumn(left, pad, pad, rowPx, lineGap, lvGap)
|
||||
val rightX = (if (left.isEmpty()) pad else leftRight + gutter)
|
||||
val (rightBottom, rightRight) = layoutColumn(right, rightX, pad, rowPx, lineGap, lvGap)
|
||||
var y = max(leftBottom, rightBottom)
|
||||
var maxRight = max(leftRight, rightRight)
|
||||
|
||||
val band = ArrayList<List<Span>>()
|
||||
if (showResolution) band.add(listOf(Span("RES ", colDim, bandPx), Span(resolutionString(), colValue, bandPx)))
|
||||
if (displayServer.isNotBlank()) band.add(listOf(Span("DISP ", colDim, bandPx), Span(displayServer, colDisp, bandPx)))
|
||||
if (hdrState != DroidDeckHudHdr.NONE) band.add(listOf(Span("HDR ", colDim, bandPx)) + hdrValue(bandPx))
|
||||
if (showProton && wineVersion.isNotBlank()) band.add(listOf(Span(wineVersion, colVram, bandPx)))
|
||||
if (showSession) band.add(listOf(Span("elapsed ", colDim, bandPx), Span(elapsedString(), colValue, bandPx)))
|
||||
if (band.isNotEmpty()) {
|
||||
y += sp(4f)
|
||||
val (bBottom, bRight) = layoutWrap(band, pad, y, max(maxRight - pad, sp(180f)), bandPx, lineGap)
|
||||
y = bBottom; maxRight = max(maxRight, bRight)
|
||||
}
|
||||
|
||||
if (showGraph) {
|
||||
y += sp(3f)
|
||||
val gh = sp(22f)
|
||||
val gr = max(maxRight, pad + sp(220f))
|
||||
graphRect = RectF(pad, y, gr, y + gh)
|
||||
maxRight = max(maxRight, gr)
|
||||
y += gh
|
||||
}
|
||||
|
||||
val dxLine = dxVersionLabeled()
|
||||
val hasDx = showDxVer && dxLine.isNotBlank()
|
||||
if (hasDx) {
|
||||
y += sp(4f)
|
||||
maxRight = max(maxRight, placeRun(pad, y - ascent(bandPx), listOf(Span(dxLine, colDim, bandPx))))
|
||||
y += lineH(bandPx)
|
||||
}
|
||||
if (showWrapper && graphicsWrapper.isNotBlank()) {
|
||||
y += if (hasDx) sp(1f) else sp(4f)
|
||||
maxRight = max(maxRight, placeRun(pad, y - ascent(bandPx), listOf(Span(graphicsWrapper, colDim, bandPx))))
|
||||
y += lineH(bandPx)
|
||||
}
|
||||
|
||||
contentW = maxRight + pad
|
||||
contentH = y + pad
|
||||
addSubtleClock(pad)
|
||||
}
|
||||
|
||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||
if (stripRect != null) { setMeasuredDimension(contentW.roundToInt(), resolveSize(contentH.roundToInt(), heightMeasureSpec)); return }
|
||||
setMeasuredDimension(
|
||||
@@ -1546,6 +1262,8 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
const val MIN_SCALE = 0.5f
|
||||
const val MAX_SCALE = 2f
|
||||
const val GRAPH_CLIP_MS = 49.9f
|
||||
const val GRAPH_HEIGHT_SP = 22f
|
||||
const val GRAPH_MIN_WIDTH_SP = 160f
|
||||
|
||||
fun parseIntOr(s: String?, d: Int): Int = try { s?.trim()?.toInt() ?: d } catch (e: Exception) { d }
|
||||
|
||||
|
||||
@@ -301,6 +301,9 @@ internal fun rememberShown(onDismiss: () -> Unit): MutableTransitionState<Boolea
|
||||
return shown
|
||||
}
|
||||
|
||||
private val DIALOG_MARGIN = 12.dp
|
||||
private val SIDE_GAP = 24.dp
|
||||
|
||||
@Composable
|
||||
internal fun AppDialog(
|
||||
shown: MutableTransitionState<Boolean>, close: () -> Unit, label: String, wide: Boolean,
|
||||
@@ -309,17 +312,23 @@ internal fun AppDialog(
|
||||
back: (() -> Unit)? = null,
|
||||
scrollable: Boolean = true,
|
||||
scrollState: androidx.compose.foundation.ScrollState = rememberScrollState(),
|
||||
side: (@Composable () -> Unit)? = null,
|
||||
sideRoom: Dp = 0.dp,
|
||||
content: @Composable ColumnScope.() -> Unit,
|
||||
) {
|
||||
val pal = LocalPalette.current
|
||||
val panelCap = maxWidth ?: if (wide) 860.dp else 560.dp
|
||||
VeilRing()
|
||||
Dialog(onDismissRequest = back ?: close, properties = DialogProperties(usePlatformDefaultWidth = false, decorFitsSystemWindows = false)) {
|
||||
CompositionLocalProvider(LocalFrontFocus provides null) {
|
||||
Box(
|
||||
BoxWithConstraints(
|
||||
contentAlignment = Alignment.Center,
|
||||
modifier = Modifier.fillMaxSize().imePadding()
|
||||
.tapOutside(close),
|
||||
) {
|
||||
val panel = (this.maxWidth - DIALOG_MARGIN * 2).coerceAtMost(panelCap)
|
||||
val free = (this.maxWidth - panel) / 2 - SIDE_GAP
|
||||
val beside = side != null && free >= sideRoom
|
||||
AnimatedVisibility(
|
||||
visibleState = shown,
|
||||
enter = fadeIn(Motion.tw(180)) + scaleIn(Motion.sp(0.7f), initialScale = 0.94f),
|
||||
@@ -329,8 +338,8 @@ internal fun AppDialog(
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(14.dp),
|
||||
modifier = Modifier
|
||||
.padding(12.dp)
|
||||
.widthIn(max = maxWidth ?: if (wide) 860.dp else 560.dp)
|
||||
.padding(DIALOG_MARGIN)
|
||||
.widthIn(max = panelCap)
|
||||
.then(
|
||||
when {
|
||||
width != null -> Modifier.width(width)
|
||||
@@ -348,8 +357,21 @@ internal fun AppDialog(
|
||||
.then(modifier)
|
||||
.then(if (scrollable) Modifier.verticalScroll(scrollState) else Modifier)
|
||||
.padding(horizontal = 18.dp, vertical = 16.dp),
|
||||
content = content,
|
||||
)
|
||||
) {
|
||||
content()
|
||||
if (side != null && !beside) side()
|
||||
}
|
||||
}
|
||||
if (side != null && beside) {
|
||||
AnimatedVisibility(
|
||||
visibleState = shown,
|
||||
enter = fadeIn(Motion.tw(180)),
|
||||
exit = fadeOut(Motion.tw(140)),
|
||||
modifier = Modifier.align(Alignment.CenterEnd).padding(end = SIDE_GAP),
|
||||
label = "$label-side",
|
||||
) {
|
||||
Box(Modifier.widthIn(max = free).blockTouches()) { side() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
@@ -8,7 +10,9 @@ import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.hud.DroidDeckHudConfig
|
||||
import com.droiddeck.launcher.hud.DroidDeckHudSize
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.session.StripMetric
|
||||
@@ -55,30 +59,34 @@ internal fun DroidDeckHudSettings(host: MenuHost, a: DrawerActions, track: (Stri
|
||||
ChoiceRow(host, "hud-outline-color", stringResource(R.string.hud_outline_color), null,
|
||||
listOf("0" to stringResource(R.string.hud_outline_gray), "1" to stringResource(R.string.hud_outline_theme)),
|
||||
if (cfg["hudOutlineAccent"] == "0") "0" else "1", chipModifier = track("hud-outline-color")) { a.onHudSetting("hudOutlineAccent", it) }
|
||||
ToggleRow(host, "hud-fps-decimal", stringResource(R.string.hud_metric_decimal), null, on("fpsDecimal"),
|
||||
chipModifier = track("hud-fps-decimal")) { a.onHudSetting("fpsDecimal", flag(it)) }
|
||||
ToggleRow(host, "hud-clock", stringResource(R.string.hud_metric_clock), null, on("showClock"),
|
||||
chipModifier = track("hud-clock")) { a.onHudSetting("showClock", flag(it)) }
|
||||
ToggleRow(host, "hud-graph", stringResource(R.string.hud_metric_graph), null, on("showFPSGraph"),
|
||||
chipModifier = track("hud-graph")) { a.onHudSetting("showFPSGraph", flag(it)) }
|
||||
}
|
||||
|
||||
val size = DroidDeckHudSize.from(cfg["hudSize"])
|
||||
val chips = size.supportedChips() + EXTRA[size].orEmpty()
|
||||
var editing by remember { mutableStateOf(false) }
|
||||
SettingsGroup(stringResource(R.string.hud_group_metrics)) {
|
||||
for (metric in METRICS) {
|
||||
if (metric.chip !in chips || metric.chip in HIDDEN[size].orEmpty()) continue
|
||||
ToggleRow(host, "hud-${metric.key}", stringResource(metric.label), null, on(metric.key),
|
||||
chipModifier = track("hud-${metric.key}")) { a.onHudSetting(metric.key, flag(it)) }
|
||||
if (metric.key == "showBattery" && size != DroidDeckHudSize.MINIMAL) {
|
||||
ToggleRow(host, "hud-showBatteryTime", stringResource(R.string.hud_metric_battery_time), null, on("showBatteryTime"),
|
||||
chipModifier = track("hud-showBatteryTime")) { a.onHudSetting("showBatteryTime", flag(it)) }
|
||||
}
|
||||
}
|
||||
|
||||
if (size == DroidDeckHudSize.MINIMAL && "Battery time" in chips &&
|
||||
"Battery time" !in HIDDEN[size].orEmpty()) {
|
||||
ToggleRow(host, "hud-showBatteryTime", stringResource(R.string.hud_metric_battery_time), null, on("showBatteryTime"),
|
||||
chipModifier = track("hud-showBatteryTime")) { a.onHudSetting("showBatteryTime", flag(it)) }
|
||||
ActionRow(stringResource(R.string.hud_group_metrics), null, stringResource(R.string.common_edit),
|
||||
onClick = { editing = true }, modifier = track("hud-readings"))
|
||||
val rows = DroidDeckHudSize.rowsFor(DroidDeckHudSize.from(cfg["hudSize"]), cfg)
|
||||
SettingsRow(stringResource(R.string.hud_readings_shown), null) {
|
||||
Text(stringResource(R.string.hud_readings_count, rows.count { on(it) }, rows.size),
|
||||
fontSize = 13.sp, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
}
|
||||
if (editing) HudReadingsDialog(
|
||||
visible = rows,
|
||||
initialOrder = rows,
|
||||
initialOn = rows.associateWith { on(it) },
|
||||
onDismiss = { editing = false },
|
||||
onSave = { switches, order -> a.onHudOrder(switches, order) },
|
||||
onReset = a.onHudOrderReset,
|
||||
)
|
||||
}
|
||||
|
||||
val tempsShown = ("Temp" in chips && on("showTemp")) || ("GPU temp" in chips && on("showGpuTemp"))
|
||||
if (tempsShown) SettingsGroup(stringResource(R.string.hud_group_temps)) {
|
||||
if (on("showTemp") || on("showGpuTemp") || on("showBatteryTemp")) SettingsGroup(stringResource(R.string.hud_group_temps)) {
|
||||
ChoiceRow(host, "hud-temp-unit", stringResource(R.string.hud_temp_unit), null,
|
||||
listOf("c" to "°C", "f" to "°F"), if (cfg["tempUnit"].equals("f", true)) "f" else "c",
|
||||
chipModifier = track("hud-temp-unit")) { a.onHudSetting("tempUnit", it) }
|
||||
@@ -155,37 +163,39 @@ private val BOTTOM_STRIP_ROWS = listOf(
|
||||
StripMetric.CLOCK to R.string.hud_metric_clock,
|
||||
)
|
||||
|
||||
private val EXTRA = mapOf(DroidDeckHudSize.PILL to setOf("Temp", "Power"))
|
||||
|
||||
private class HudMetric(val chip: String, val key: String, val label: Int)
|
||||
private class HudMetric(val key: String, val label: Int)
|
||||
|
||||
// Wrapper and DX version have nothing to show in DroidDeck.
|
||||
private val METRICS = listOf(
|
||||
HudMetric("FPS", "showFPS", R.string.drawer_hud_fps),
|
||||
HudMetric("FPS graph", "showFPSGraph", R.string.hud_metric_graph),
|
||||
HudMetric("FPS .1", "fpsDecimal", R.string.hud_metric_decimal),
|
||||
HudMetric("1% low", "showLow1", R.string.hud_metric_low1),
|
||||
HudMetric("0.1% low", "showLow01", R.string.hud_metric_low01),
|
||||
HudMetric("0.01% low", "showLow001", R.string.hud_metric_low001),
|
||||
HudMetric("Engine", "showEngine", R.string.hud_metric_engine),
|
||||
HudMetric("GPU model", "showGpuModel", R.string.hud_metric_gpu_model),
|
||||
HudMetric("GPU", "showGPULoad", R.string.hud_metric_gpu),
|
||||
HudMetric("GPU temp", "showGpuTemp", R.string.hud_metric_gpu_temp),
|
||||
HudMetric("CPU", "showCPUUsage", R.string.hud_metric_cpu),
|
||||
HudMetric("Per-core", "showPerCore", R.string.hud_metric_per_core),
|
||||
HudMetric("Temp", "showTemp", R.string.hud_metric_temp),
|
||||
HudMetric("RAM", "showRAM", R.string.hud_metric_ram),
|
||||
HudMetric("VRAM", "showVram", R.string.hud_metric_vram),
|
||||
HudMetric("Swap", "showSwap", R.string.hud_metric_swap),
|
||||
HudMetric("Battery", "showBattery", R.string.hud_metric_battery),
|
||||
HudMetric("Power", "showPower", R.string.hud_metric_power),
|
||||
HudMetric("Network", "showNet", R.string.hud_metric_network),
|
||||
HudMetric("Resolution", "showResolution", R.string.hud_metric_resolution),
|
||||
HudMetric("Proton", "showProton", R.string.hud_metric_proton),
|
||||
HudMetric("Session", "showSession", R.string.hud_metric_session),
|
||||
HudMetric("Clock", "showClock", R.string.hud_metric_clock),
|
||||
HudMetric("showGpuModel", R.string.hud_metric_gpu_model),
|
||||
HudMetric("showGPULoad", R.string.hud_metric_gpu),
|
||||
HudMetric("showCPUUsage", R.string.hud_metric_cpu),
|
||||
HudMetric("showPerCore", R.string.hud_metric_per_core),
|
||||
HudMetric("showTemp", R.string.hud_metric_temp),
|
||||
HudMetric("showBatteryTemp", R.string.drawer_hud_battery),
|
||||
HudMetric("showGpuTemp", R.string.hud_metric_gpu_temp),
|
||||
HudMetric("showVram", R.string.hud_metric_vram),
|
||||
HudMetric("showRAM", R.string.hud_metric_ram),
|
||||
HudMetric("showSwap", R.string.hud_metric_swap),
|
||||
HudMetric("showBattery", R.string.hud_metric_battery),
|
||||
HudMetric("showBatteryTime", R.string.hud_metric_battery_time),
|
||||
HudMetric("showPower", R.string.hud_metric_power),
|
||||
HudMetric("showFPS", R.string.drawer_hud_fps),
|
||||
HudMetric("showFPSGraph", R.string.hud_metric_graph),
|
||||
HudMetric("showLatency", R.string.hud_metric_latency),
|
||||
HudMetric("showAvg", R.string.hud_metric_avg),
|
||||
HudMetric("showLow1", R.string.hud_metric_low1),
|
||||
HudMetric("showLow01", R.string.hud_metric_low01),
|
||||
HudMetric("showLow001", R.string.hud_metric_low001),
|
||||
HudMetric("showEngine", R.string.hud_metric_engine),
|
||||
HudMetric("showDisplay", R.string.hud_metric_display),
|
||||
HudMetric("showHdr", R.string.hud_metric_hdr),
|
||||
HudMetric("showNet", R.string.hud_metric_network),
|
||||
HudMetric("showResolution", R.string.hud_metric_resolution),
|
||||
HudMetric("showProton", R.string.hud_metric_proton),
|
||||
HudMetric("showSession", R.string.hud_metric_session),
|
||||
HudMetric("showClock", R.string.hud_metric_clock),
|
||||
)
|
||||
|
||||
private val HIDDEN = mapOf(
|
||||
DroidDeckHudSize.PILL to setOf("FPS graph"),
|
||||
DroidDeckHudSize.TILES to setOf("FPS graph", "0.1% low", "0.01% low"),
|
||||
)
|
||||
internal fun hudMetricLabel(key: String): Int? =
|
||||
METRICS.firstOrNull { it.key == key }?.label
|
||||
@@ -0,0 +1,389 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import android.view.KeyEvent
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.animation.core.LinearEasing
|
||||
import androidx.compose.animation.core.animateFloatAsState
|
||||
import androidx.compose.animation.core.tween
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.focusable
|
||||
import androidx.compose.foundation.gestures.awaitEachGesture
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.gestures.awaitFirstDown
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.widthIn
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.DragHandle
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableFloatStateOf
|
||||
import androidx.compose.runtime.mutableStateListOf
|
||||
import androidx.compose.runtime.mutableStateMapOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.runtime.withFrameNanos
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusProperties
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.focus.onFocusChanged
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.input.InputMode
|
||||
import androidx.compose.ui.input.key.onPreviewKeyEvent
|
||||
import androidx.compose.ui.input.pointer.PointerEventPass
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.material3.LocalTextStyle
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.platform.LocalInputModeManager
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.PlatformTextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.zIndex
|
||||
import com.droiddeck.launcher.R
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
private val ROW_HEIGHT = 44.dp
|
||||
private val HANDLE_WIDTH = 40.dp
|
||||
private const val RESET_HOLD_MS = 5_000
|
||||
private const val TAP_HOLD_MS = 400
|
||||
private val HINT_LABEL_WIDTH = 92.dp
|
||||
private val HINT_KEY_SIZE = 18.dp
|
||||
private val HINT_GAP = 8.dp
|
||||
private val HINT_LABEL_MIN = 24.dp
|
||||
private val HINT_ROOM = HINT_LABEL_MIN + HINT_KEY_SIZE + HINT_GAP
|
||||
|
||||
@Composable
|
||||
internal fun ResetHold(held: Boolean, onFire: () -> Unit): Float {
|
||||
val fill by animateFloatAsState(
|
||||
if (held) 1f else 0f,
|
||||
if (held) tween(RESET_HOLD_MS, easing = LinearEasing) else tween(120),
|
||||
label = "resetHold",
|
||||
)
|
||||
LaunchedEffect(held) {
|
||||
if (!held) return@LaunchedEffect
|
||||
delay(RESET_HOLD_MS.toLong())
|
||||
onFire()
|
||||
}
|
||||
return fill
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun HudKeyHints(grabbed: String?, resetFill: Float) {
|
||||
Column(
|
||||
horizontalAlignment = Alignment.End,
|
||||
verticalArrangement = Arrangement.spacedBy(6.dp),
|
||||
) {
|
||||
KeyHint("X", stringResource(R.string.hud_hint_reset), resetFill)
|
||||
KeyHint("Y", stringResource(if (grabbed != null) R.string.hud_hint_drop else R.string.hud_hint_grab))
|
||||
KeyHint("B", stringResource(R.string.hud_hint_save))
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun KeyHint(key: String, label: String, fill: Float = 0f) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(HINT_GAP),
|
||||
) {
|
||||
Text(
|
||||
label,
|
||||
fontSize = 11.sp,
|
||||
lineHeight = 14.sp,
|
||||
textAlign = TextAlign.End,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
maxLines = 2,
|
||||
modifier = Modifier.widthIn(max = HINT_LABEL_WIDTH),
|
||||
)
|
||||
Box(
|
||||
contentAlignment = Alignment.Center,
|
||||
modifier = Modifier.size(HINT_KEY_SIZE).clip(RoundedCornerShape(5.dp))
|
||||
.background(
|
||||
if (fill > 0f) MaterialTheme.colorScheme.primary.copy(alpha = 0.15f + 0.55f * fill)
|
||||
else MaterialTheme.colorScheme.surfaceVariant,
|
||||
)
|
||||
.border(1.dp, MaterialTheme.colorScheme.outline, RoundedCornerShape(5.dp)),
|
||||
) {
|
||||
Text(
|
||||
key,
|
||||
fontSize = 10.sp,
|
||||
lineHeight = 10.sp,
|
||||
textAlign = TextAlign.Center,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
style = LocalTextStyle.current.copy(
|
||||
platformStyle = PlatformTextStyle(includeFontPadding = false),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
internal fun HudReadingsDialog(
|
||||
visible: List<String>,
|
||||
initialOrder: List<String>,
|
||||
initialOn: Map<String, Boolean>,
|
||||
onDismiss: () -> Unit,
|
||||
onSave: (Map<String, Boolean>, List<String>) -> Unit,
|
||||
onReset: () -> Unit,
|
||||
controller: Boolean = LocalInputModeManager.current.inputMode == InputMode.Keyboard,
|
||||
) {
|
||||
val order = remember { mutableStateListOf<String>().apply { addAll(initialOrder.filter { it in visible }) } }
|
||||
val enabled = remember { mutableStateMapOf<String, Boolean>() }
|
||||
remember(initialOn) { for (key in initialOrder) enabled[key] = initialOn[key] == true; true }
|
||||
val merged = {
|
||||
val moved = order.toList()
|
||||
var i = 0
|
||||
initialOrder.map { if (it in visible) moved[i++] else it }
|
||||
}
|
||||
val shown = rememberShown { onDismiss() }
|
||||
val close = { shown.targetState = false }
|
||||
val save = { onSave(enabled.toMap(), merged()); close() }
|
||||
val restore = { onReset(); close() }
|
||||
val rowPx = with(LocalDensity.current) { ROW_HEIGHT.toPx() }
|
||||
var pad by remember { mutableStateOf(controller) }
|
||||
var yHeld by remember { mutableStateOf(false) }
|
||||
var yLong by remember { mutableStateOf(false) }
|
||||
var yStartedGrab by remember { mutableStateOf(false) }
|
||||
LaunchedEffect(yHeld) {
|
||||
if (!yHeld) return@LaunchedEffect
|
||||
delay(TAP_HOLD_MS.toLong())
|
||||
yLong = true
|
||||
}
|
||||
|
||||
var resetHeld by remember { mutableStateOf(false) }
|
||||
val resetFill = ResetHold(resetHeld, restore)
|
||||
|
||||
var dragging by remember { mutableStateOf(-1) }
|
||||
var dragOffset by remember { mutableFloatStateOf(0f) }
|
||||
|
||||
val panelFocus = remember { FocusRequester() }
|
||||
val firstKey = remember { order.firstOrNull() }
|
||||
val firstFocus = remember { FocusRequester() }
|
||||
LaunchedEffect(Unit) {
|
||||
runCatching { panelFocus.requestFocus() }
|
||||
repeat(30) {
|
||||
if (runCatching { firstFocus.requestFocus() }.isSuccess) return@LaunchedEffect
|
||||
withFrameNanos { }
|
||||
}
|
||||
}
|
||||
var focusedKey by remember { mutableStateOf<String?>(null) }
|
||||
var grabbed by remember { mutableStateOf<String?>(null) }
|
||||
val before = remember { mutableStateListOf<String>() }
|
||||
val grab = {
|
||||
val target = focusedKey ?: order.firstOrNull()
|
||||
if (target != null && grabbed == null && dragging < 0) {
|
||||
before.clear()
|
||||
before.addAll(order)
|
||||
grabbed = target
|
||||
}
|
||||
}
|
||||
val cancel = {
|
||||
val held = grabbed
|
||||
if (held != null) {
|
||||
order.clear()
|
||||
order.addAll(before)
|
||||
grabbed = null
|
||||
}
|
||||
}
|
||||
|
||||
AppDialog(
|
||||
shown, close, "hudReadings", wide = false, scrollable = false,
|
||||
modifier = Modifier.fillMaxHeight(),
|
||||
back = { if (grabbed != null) cancel() else if (pad) save() else close() },
|
||||
side = if (pad) {
|
||||
{ HudKeyHints(grabbed, resetFill) }
|
||||
} else {
|
||||
null
|
||||
},
|
||||
sideRoom = HINT_ROOM,
|
||||
) {
|
||||
val state = rememberLazyListState()
|
||||
val scope = rememberCoroutineScope()
|
||||
val handlePx = with(LocalDensity.current) { HANDLE_WIDTH.toPx() }
|
||||
Column(
|
||||
Modifier.fillMaxWidth().weight(1f).focusRequester(panelFocus).focusable()
|
||||
.onPreviewKeyEvent { event ->
|
||||
val key = event.nativeKeyEvent
|
||||
val down = key.action == KeyEvent.ACTION_DOWN
|
||||
if (down) pad = true
|
||||
val first = down && key.repeatCount == 0
|
||||
val held = grabbed
|
||||
when {
|
||||
key.keyCode == KeyEvent.KEYCODE_BUTTON_Y -> {
|
||||
when {
|
||||
down && first -> {
|
||||
yHeld = true
|
||||
yLong = key.flags and KeyEvent.FLAG_LONG_PRESS != 0
|
||||
yStartedGrab = grabbed == null
|
||||
if (yStartedGrab) grab()
|
||||
}
|
||||
down -> if (key.repeatCount > 0) yLong = true
|
||||
else -> {
|
||||
val drop = grabbed != null && (!yStartedGrab || yLong)
|
||||
yHeld = false
|
||||
if (drop) grabbed = null
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
key.keyCode == KeyEvent.KEYCODE_BUTTON_X && pad -> {
|
||||
resetHeld = down
|
||||
true
|
||||
}
|
||||
key.keyCode == KeyEvent.KEYCODE_BUTTON_A ||
|
||||
key.keyCode == KeyEvent.KEYCODE_ENTER ||
|
||||
key.keyCode == KeyEvent.KEYCODE_SPACE -> {
|
||||
val target = focusedKey
|
||||
when {
|
||||
held != null -> {
|
||||
if (first) grabbed = null
|
||||
true
|
||||
}
|
||||
target == null -> false
|
||||
else -> {
|
||||
if (first) enabled[target] = !(enabled[target] == true)
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
held == null -> false
|
||||
key.keyCode == KeyEvent.KEYCODE_DPAD_UP || key.keyCode == KeyEvent.KEYCODE_DPAD_DOWN -> {
|
||||
if (down) {
|
||||
val from = order.indexOf(held)
|
||||
val step = if (key.keyCode == KeyEvent.KEYCODE_DPAD_UP) -1 else 1
|
||||
val to = (from + step).coerceIn(0, order.lastIndex)
|
||||
if (to != from) {
|
||||
order.add(to, order.removeAt(from))
|
||||
val visible = state.layoutInfo.visibleItemsInfo
|
||||
if (visible.isNotEmpty()) {
|
||||
val first = visible.first().index
|
||||
val last = visible.last().index
|
||||
val target = when {
|
||||
to <= first -> to
|
||||
to > last -> (to - visible.size + 1).coerceAtLeast(0)
|
||||
else -> null
|
||||
}
|
||||
if (target != null) scope.launch { state.animateScrollToItem(target) }
|
||||
}
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
else -> false
|
||||
}
|
||||
},
|
||||
) {
|
||||
val list = @Composable { m: Modifier ->
|
||||
LazyColumn(state = state, modifier = m.pointerInput(Unit) {
|
||||
awaitEachGesture {
|
||||
val down = awaitFirstDown(requireUnconsumed = false)
|
||||
val item = state.layoutInfo.visibleItemsInfo.firstOrNull {
|
||||
it.offset <= down.position.y && down.position.y < it.offset + it.size
|
||||
}
|
||||
if (item == null || down.position.x > handlePx || grabbed != null) return@awaitEachGesture
|
||||
val start = item.index
|
||||
dragging = start
|
||||
dragOffset = 0f
|
||||
while (true) {
|
||||
val change = awaitPointerEvent(PointerEventPass.Initial).changes.firstOrNull { it.id == down.id } ?: break
|
||||
val travel = change.position.y - down.position.y
|
||||
change.consume()
|
||||
if (!change.pressed) break
|
||||
val target = (start + (travel / rowPx).roundToInt()).coerceIn(0, order.lastIndex)
|
||||
while (target != dragging) {
|
||||
val step = if (target > dragging) 1 else -1
|
||||
order.add(dragging + step, order.removeAt(dragging))
|
||||
dragging += step
|
||||
}
|
||||
dragOffset = travel - (dragging - start) * rowPx
|
||||
}
|
||||
dragging = -1
|
||||
dragOffset = 0f
|
||||
}
|
||||
}) {
|
||||
itemsIndexed(order, key = { _, key -> key }) { index, key ->
|
||||
val held = index == dragging || key == grabbed
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.fillMaxWidth().height(ROW_HEIGHT).testTag("hud-row-$key")
|
||||
.then(if (key == firstKey) Modifier.focusRequester(firstFocus) else Modifier)
|
||||
.onFocusChanged { if (it.isFocused) focusedKey = key else if (focusedKey == key) focusedKey = null }
|
||||
.zIndex(if (held) 1f else 0f)
|
||||
.graphicsLayer { translationY = if (index == dragging) dragOffset else 0f }
|
||||
.clip(Shape12)
|
||||
.background(
|
||||
if (held) MaterialTheme.colorScheme.surfaceVariant
|
||||
else MaterialTheme.colorScheme.surface,
|
||||
)
|
||||
.then(
|
||||
if (key == focusedKey) Modifier.border(2.dp, LocalPalette.current.signal, Shape12)
|
||||
else Modifier,
|
||||
)
|
||||
.focusable()
|
||||
.padding(start = 4.dp, end = 6.dp),
|
||||
) {
|
||||
Box(
|
||||
contentAlignment = Alignment.Center,
|
||||
modifier = Modifier.size(width = HANDLE_WIDTH, height = ROW_HEIGHT).testTag("hud-handle-$key"),
|
||||
) {
|
||||
Icon(
|
||||
Icons.Filled.DragHandle, null,
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.size(20.dp),
|
||||
)
|
||||
}
|
||||
val label = hudMetricLabel(key)
|
||||
Text(
|
||||
if (label != null) stringResource(label) else key,
|
||||
fontSize = 14.sp, color = MaterialTheme.colorScheme.onBackground, maxLines = 1,
|
||||
modifier = Modifier.weight(1f).padding(start = 2.dp),
|
||||
)
|
||||
ToggleSwitch(
|
||||
enabled[key] == true, true, null,
|
||||
modifier = Modifier.testTag("hud-switch-$key").focusProperties { canFocus = false },
|
||||
) { enabled[key] = !(enabled[key] == true) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
list(Modifier.weight(1f).fillMaxWidth())
|
||||
if (!pad) {
|
||||
Row(Modifier.fillMaxWidth().padding(top = 8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Box(Modifier.weight(1f))
|
||||
PrimaryButton(stringResource(R.string.common_ok), compact = true, onClick = save)
|
||||
SecondaryButton(stringResource(R.string.hud_reset_button), compact = true, onClick = restore)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -262,6 +262,8 @@ class DrawerActions(
|
||||
val selectedSecondScreenDisplay: Int,
|
||||
val onHud: (Boolean) -> Unit,
|
||||
val onHudSetting: (String, String) -> Unit = { _, _ -> },
|
||||
val onHudOrder: (Map<String, Boolean>, List<String>) -> Unit = { _, _ -> },
|
||||
val onHudOrderReset: () -> Unit = {},
|
||||
val onHudReset: () -> Unit = {},
|
||||
val onHudExport: () -> Unit = {},
|
||||
val onFrameGenPick: (FrameGen.Mode) -> Unit,
|
||||
|
||||
@@ -4211,4 +4211,15 @@
|
||||
<string name="soundtracks_no_tracks">لا توجد ملفات صوتية في هذه الموسيقى التصويرية</string>
|
||||
<string name="stores_rockstar_launch_unavailable">التشغيل غير متاح</string>
|
||||
<string name="agent_browser_unavailable">لا يتوفر متصفح ويب لفتح هذا الرابط.</string>
|
||||
<string name="hud_hint_grab">التقاط</string>
|
||||
<string name="hud_hint_drop">إفلات</string>
|
||||
<string name="hud_hint_save">حفظ</string>
|
||||
<string name="hud_hint_reset">اضغط مطولاً لإعادة الضبط</string>
|
||||
<string name="setup_stores">المتاجر</string>
|
||||
<string name="hud_metric_latency">زمن الإطار</string>
|
||||
<string name="hud_metric_avg">متوسط معدل الإطارات</string>
|
||||
<string name="hud_metric_display">خادم العرض</string>
|
||||
<string name="hud_metric_hdr">حالة HDR</string>
|
||||
<string name="hud_readings_shown">المعروض</string>
|
||||
<string name="hud_readings_count">%1$d من %2$d</string>
|
||||
</resources>
|
||||
@@ -4062,4 +4062,15 @@
|
||||
<string name="soundtracks_no_tracks">No hay archivos de audio en esta banda sonora</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Inicio no disponible</string>
|
||||
<string name="agent_browser_unavailable">No hay un navegador web disponible para abrir este enlace.</string>
|
||||
<string name="hud_hint_grab">Agarrar</string>
|
||||
<string name="hud_hint_drop">Soltar</string>
|
||||
<string name="hud_hint_save">Guardar</string>
|
||||
<string name="hud_hint_reset">Mantén para restablecer</string>
|
||||
<string name="setup_stores">Tiendas</string>
|
||||
<string name="hud_metric_latency">Tiempo de fotograma</string>
|
||||
<string name="hud_metric_avg">Frecuencia media de fotogramas</string>
|
||||
<string name="hud_metric_display">Servidor de pantalla</string>
|
||||
<string name="hud_metric_hdr">Estado HDR</string>
|
||||
<string name="hud_readings_shown">Mostrados</string>
|
||||
<string name="hud_readings_count">%1$d de %2$d</string>
|
||||
</resources>
|
||||
@@ -4051,4 +4051,15 @@
|
||||
<string name="soundtracks_no_tracks">В този саундтрак няма аудиофайлове</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Стартирането е недостъпно</string>
|
||||
<string name="agent_browser_unavailable">Няма наличен уеб браузър за отваряне на тази връзка.</string>
|
||||
<string name="hud_hint_grab">Хвани</string>
|
||||
<string name="hud_hint_drop">Пусни</string>
|
||||
<string name="hud_hint_save">Запиши</string>
|
||||
<string name="hud_hint_reset">Задръж за нулиране</string>
|
||||
<string name="setup_stores">Магазини</string>
|
||||
<string name="hud_metric_latency">Време на кадър</string>
|
||||
<string name="hud_metric_avg">Средна честота на кадрите</string>
|
||||
<string name="hud_metric_display">Сървър за показване</string>
|
||||
<string name="hud_metric_hdr">Състояние на HDR</string>
|
||||
<string name="hud_readings_shown">Показани</string>
|
||||
<string name="hud_readings_count">%1$d от %2$d</string>
|
||||
</resources>
|
||||
@@ -4131,4 +4131,15 @@
|
||||
<string name="soundtracks_no_tracks">V tomto soundtracku nejsou žádné zvukové soubory</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Spuštění není dostupné</string>
|
||||
<string name="agent_browser_unavailable">K otevření tohoto odkazu není k dispozici žádný webový prohlížeč.</string>
|
||||
<string name="hud_hint_grab">Uchopit</string>
|
||||
<string name="hud_hint_drop">Pustit</string>
|
||||
<string name="hud_hint_save">Uložit</string>
|
||||
<string name="hud_hint_reset">Podrž pro obnovení</string>
|
||||
<string name="setup_stores">Obchody</string>
|
||||
<string name="hud_metric_latency">Doba snímku</string>
|
||||
<string name="hud_metric_avg">Průměrná snímková frekvence</string>
|
||||
<string name="hud_metric_display">Zobrazovací server</string>
|
||||
<string name="hud_metric_hdr">Stav HDR</string>
|
||||
<string name="hud_readings_shown">Zobrazeno</string>
|
||||
<string name="hud_readings_count">%1$d z %2$d</string>
|
||||
</resources>
|
||||
@@ -4051,4 +4051,15 @@
|
||||
<string name="soundtracks_no_tracks">Ingen lydfiler i dette soundtrack</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Start er ikke tilgængelig</string>
|
||||
<string name="agent_browser_unavailable">Der er ingen tilgængelig webbrowser til at åbne dette link.</string>
|
||||
<string name="hud_hint_grab">Tag</string>
|
||||
<string name="hud_hint_drop">Slip</string>
|
||||
<string name="hud_hint_save">Gem</string>
|
||||
<string name="hud_hint_reset">Hold for at nulstille</string>
|
||||
<string name="setup_stores">Butikker</string>
|
||||
<string name="hud_metric_latency">Billedtid</string>
|
||||
<string name="hud_metric_avg">Gennemsnitlig billedhastighed</string>
|
||||
<string name="hud_metric_display">Visningsserver</string>
|
||||
<string name="hud_metric_hdr">HDR-status</string>
|
||||
<string name="hud_readings_shown">Vist</string>
|
||||
<string name="hud_readings_count">%1$d af %2$d</string>
|
||||
</resources>
|
||||
@@ -4051,4 +4051,15 @@
|
||||
<string name="soundtracks_no_tracks">Keine Audiodateien in diesem Soundtrack</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Start nicht verfügbar</string>
|
||||
<string name="agent_browser_unavailable">Es ist kein Webbrowser verfügbar, um diesen Link zu öffnen.</string>
|
||||
<string name="hud_hint_grab">Greifen</string>
|
||||
<string name="hud_hint_drop">Loslassen</string>
|
||||
<string name="hud_hint_save">Speichern</string>
|
||||
<string name="hud_hint_reset">Halten zum Zurücksetzen</string>
|
||||
<string name="setup_stores">Stores</string>
|
||||
<string name="hud_metric_latency">Frame-Zeit</string>
|
||||
<string name="hud_metric_avg">Durchschnittliche Bildrate</string>
|
||||
<string name="hud_metric_display">Anzeigeserver</string>
|
||||
<string name="hud_metric_hdr">HDR-Status</string>
|
||||
<string name="hud_readings_shown">Angezeigt</string>
|
||||
<string name="hud_readings_count">%1$d von %2$d</string>
|
||||
</resources>
|
||||
@@ -4051,4 +4051,15 @@
|
||||
<string name="soundtracks_no_tracks">Δεν υπάρχουν αρχεία ήχου σε αυτό το soundtrack</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Η εκκίνηση δεν είναι διαθέσιμη</string>
|
||||
<string name="agent_browser_unavailable">Δεν είναι διαθέσιμο πρόγραμμα περιήγησης ιστού για το άνοιγμα αυτού του συνδέσμου.</string>
|
||||
<string name="hud_hint_grab">Πιάσε</string>
|
||||
<string name="hud_hint_drop">Άφησε</string>
|
||||
<string name="hud_hint_save">Αποθήκευση</string>
|
||||
<string name="hud_hint_reset">Κράτησε για επαναφορά</string>
|
||||
<string name="setup_stores">Καταστήματα</string>
|
||||
<string name="hud_metric_latency">Χρόνος καρέ</string>
|
||||
<string name="hud_metric_avg">Μέσος ρυθμός καρέ</string>
|
||||
<string name="hud_metric_display">Διακομιστής προβολής</string>
|
||||
<string name="hud_metric_hdr">Κατάσταση HDR</string>
|
||||
<string name="hud_readings_shown">Εμφανίζονται</string>
|
||||
<string name="hud_readings_count">%1$d από %2$d</string>
|
||||
</resources>
|
||||
@@ -4091,4 +4091,15 @@
|
||||
<string name="soundtracks_no_tracks">No hay archivos de audio en esta banda sonora</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Inicio no disponible</string>
|
||||
<string name="agent_browser_unavailable">No hay ningún navegador web disponible para abrir este enlace.</string>
|
||||
<string name="hud_hint_grab">Agarrar</string>
|
||||
<string name="hud_hint_drop">Soltar</string>
|
||||
<string name="hud_hint_save">Guardar</string>
|
||||
<string name="hud_hint_reset">Mantén para restablecer</string>
|
||||
<string name="setup_stores">Tiendas</string>
|
||||
<string name="hud_metric_latency">Tiempo de fotograma</string>
|
||||
<string name="hud_metric_avg">Frecuencia media de fotogramas</string>
|
||||
<string name="hud_metric_display">Servidor de pantalla</string>
|
||||
<string name="hud_metric_hdr">Estado HDR</string>
|
||||
<string name="hud_readings_shown">Mostrados</string>
|
||||
<string name="hud_readings_count">%1$d de %2$d</string>
|
||||
</resources>
|
||||
@@ -4051,4 +4051,15 @@
|
||||
<string name="soundtracks_no_tracks">Tässä soundtrackissa ei ole äänitiedostoja</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Käynnistäminen ei ole mahdollista</string>
|
||||
<string name="agent_browser_unavailable">Tämän linkin avaamiseen ei ole käytettävissä verkkoselainta.</string>
|
||||
<string name="hud_hint_grab">Tartu</string>
|
||||
<string name="hud_hint_drop">Pudota</string>
|
||||
<string name="hud_hint_save">Tallenna</string>
|
||||
<string name="hud_hint_reset">Pidä palauttaaksesi</string>
|
||||
<string name="setup_stores">Kaupat</string>
|
||||
<string name="hud_metric_latency">Kuvan aika</string>
|
||||
<string name="hud_metric_avg">Keskimääräinen kuvataajuus</string>
|
||||
<string name="hud_metric_display">Näyttöpalvelin</string>
|
||||
<string name="hud_metric_hdr">HDR-tila</string>
|
||||
<string name="hud_readings_shown">Näkyvissä</string>
|
||||
<string name="hud_readings_count">%1$d / %2$d</string>
|
||||
</resources>
|
||||
@@ -4090,4 +4090,15 @@
|
||||
<string name="soundtracks_no_tracks">Aucun fichier audio dans cette bande originale</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Lancement indisponible</string>
|
||||
<string name="agent_browser_unavailable">Aucun navigateur Web n’est disponible pour ouvrir ce lien.</string>
|
||||
<string name="hud_hint_grab">Saisir</string>
|
||||
<string name="hud_hint_drop">Déposer</string>
|
||||
<string name="hud_hint_save">Enregistrer</string>
|
||||
<string name="hud_hint_reset">Maintenir pour réinitialiser</string>
|
||||
<string name="setup_stores">Boutiques</string>
|
||||
<string name="hud_metric_latency">Temps de frame</string>
|
||||
<string name="hud_metric_avg">Frequence moyenne des images</string>
|
||||
<string name="hud_metric_display">Serveur graphique</string>
|
||||
<string name="hud_metric_hdr">État HDR</string>
|
||||
<string name="hud_readings_shown">Affichés</string>
|
||||
<string name="hud_readings_count">%1$d sur %2$d</string>
|
||||
</resources>
|
||||
@@ -4051,4 +4051,15 @@
|
||||
<string name="soundtracks_no_tracks">इस साउंडट्रैक में कोई ऑडियो फ़ाइल नहीं है</string>
|
||||
<string name="stores_rockstar_launch_unavailable">लॉन्च उपलब्ध नहीं</string>
|
||||
<string name="agent_browser_unavailable">इस लिंक को खोलने के लिए कोई वेब ब्राउज़र उपलब्ध नहीं है।</string>
|
||||
<string name="hud_hint_grab">पकड़ें</string>
|
||||
<string name="hud_hint_drop">छोड़ें</string>
|
||||
<string name="hud_hint_save">सेव करें</string>
|
||||
<string name="hud_hint_reset">रीसेट के लिए दबाए रखें</string>
|
||||
<string name="setup_stores">स्टोर</string>
|
||||
<string name="hud_metric_latency">फ़्रेम समय</string>
|
||||
<string name="hud_metric_avg">औसत फ़्रेम दर</string>
|
||||
<string name="hud_metric_display">डिस्प्ले सर्वर</string>
|
||||
<string name="hud_metric_hdr">HDR स्थिति</string>
|
||||
<string name="hud_readings_shown">दिखाए गए</string>
|
||||
<string name="hud_readings_count">%2$d में से %1$d</string>
|
||||
</resources>
|
||||
@@ -4051,4 +4051,15 @@
|
||||
<string name="soundtracks_no_tracks">Nincs hangfájl ebben a soundtrackben</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Indítás nem elérhető</string>
|
||||
<string name="agent_browser_unavailable">Nincs elérhető webböngésző a hivatkozás megnyitásához.</string>
|
||||
<string name="hud_hint_grab">Megfogás</string>
|
||||
<string name="hud_hint_drop">Elengedés</string>
|
||||
<string name="hud_hint_save">Mentés</string>
|
||||
<string name="hud_hint_reset">Tartsd nyomva a visszaállításhoz</string>
|
||||
<string name="setup_stores">Áruházak</string>
|
||||
<string name="hud_metric_latency">Képkockaidő</string>
|
||||
<string name="hud_metric_avg">Átlagos képkockasebesség</string>
|
||||
<string name="hud_metric_display">Megjelenítő kiszolgáló</string>
|
||||
<string name="hud_metric_hdr">HDR állapot</string>
|
||||
<string name="hud_readings_shown">Megjelenítve</string>
|
||||
<string name="hud_readings_count">%1$d / %2$d</string>
|
||||
</resources>
|
||||
@@ -4021,4 +4021,15 @@
|
||||
<string name="soundtracks_no_tracks">Tidak ada file audio di soundtrack ini</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Peluncuran tidak tersedia</string>
|
||||
<string name="agent_browser_unavailable">Tidak ada browser web yang tersedia untuk membuka tautan ini.</string>
|
||||
<string name="hud_hint_grab">Ambil</string>
|
||||
<string name="hud_hint_drop">Lepas</string>
|
||||
<string name="hud_hint_save">Simpan</string>
|
||||
<string name="hud_hint_reset">Tahan untuk setel ulang</string>
|
||||
<string name="setup_stores">Toko</string>
|
||||
<string name="hud_metric_latency">Waktu frame</string>
|
||||
<string name="hud_metric_avg">Rata-rata laju frame</string>
|
||||
<string name="hud_metric_display">Server tampilan</string>
|
||||
<string name="hud_metric_hdr">Status HDR</string>
|
||||
<string name="hud_readings_shown">Ditampilkan</string>
|
||||
<string name="hud_readings_count">%1$d dari %2$d</string>
|
||||
</resources>
|
||||
@@ -4090,4 +4090,15 @@
|
||||
<string name="soundtracks_no_tracks">Nessun file audio in questa colonna sonora</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Avvio non disponibile</string>
|
||||
<string name="agent_browser_unavailable">Non è disponibile alcun browser web per aprire questo link.</string>
|
||||
<string name="hud_hint_grab">Afferra</string>
|
||||
<string name="hud_hint_drop">Rilascia</string>
|
||||
<string name="hud_hint_save">Salva</string>
|
||||
<string name="hud_hint_reset">Tieni premuto per ripristinare</string>
|
||||
<string name="setup_stores">Negozi</string>
|
||||
<string name="hud_metric_latency">Tempo frame</string>
|
||||
<string name="hud_metric_avg">Frequenza media fotogrammi</string>
|
||||
<string name="hud_metric_display">Server di visualizzazione</string>
|
||||
<string name="hud_metric_hdr">Stato HDR</string>
|
||||
<string name="hud_readings_shown">Mostrati</string>
|
||||
<string name="hud_readings_count">%1$d di %2$d</string>
|
||||
</resources>
|
||||
@@ -4021,4 +4021,15 @@
|
||||
<string name="soundtracks_no_tracks">このサウンドトラックに音声ファイルがありません</string>
|
||||
<string name="stores_rockstar_launch_unavailable">起動できません</string>
|
||||
<string name="agent_browser_unavailable">このリンクを開けるウェブブラウザがありません。</string>
|
||||
<string name="hud_hint_grab">掴む</string>
|
||||
<string name="hud_hint_drop">離す</string>
|
||||
<string name="hud_hint_save">保存</string>
|
||||
<string name="hud_hint_reset">長押しでリセット</string>
|
||||
<string name="setup_stores">ストア</string>
|
||||
<string name="hud_metric_latency">フレーム時間</string>
|
||||
<string name="hud_metric_avg">平均フレームレート</string>
|
||||
<string name="hud_metric_display">表示サーバー</string>
|
||||
<string name="hud_metric_hdr">HDR 状態</string>
|
||||
<string name="hud_readings_shown">表示中</string>
|
||||
<string name="hud_readings_count">%2$d 中 %1$d</string>
|
||||
</resources>
|
||||
@@ -4021,4 +4021,15 @@
|
||||
<string name="soundtracks_no_tracks">이 사운드트랙에 오디오 파일이 없습니다</string>
|
||||
<string name="stores_rockstar_launch_unavailable">실행할 수 없음</string>
|
||||
<string name="agent_browser_unavailable">이 링크를 열 수 있는 웹 브라우저가 없습니다.</string>
|
||||
<string name="hud_hint_grab">잡기</string>
|
||||
<string name="hud_hint_drop">놓기</string>
|
||||
<string name="hud_hint_save">저장</string>
|
||||
<string name="hud_hint_reset">길게 눌러 초기화</string>
|
||||
<string name="setup_stores">스토어</string>
|
||||
<string name="hud_metric_latency">프레임 시간</string>
|
||||
<string name="hud_metric_avg">평균 프레임 속도</string>
|
||||
<string name="hud_metric_display">디스플레이 서버</string>
|
||||
<string name="hud_metric_hdr">HDR 상태</string>
|
||||
<string name="hud_readings_shown">표시됨</string>
|
||||
<string name="hud_readings_count">%2$d 중 %1$d</string>
|
||||
</resources>
|
||||
@@ -4021,4 +4021,15 @@
|
||||
<string name="soundtracks_no_tracks">Tiada fail audio dalam runut bunyi ini</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Pelancaran tidak tersedia</string>
|
||||
<string name="agent_browser_unavailable">Tiada penyemak imbas web tersedia untuk membuka pautan ini.</string>
|
||||
<string name="hud_hint_grab">Ambil</string>
|
||||
<string name="hud_hint_drop">Lepas</string>
|
||||
<string name="hud_hint_save">Simpan</string>
|
||||
<string name="hud_hint_reset">Tahan untuk set semula</string>
|
||||
<string name="setup_stores">Kedai</string>
|
||||
<string name="hud_metric_latency">Masa bingkai</string>
|
||||
<string name="hud_metric_avg">Purata kadar bingkai</string>
|
||||
<string name="hud_metric_display">Pelayan paparan</string>
|
||||
<string name="hud_metric_hdr">Keadaan HDR</string>
|
||||
<string name="hud_readings_shown">Dipaparkan</string>
|
||||
<string name="hud_readings_count">%1$d daripada %2$d</string>
|
||||
</resources>
|
||||
@@ -4051,4 +4051,15 @@
|
||||
<string name="soundtracks_no_tracks">Ingen lydfiler i dette lydsporet</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Start utilgjengelig</string>
|
||||
<string name="agent_browser_unavailable">Ingen nettleser er tilgjengelig for å åpne denne lenken.</string>
|
||||
<string name="hud_hint_grab">Ta tak</string>
|
||||
<string name="hud_hint_drop">Slipp</string>
|
||||
<string name="hud_hint_save">Lagre</string>
|
||||
<string name="hud_hint_reset">Hold for å tilbakestille</string>
|
||||
<string name="setup_stores">Butikker</string>
|
||||
<string name="hud_metric_latency">Bildetid</string>
|
||||
<string name="hud_metric_avg">Gjennomsnittlig bildefrekvens</string>
|
||||
<string name="hud_metric_display">Visningstjener</string>
|
||||
<string name="hud_metric_hdr">HDR-status</string>
|
||||
<string name="hud_readings_shown">Vist</string>
|
||||
<string name="hud_readings_count">%1$d av %2$d</string>
|
||||
</resources>
|
||||
@@ -4051,4 +4051,15 @@
|
||||
<string name="soundtracks_no_tracks">Geen audiobestanden in deze soundtrack</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Starten niet beschikbaar</string>
|
||||
<string name="agent_browser_unavailable">Er is geen webbrowser beschikbaar om deze link te openen.</string>
|
||||
<string name="hud_hint_grab">Pakken</string>
|
||||
<string name="hud_hint_drop">Loslaten</string>
|
||||
<string name="hud_hint_save">Opslaan</string>
|
||||
<string name="hud_hint_reset">Houd vast om te resetten</string>
|
||||
<string name="setup_stores">Winkels</string>
|
||||
<string name="hud_metric_latency">Frametijd</string>
|
||||
<string name="hud_metric_avg">Gemiddelde framesnelheid</string>
|
||||
<string name="hud_metric_display">Weergaveserver</string>
|
||||
<string name="hud_metric_hdr">HDR-status</string>
|
||||
<string name="hud_readings_shown">Getoond</string>
|
||||
<string name="hud_readings_count">%1$d van %2$d</string>
|
||||
</resources>
|
||||
@@ -4131,4 +4131,15 @@
|
||||
<string name="soundtracks_no_tracks">Brak plików audio w tej ścieżce dźwiękowej</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Uruchomienie niedostępne</string>
|
||||
<string name="agent_browser_unavailable">Brak przeglądarki internetowej do otwarcia tego linku.</string>
|
||||
<string name="hud_hint_grab">Chwyć</string>
|
||||
<string name="hud_hint_drop">Upuść</string>
|
||||
<string name="hud_hint_save">Zapisz</string>
|
||||
<string name="hud_hint_reset">Przytrzymaj, aby zresetować</string>
|
||||
<string name="setup_stores">Sklepy</string>
|
||||
<string name="hud_metric_latency">Czas klatki</string>
|
||||
<string name="hud_metric_avg">Średnia liczba klatek</string>
|
||||
<string name="hud_metric_display">Serwer wyświetlania</string>
|
||||
<string name="hud_metric_hdr">Stan HDR</string>
|
||||
<string name="hud_readings_shown">Pokazane</string>
|
||||
<string name="hud_readings_count">%1$d z %2$d</string>
|
||||
</resources>
|
||||
@@ -4090,4 +4090,15 @@
|
||||
<string name="soundtracks_no_tracks">Nenhum ficheiro de áudio nesta banda sonora</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Início indisponível</string>
|
||||
<string name="agent_browser_unavailable">Não há nenhum navegador disponível para abrir esta ligação.</string>
|
||||
<string name="hud_hint_grab">Agarrar</string>
|
||||
<string name="hud_hint_drop">Largar</string>
|
||||
<string name="hud_hint_save">Guardar</string>
|
||||
<string name="hud_hint_reset">Mantenha para repor</string>
|
||||
<string name="setup_stores">Lojas</string>
|
||||
<string name="hud_metric_latency">Tempo de frame</string>
|
||||
<string name="hud_metric_avg">Taxa média de frames</string>
|
||||
<string name="hud_metric_display">Servidor de ecrã</string>
|
||||
<string name="hud_metric_hdr">Estado HDR</string>
|
||||
<string name="hud_readings_shown">Mostrados</string>
|
||||
<string name="hud_readings_count">%1$d de %2$d</string>
|
||||
</resources>
|
||||
@@ -4091,4 +4091,15 @@
|
||||
<string name="soundtracks_no_tracks">Nenhum arquivo de áudio nesta trilha sonora</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Inicialização indisponível</string>
|
||||
<string name="agent_browser_unavailable">Nenhum navegador está disponível para abrir este link.</string>
|
||||
<string name="hud_hint_grab">Agarrar</string>
|
||||
<string name="hud_hint_drop">Soltar</string>
|
||||
<string name="hud_hint_save">Salvar</string>
|
||||
<string name="hud_hint_reset">Segure para redefinir</string>
|
||||
<string name="setup_stores">Lojas</string>
|
||||
<string name="hud_metric_latency">Tempo de quadro</string>
|
||||
<string name="hud_metric_avg">Taxa média de quadros</string>
|
||||
<string name="hud_metric_display">Servidor de exibição</string>
|
||||
<string name="hud_metric_hdr">Estado HDR</string>
|
||||
<string name="hud_readings_shown">Exibidos</string>
|
||||
<string name="hud_readings_count">%1$d de %2$d</string>
|
||||
</resources>
|
||||
@@ -4091,4 +4091,15 @@
|
||||
<string name="soundtracks_no_tracks">Niciun fișier audio în această coloană sonoră</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Lansare indisponibilă</string>
|
||||
<string name="agent_browser_unavailable">Nu este disponibil niciun browser web pentru a deschide acest link.</string>
|
||||
<string name="hud_hint_grab">Prinde</string>
|
||||
<string name="hud_hint_drop">Lasă</string>
|
||||
<string name="hud_hint_save">Salvează</string>
|
||||
<string name="hud_hint_reset">Ține apăsat pentru resetare</string>
|
||||
<string name="setup_stores">Magazine</string>
|
||||
<string name="hud_metric_latency">Timp cadru</string>
|
||||
<string name="hud_metric_avg">Rata medie de cadre</string>
|
||||
<string name="hud_metric_display">Server de afișare</string>
|
||||
<string name="hud_metric_hdr">Stare HDR</string>
|
||||
<string name="hud_readings_shown">Afișate</string>
|
||||
<string name="hud_readings_count">%1$d din %2$d</string>
|
||||
</resources>
|
||||
@@ -4131,4 +4131,15 @@
|
||||
<string name="soundtracks_no_tracks">В этом саундтреке нет аудиофайлов</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Запуск недоступен</string>
|
||||
<string name="agent_browser_unavailable">Нет доступного веб-браузера для открытия этой ссылки.</string>
|
||||
<string name="hud_hint_grab">Взять</string>
|
||||
<string name="hud_hint_drop">Отпустить</string>
|
||||
<string name="hud_hint_save">Сохранить</string>
|
||||
<string name="hud_hint_reset">Удерживайте для сброса</string>
|
||||
<string name="setup_stores">Магазины</string>
|
||||
<string name="hud_metric_latency">Время кадра</string>
|
||||
<string name="hud_metric_avg">Средняя частота кадров</string>
|
||||
<string name="hud_metric_display">Сервер вывода</string>
|
||||
<string name="hud_metric_hdr">Состояние HDR</string>
|
||||
<string name="hud_readings_shown">Показано</string>
|
||||
<string name="hud_readings_count">%1$d из %2$d</string>
|
||||
</resources>
|
||||
@@ -4051,4 +4051,15 @@
|
||||
<string name="soundtracks_no_tracks">Inga ljudfiler i detta soundtrack</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Kan inte starta</string>
|
||||
<string name="agent_browser_unavailable">Ingen webbläsare är tillgänglig för att öppna den här länken.</string>
|
||||
<string name="hud_hint_grab">Greppa</string>
|
||||
<string name="hud_hint_drop">Släpp</string>
|
||||
<string name="hud_hint_save">Spara</string>
|
||||
<string name="hud_hint_reset">Håll för att återställa</string>
|
||||
<string name="setup_stores">Butiker</string>
|
||||
<string name="hud_metric_latency">Bildtid</string>
|
||||
<string name="hud_metric_avg">Genomsnittlig bildfrekvens</string>
|
||||
<string name="hud_metric_display">Visningsserver</string>
|
||||
<string name="hud_metric_hdr">HDR-status</string>
|
||||
<string name="hud_readings_shown">Visade</string>
|
||||
<string name="hud_readings_count">%1$d av %2$d</string>
|
||||
</resources>
|
||||
@@ -4021,4 +4021,15 @@
|
||||
<string name="soundtracks_no_tracks">ไม่พบไฟล์เสียงในซาวด์แทร็กนี้</string>
|
||||
<string name="stores_rockstar_launch_unavailable">ไม่สามารถเปิดได้</string>
|
||||
<string name="agent_browser_unavailable">ไม่มีเว็บเบราว์เซอร์ที่เปิดลิงก์นี้ได้</string>
|
||||
<string name="hud_hint_grab">หยิบ</string>
|
||||
<string name="hud_hint_drop">วาง</string>
|
||||
<string name="hud_hint_save">บันทึก</string>
|
||||
<string name="hud_hint_reset">กดค้างเพื่อรีเซ็ต</string>
|
||||
<string name="setup_stores">สโตร์</string>
|
||||
<string name="hud_metric_latency">เวลาเฟรม</string>
|
||||
<string name="hud_metric_avg">อัตราเฟรมเฉลี่ย</string>
|
||||
<string name="hud_metric_display">เซิร์ฟเวอร์แสดงผล</string>
|
||||
<string name="hud_metric_hdr">สถานะ HDR</string>
|
||||
<string name="hud_readings_shown">ที่แสดง</string>
|
||||
<string name="hud_readings_count">%1$d จาก %2$d</string>
|
||||
</resources>
|
||||
@@ -4051,4 +4051,15 @@
|
||||
<string name="soundtracks_no_tracks">Bu oyun müziğinde ses dosyası yok</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Başlatma kullanılamıyor</string>
|
||||
<string name="agent_browser_unavailable">Bu bağlantıyı açmak için kullanılabilir bir web tarayıcısı yok.</string>
|
||||
<string name="hud_hint_grab">Tut</string>
|
||||
<string name="hud_hint_drop">Bırak</string>
|
||||
<string name="hud_hint_save">Kaydet</string>
|
||||
<string name="hud_hint_reset">Sıfırlamak için basılı tut</string>
|
||||
<string name="setup_stores">Mağazalar</string>
|
||||
<string name="hud_metric_latency">Kare süresi</string>
|
||||
<string name="hud_metric_avg">Ortalama kare hızı</string>
|
||||
<string name="hud_metric_display">Görüntü sunucusu</string>
|
||||
<string name="hud_metric_hdr">HDR durumu</string>
|
||||
<string name="hud_readings_shown">Gösterilen</string>
|
||||
<string name="hud_readings_count">%1$d / %2$d</string>
|
||||
</resources>
|
||||
@@ -4131,4 +4131,15 @@
|
||||
<string name="soundtracks_no_tracks">У цьому саундтреку немає аудіофайлів</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Запуск недоступний</string>
|
||||
<string name="agent_browser_unavailable">Немає веббраузера, щоб відкрити це посилання.</string>
|
||||
<string name="hud_hint_grab">Взяти</string>
|
||||
<string name="hud_hint_drop">Відпустити</string>
|
||||
<string name="hud_hint_save">Зберегти</string>
|
||||
<string name="hud_hint_reset">Утримуйте для скидання</string>
|
||||
<string name="setup_stores">Магазини</string>
|
||||
<string name="hud_metric_latency">Час кадру</string>
|
||||
<string name="hud_metric_avg">Середня частота кадрів</string>
|
||||
<string name="hud_metric_display">Сервер виводу</string>
|
||||
<string name="hud_metric_hdr">Стан HDR</string>
|
||||
<string name="hud_readings_shown">Показано</string>
|
||||
<string name="hud_readings_count">%1$d з %2$d</string>
|
||||
</resources>
|
||||
@@ -4021,4 +4021,15 @@
|
||||
<string name="soundtracks_no_tracks">Không có tệp âm thanh trong nhạc nền này</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Không thể khởi chạy</string>
|
||||
<string name="agent_browser_unavailable">Không có trình duyệt web nào để mở liên kết này.</string>
|
||||
<string name="hud_hint_grab">Nắm</string>
|
||||
<string name="hud_hint_drop">Thả</string>
|
||||
<string name="hud_hint_save">Lưu</string>
|
||||
<string name="hud_hint_reset">Giữ để đặt lại</string>
|
||||
<string name="setup_stores">Cửa hàng</string>
|
||||
<string name="hud_metric_latency">Thời gian khung hình</string>
|
||||
<string name="hud_metric_avg">Tốc độ khung hình trung bình</string>
|
||||
<string name="hud_metric_display">Máy chủ hiển thị</string>
|
||||
<string name="hud_metric_hdr">Trạng thái HDR</string>
|
||||
<string name="hud_readings_shown">Đang hiển thị</string>
|
||||
<string name="hud_readings_count">%1$d trên %2$d</string>
|
||||
</resources>
|
||||
@@ -4021,4 +4021,15 @@
|
||||
<string name="soundtracks_no_tracks">此原声音乐中没有音频文件</string>
|
||||
<string name="stores_rockstar_launch_unavailable">无法启动</string>
|
||||
<string name="agent_browser_unavailable">没有可用的浏览器来打开此链接。</string>
|
||||
<string name="hud_hint_grab">抓取</string>
|
||||
<string name="hud_hint_drop">放下</string>
|
||||
<string name="hud_hint_save">保存</string>
|
||||
<string name="hud_hint_reset">长按重置</string>
|
||||
<string name="setup_stores">游戏商店</string>
|
||||
<string name="hud_metric_latency">帧时间</string>
|
||||
<string name="hud_metric_avg">平均帧率</string>
|
||||
<string name="hud_metric_display">显示服务器</string>
|
||||
<string name="hud_metric_hdr">HDR 状态</string>
|
||||
<string name="hud_readings_shown">已显示</string>
|
||||
<string name="hud_readings_count">%1$d / %2$d</string>
|
||||
</resources>
|
||||
@@ -4021,4 +4021,15 @@
|
||||
<string name="soundtracks_no_tracks">此原聲帶中沒有音訊檔案</string>
|
||||
<string name="stores_rockstar_launch_unavailable">無法啟動</string>
|
||||
<string name="agent_browser_unavailable">沒有可用的網頁瀏覽器可開啟此連結。</string>
|
||||
<string name="hud_hint_grab">抓取</string>
|
||||
<string name="hud_hint_drop">放下</string>
|
||||
<string name="hud_hint_save">儲存</string>
|
||||
<string name="hud_hint_reset">長按重設</string>
|
||||
<string name="setup_stores">商店</string>
|
||||
<string name="hud_metric_latency">幀時間</string>
|
||||
<string name="hud_metric_avg">平均幀率</string>
|
||||
<string name="hud_metric_display">顯示服務</string>
|
||||
<string name="hud_metric_hdr">HDR 狀態</string>
|
||||
<string name="hud_readings_shown">已顯示</string>
|
||||
<string name="hud_readings_count">%1$d / %2$d</string>
|
||||
</resources>
|
||||
@@ -4021,4 +4021,15 @@
|
||||
<string name="soundtracks_no_tracks">此原聲帶中沒有音訊檔案</string>
|
||||
<string name="stores_rockstar_launch_unavailable">無法啟動</string>
|
||||
<string name="agent_browser_unavailable">沒有可用的網頁瀏覽器可開啟此連結。</string>
|
||||
<string name="hud_hint_grab">抓取</string>
|
||||
<string name="hud_hint_drop">放下</string>
|
||||
<string name="hud_hint_save">儲存</string>
|
||||
<string name="hud_hint_reset">長按重設</string>
|
||||
<string name="setup_stores">遊戲商店</string>
|
||||
<string name="hud_metric_latency">幀時間</string>
|
||||
<string name="hud_metric_avg">平均幀率</string>
|
||||
<string name="hud_metric_display">顯示伺服器</string>
|
||||
<string name="hud_metric_hdr">HDR 狀態</string>
|
||||
<string name="hud_readings_shown">已顯示</string>
|
||||
<string name="hud_readings_count">%1$d / %2$d</string>
|
||||
</resources>
|
||||
@@ -4090,4 +4090,15 @@
|
||||
<string name="soundtracks_no_tracks">No audio files found in this soundtrack</string>
|
||||
<string name="stores_rockstar_launch_unavailable">Launch unavailable</string>
|
||||
<string name="agent_browser_unavailable">No web browser is available to open this link.</string>
|
||||
<string name="hud_hint_grab">Grab</string>
|
||||
<string name="hud_hint_drop">Drop</string>
|
||||
<string name="hud_hint_save">Save</string>
|
||||
<string name="hud_hint_reset">Hold to reset</string>
|
||||
<string name="setup_stores">Stores</string>
|
||||
<string name="hud_metric_latency">Frame time</string>
|
||||
<string name="hud_metric_avg">Average frame rate</string>
|
||||
<string name="hud_metric_display">Display server</string>
|
||||
<string name="hud_metric_hdr">HDR state</string>
|
||||
<string name="hud_readings_shown">Shown</string>
|
||||
<string name="hud_readings_count">%1$d of %2$d</string>
|
||||
</resources>
|
||||
@@ -51,11 +51,12 @@ class DroidDeckHudPanelTest {
|
||||
key to if (mask and (1 shl index) != 0) "1" else "0"
|
||||
}.toMap()
|
||||
view.applyConfig(DroidDeckHudConfig.encode(DroidDeckHudConfig.DEFAULTS +
|
||||
("hudSize" to size.token) + settings))
|
||||
DroidDeckHudConfig.ORDER.associateWith { "0" } + settings + mapOf(
|
||||
"hudSize" to size.token, "showFPSGraph" to "0", "showClock" to "0")))
|
||||
view.showForTest(SNAPSHOT, "DXVK", 0L)
|
||||
val lines = view.linesForTest().joinToString(" ")
|
||||
for ((index, metric) in metrics.withIndex()) {
|
||||
val supported = size != DroidDeckHudSize.TILES || index == 0
|
||||
val supported = metrics[index].first in size.rows
|
||||
val expected = supported && mask and (1 shl index) != 0
|
||||
val label = Regex("(?<![0-9.])${Regex.escape(metric.second)}")
|
||||
assertEquals("$size, mask=$mask, ${metric.second}: $lines", expected, label.containsMatchIn(lines))
|
||||
@@ -100,6 +101,70 @@ class DroidDeckHudPanelTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun aSwitchTurnsItsRowOff() {
|
||||
fun full(vararg settings: Pair<String, String>): List<String> {
|
||||
val values = LinkedHashMap(DroidDeckHudConfig.DEFAULTS)
|
||||
values["hudSize"] = DroidDeckHudSize.FULL.token
|
||||
for ((key, value) in settings) values[key] = value
|
||||
val view = DroidDeckHudView(RuntimeEnvironment.getApplication())
|
||||
view.applyConfig(DroidDeckHudConfig.encode(values))
|
||||
view.showForTest(SNAPSHOT, "DXVK", 0L)
|
||||
return view.linesForTest()
|
||||
}
|
||||
assertTrue(full().toString(), full().any { "RAM67%" in it })
|
||||
val noRam = full("showRAM" to "0")
|
||||
assertFalse(noRam.toString(), noRam.any { "RAM67%" in it })
|
||||
assertTrue(noRam.toString(), noRam.any { "FPS0.0" in it })
|
||||
}
|
||||
|
||||
@Test fun theSavedOrderDecidesTheRowOrder() {
|
||||
fun only(order: String): List<String> {
|
||||
val off = DroidDeckHudConfig.ORDER.associateWith { "0" }
|
||||
val view = DroidDeckHudView(RuntimeEnvironment.getApplication())
|
||||
view.applyConfig(DroidDeckHudConfig.encode(
|
||||
DroidDeckHudConfig.DEFAULTS + off + mapOf(
|
||||
"hudSize" to DroidDeckHudSize.FULL.token,
|
||||
"showPower" to "1", "showFPS" to "1", "showRAM" to "1",
|
||||
"showFPSGraph" to "0", "showClock" to "0", "hudOrder" to order,
|
||||
)))
|
||||
view.showForTest(SNAPSHOT, "DXVK", 0L)
|
||||
return view.linesForTest().filter { !it.startsWith("DroidDeck") }
|
||||
}
|
||||
val powerFirst = only("full:showPower|showFPS|showRAM")
|
||||
assertEquals(powerFirst.toString(), listOf("PWR", "FPS", "RAM"), powerFirst.map { it.take(3) })
|
||||
val ramFirst = only("full:showRAM|showFPS|showPower")
|
||||
assertEquals(ramFirst.toString(), listOf("RAM", "FPS", "PWR"), ramFirst.map { it.take(3) })
|
||||
}
|
||||
|
||||
@Test fun aSaveKeepsTheLegacyOrderForTheOtherSizes() {
|
||||
val app = RuntimeEnvironment.getApplication()
|
||||
SessionPrefs.setDroidDeckHudConfig(app, "hudSize=strip,hudOrder=showRAM|showFPS")
|
||||
val saved = DroidDeckHudConfig.choose(app, emptyMap(), listOf("showFPS", "showRAM"))
|
||||
assertEquals(listOf("showRAM", "showFPS"), DroidDeckHudConfig.storedOrder(saved, DroidDeckHudSize.FULL))
|
||||
assertEquals(listOf("showFPS", "showRAM"), DroidDeckHudConfig.storedOrder(saved, DroidDeckHudSize.STRIP))
|
||||
}
|
||||
|
||||
@Test fun thePillHeroIsWhicheverRowTheUserPutsFirst() {
|
||||
fun pill(order: String): List<String> {
|
||||
val off = DroidDeckHudConfig.ORDER.associateWith { "0" }
|
||||
val view = DroidDeckHudView(RuntimeEnvironment.getApplication())
|
||||
view.applyConfig(DroidDeckHudConfig.encode(
|
||||
DroidDeckHudConfig.DEFAULTS + off + mapOf(
|
||||
"hudSize" to DroidDeckHudSize.PILL.token,
|
||||
"showFPS" to "1", "showRAM" to "1", "showPower" to "1",
|
||||
"showFPSGraph" to "0", "showClock" to "0",
|
||||
"hudOrder" to order,
|
||||
)))
|
||||
view.showForTest(SNAPSHOT, "DXVK", 0L)
|
||||
return view.linesForTest()
|
||||
}
|
||||
val fpsFirst = pill("pill:showFPS|showRAM|showPower")
|
||||
assertTrue(fpsFirst.toString(), fpsFirst.any { it.trim() == "0.0fps" })
|
||||
val fpsLast = pill("pill:showRAM|showPower|showFPS")
|
||||
assertTrue(fpsLast.toString(), fpsLast.any { it.trim().startsWith("FPS") })
|
||||
assertFalse(fpsLast.toString(), fpsLast.any { it.trim() == "0.0fps" })
|
||||
}
|
||||
|
||||
@Test fun stripIsOneLineAcrossTheParentWithTheClockOnTheRight() {
|
||||
val app = RuntimeEnvironment.getApplication()
|
||||
val parent = FrameLayout(app)
|
||||
@@ -232,27 +297,24 @@ class DroidDeckHudPanelTest {
|
||||
}
|
||||
|
||||
@Test fun pillShowsEachBatteryPartOnItsOwnSwitch() {
|
||||
fun pill(vararg settings: Pair<String, String>): List<String> {
|
||||
fun pill(vararg settings: Pair<String, String>): String {
|
||||
val view = DroidDeckHudView(RuntimeEnvironment.getApplication())
|
||||
view.applyConfig(DroidDeckHudConfig.encode(DroidDeckHudConfig.DEFAULTS + ("hudSize" to DroidDeckHudSize.PILL.token) + settings))
|
||||
view.showForTest(SNAPSHOT, "DXVK", 0L)
|
||||
return view.linesForTest()
|
||||
return view.linesForTest().toString()
|
||||
}
|
||||
val all = pill("showBattery" to "1")
|
||||
assertTrue(all.toString(), all.any { "BAT 79% · 34°C · 16.0W" in it })
|
||||
assertEquals(all.toString(), 1, all.count { "BAT" in it })
|
||||
assertFalse(all.toString(), all.single { "RAM" in it }.contains("BAT"))
|
||||
|
||||
val noMemory = pill("showBattery" to "1", "showRAM" to "0")
|
||||
assertTrue(noMemory.toString(), noMemory.none { "RAM" in it })
|
||||
assertTrue(noMemory.toString(), noMemory.any { "BAT 79% · 34°C · 16.0W" in it })
|
||||
|
||||
val defaults = pill()
|
||||
assertTrue(defaults.toString(), defaults.any { "BAT 34°C · 16.0W" in it })
|
||||
val wattsOnly = pill("showBatteryTemp" to "0")
|
||||
assertTrue(wattsOnly.toString(), wattsOnly.any { "BAT 16.0W" in it })
|
||||
val nothing = pill("showBatteryTemp" to "0", "showPower" to "0")
|
||||
assertTrue(nothing.toString(), nothing.none { "BAT" in it })
|
||||
assertTrue(defaults, defaults.contains("BAT.T"))
|
||||
assertTrue(defaults, defaults.contains("PWR"))
|
||||
assertFalse(defaults, defaults.contains("BAT79%"))
|
||||
val levelOn = pill("showBattery" to "1")
|
||||
assertTrue(levelOn, levelOn.contains("BAT79%"))
|
||||
val tempOff = pill("showBatteryTemp" to "0")
|
||||
assertFalse(tempOff, tempOff.contains("BAT.T"))
|
||||
assertTrue(tempOff, tempOff.contains("PWR"))
|
||||
val powerOff = pill("showPower" to "0")
|
||||
assertFalse(powerOff, powerOff.contains("PWR"))
|
||||
assertTrue(powerOff, powerOff.contains("BAT.T"))
|
||||
}
|
||||
|
||||
@Test fun aLockedHudLetsTouchesThroughOnlyWhereAControlTakesThem() {
|
||||
|
||||
Reference in new issue
Block a user