Add a single-column Side strip HUD preset (#3783)

* Add a single-column Side strip HUD preset

* Keep only the 1% low in Side strip
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-12-05 21:24:08 -05:00
1 parent f2206893d0
commit 70be3d3eea
5 files changed
+102 -6

No files matched your search

@@ -40,7 +40,8 @@ enum class DroidDeckHudSize(val token: String, val label: String) {
PILL("pill", "Pill"),
MINIMAL("minimal", "Minimal"),
MEGA("mega", "Mega"),
STRIP("strip", "Strip");
STRIP("strip", "Strip"),
SIDE_STRIP("side_strip", "Side strip");
fun next(): DroidDeckHudSize {
val all = values()
@@ -96,6 +97,11 @@ enum class DroidDeckHudSize(val token: String, val label: String) {
"showCPUUsage", "showTemp", "showVram", "showRAM", "showBattery", "showBatteryTemp", "showBatteryTime",
"showPower", "showDisplay", "showHdr", "showGpuModel",
),
SIDE_STRIP to listOf(
"showFPS", "showFPSGraph", "showAvg", "showLow1",
"showGPULoad", "showGpuTemp", "showCPUUsage", "showTemp", "showRAM", "showVram",
"showPower", "showBattery", "showBatteryTemp", "showBatteryTime",
),
)
@@ -110,6 +116,7 @@ enum class DroidDeckHudSize(val token: String, val label: String) {
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),
SIDE_STRIP to DroidDeckHudStyle(row = 11.5f, unit = 9f, pad = 8f, lineGap = 4f, labelGap = 4f, key = 9f),
)
fun rowsFor(size: DroidDeckHudSize, values: Map<String, String>): List<String> =
@@ -573,6 +573,7 @@ class DroidDeckHudView(context: Context) : View(context) {
if (s == null) { contentW = 0f; contentH = 0f; return }
if (dock != DroidDeckHudDock.NONE) { buildDockTab(); return }
if (size == DroidDeckHudSize.STRIP) { buildStrip(s); return }
if (size == DroidDeckHudSize.SIDE_STRIP) { buildSideStrip(s); return }
buildRows(s)
if (contentW <= 0f || contentH <= 0f) return
if (size == DroidDeckHudSize.PILL) addSubtleClock(sp(10f), leftAligned = true)
@@ -684,8 +685,8 @@ class DroidDeckHudView(context: Context) : View(context) {
finishPanel(panel, halfRound = halfRound)
}
private fun finishPanel(panel: RectF, halfRound: Boolean) {
val r = if (halfRound) panel.height() / 2f else min(panel.height() / 2f, sp(56f))
private fun finishPanel(panel: RectF, halfRound: Boolean, maxRadius: Float = sp(56f), inset: Float = panelInset()) {
val r = if (halfRound) panel.height() / 2f else min(panel.height() / 2f, maxRadius)
val margin = outlineWidth() + sp(4f)
fun curveIn(top: Float, bottom: Float): Float {
val d = max(max(panel.top + r - top, bottom - (panel.bottom - r)), 0f)
@@ -703,8 +704,8 @@ class DroidDeckHudView(context: Context) : View(context) {
for (t in tileRects) right = max(right, t.right + curveIn(t.top, t.bottom) + margin)
panel.right = max(right, panel.left + sp(6f) + r)
dPanel = panel; dRadius = r
contentW = panel.right + panelInset()
contentH = panel.bottom + panelInset()
contentW = panel.right + inset
contentH = panel.bottom + inset
}
private fun clockTimeString(): String = DateFormat.getTimeFormat(context).format(Date())
@@ -936,6 +937,58 @@ class DroidDeckHudView(context: Context) : View(context) {
}
}
private fun buildSideStrip(s: HudMetrics.Snapshot) {
val style = size.style
val inset = sp(5f)
val panelWidth = sp(86f)
val pad = sp(style.pad)
val left = inset + pad
val right = inset + panelWidth - pad
val markHeight = sp(12f)
val markTop = inset + sp(6f)
val markLeft = left - DroidDeckMark.inkLeftFor(markHeight)
headerMark = RectF(markLeft, markTop, markLeft + DroidDeckMark.widthFor(markHeight), markTop + markHeight)
dDividerTop = markTop + markHeight + sp(6f)
if (showClockTime) {
val clock = clockTimeString()
val clockPx = sp(8.5f)
val clockWidth = measure(clock, clockPx)
if (right - clockWidth >= markLeft + DroidDeckMark.inkRightFor(markHeight) + sp(4f)) {
val baseline = markTop + (markHeight + capHeight(clockPx)) / 2f
glyphs.add(Glyph(right - clockWidth, baseline, clock, blend(colDim), clockPx))
}
}
val labelPx = sp(style.key)
val rowPx = sp(style.row)
val unitPx = sp(style.unit)
val lineGap = sp(style.lineGap)
var y = dDividerTop + sp(6f)
for (key in size.rowsIn(storedOrder)) {
if (!switchOn(key)) continue
if (key == "showFPSGraph") {
val height = sp(15f)
graphRect = RectF(left, y, right, y + height)
y += height + lineGap
continue
}
val valuePx = if (key == "showFPS") sp(16f) else rowPx
val row = reading(key, s, labelPx, valuePx, unitPx)
val available = right - left - measure(row.label.text, labelPx) - sp(style.labelGap)
val fit = (available / runWidth(row.vals)).coerceIn(0f, 1f)
val values = row.vals.map { Span(it.text, it.color, it.sizePx * fit, it.glow) }
val baseline = y - ascent(valuePx)
placeRun(left, baseline, listOf(row.label))
placeRun(right - runWidth(values), baseline, values)
y += lineH(valuePx) + lineGap
}
val panel = RectF(inset, inset, inset + panelWidth, y + sp(7f))
finishPanel(panel, halfRound = false, maxRadius = sp(11f), inset = inset)
}
private fun buildStrip(s: HudMetrics.Snapshot) {
val rowPx = sp(11.5f); val unitPx = rowPx * 0.8f; val fpsPx = sp(15f)
val padX = sp(10f); val groupGap = sp(13f)
@@ -39,7 +39,8 @@ internal fun DroidDeckHudSettings(host: MenuHost, a: DrawerActions, track: (Stri
}
if (!a.hudOn) return@SettingsGroup
val size = DroidDeckHudSize.from(cfg["hudSize"])
ChoiceRow(host, "hud-size", stringResource(R.string.hud_size), stringResource(R.string.hud_size_hint),
ChoiceRow(host, "hud-size", stringResource(R.string.hud_size),
stringResource(if (size == DroidDeckHudSize.SIDE_STRIP) R.string.hud_size_side_strip_hint else R.string.hud_size_hint),
listOf(
DroidDeckHudSize.FULL to stringResource(R.string.hud_size_full),
DroidDeckHudSize.TILES to stringResource(R.string.hud_size_tiles),
@@ -47,6 +48,7 @@ internal fun DroidDeckHudSettings(host: MenuHost, a: DrawerActions, track: (Stri
DroidDeckHudSize.MINIMAL to stringResource(R.string.hud_size_minimal),
DroidDeckHudSize.MEGA to stringResource(R.string.hud_size_mega),
DroidDeckHudSize.STRIP to stringResource(R.string.hud_size_strip),
DroidDeckHudSize.SIDE_STRIP to stringResource(R.string.hud_size_side_strip),
),
size, chipModifier = track("hud-size")) { a.onHudSetting("hudSize", it.token) }
ChoiceRow(host, "hud-hold", stringResource(R.string.hud_hold), null,