feat: Strip HUD size, a one-line bar across the top or bottom edge (#1935)

This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-01 01:26:30 -04:00
1 parent 730b3affae
commit 65b414df93
38 files changed
+222 -6

No files matched your search

@@ -88,7 +88,7 @@ class DroidDeckHudHost(context: Context) {
hud.onRefresh = Runnable { refreshLabels(hud) }
hud.setOnMovedListener { x, y ->
wantX = x; wantY = y
dockEdgeFor(hud)?.let { edge -> setDock(hud, edge); return@setOnMovedListener }
if (!hud.isStrip) dockEdgeFor(hud)?.let { edge -> setDock(hud, edge); return@setOnMovedListener }
keepOnScreen(hud)
wantX = hud.x; wantY = hud.y
SessionPrefs.setDroidDeckHudPosition(context, hud.x, hud.y)
@@ -324,6 +324,7 @@ class DroidDeckHudHost(context: Context) {
val maxY = (p.height - v.height).toFloat().coerceAtLeast(0f)
var x = wantX.coerceIn(0f, maxX)
var y = wantY.coerceIn(0f, maxY)
if ((v as? DroidDeckHudView)?.isStrip == true) y = if (y + v.height / 2f < p.height / 2f) 0f else maxY
when (v.let { it as? DroidDeckHudView }?.dock) {
DroidDeckHudDock.LEFT -> x = 0f
DroidDeckHudDock.RIGHT -> x = maxX
@@ -23,9 +23,10 @@ enum class DroidDeckHudSize(val token: String, val label: String) {
TILES("tiles", "Tiles"),
PILL("pill", "Pill"),
MINIMAL("minimal", "Minimal"),
MEGA("mega", "Mega");
MEGA("mega", "Mega"),
STRIP("strip", "Strip");
/** Next size in the tap-cycle: Full → Tiles → Pill → Minimal → Mega → Full. */
/** Next size in the tap-cycle: Full → Tiles → Pill → Minimal → Mega → Strip → Full. */
fun next(): DroidDeckHudSize {
val all = values()
return all[(ordinal + 1) % all.size]
@@ -40,7 +41,7 @@ enum class DroidDeckHudSize(val token: String, val label: String) {
fun supportedChips(): Set<String> = when (this) {
MINIMAL -> MINIMAL_CHIPS
PILL -> PILL_CHIPS
FULL, TILES -> STANDARD_CHIPS
FULL, TILES, STRIP -> STANDARD_CHIPS
MEGA -> MEGA_CHIPS
}
@@ -152,6 +152,8 @@ class DroidDeckHudView(context: Context) : View(context) {
var dock = DroidDeckHudDock.NONE
private set
private var tabRect: RectF? = null
// The Strip is a bar across the whole screen, kept against the top or bottom edge.
private var stripRect: RectF? = null
private val tabPath = Path()
// Every size sits in the DroidDeck mark's D: a straight left side, round on the
@@ -534,7 +536,7 @@ class DroidDeckHudView(context: Context) : View(context) {
// ---- Layout builders --------------------------------------------------
private fun rebuild() {
glyphs.clear(); tileRects.clear(); graphRect = null
headerMark = null; chipRect = null; dPanel = null; dDividerTop = -1f; tabRect = null
headerMark = null; chipRect = null; dPanel = null; dDividerTop = -1f; tabRect = null; stripRect = null
val s = snap
if (s == null) { contentW = 0f; contentH = 0f; return }
if (dock != DroidDeckHudDock.NONE) { buildDockTab(); return }
@@ -544,6 +546,7 @@ class DroidDeckHudView(context: Context) : View(context) {
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)
}
}
@@ -1074,6 +1077,94 @@ class DroidDeckHudView(context: Context) : View(context) {
finishPanel(panel, halfRound = true)
}
/**
* Full's readouts on one line across the screen: the mark, the FPS, the graph, the lows, then GPU, CPU,
* memory, battery, display server and GPU model, with the clock on the right end. Groups that no longer
* fit before the clock are left off, from the end.
*/
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)
val h = sp(26f)
val w = ((parent as? View)?.width?.takeIf { it > 0 } ?: resources.displayMetrics.widthPixels).toFloat()
val mid = h / 2f
val baseline = mid + capHeight(fpsPx) / 2f
val markH = sp(13f)
val markLeft = padX - DroidDeckMark.inkLeftFor(markH)
headerMark = RectF(markLeft, mid - markH / 2f, markLeft + DroidDeckMark.widthFor(markH), mid + markH / 2f)
var x = markLeft + DroidDeckMark.inkRightFor(markH) + sp(8f)
var right = w - padX
if (showClockTime) {
val t = clockTimeString()
right -= measure(t, rowPx)
glyphs.add(Glyph(right, baseline, t, blend(colDim), rowPx))
right -= groupGap
}
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 (showGraph) {
val gw = sp(72f); val gh = h * 0.55f
if (x + gw <= right) {
graphRect = RectF(x, mid - gh / 2f, x + gw, mid + gh / 2f)
x += gw + groupGap
}
}
val groups = ArrayList<List<Span>>()
run {
val l = ArrayList<Span>()
l += Span("1% ", colDim, rowPx); l += Span(lowText(lows.low1Fps) ?: "—", colFps, rowPx)
l += Span(" 0.1% ", colDim, rowPx); l += Span(lowText(lows.low01Fps) ?: "—", colFps, rowPx)
if (showLow001) { l += Span(" 0.01% ", colDim, rowPx); l += Span(lowText(lows.low001Fps) ?: "—", colFps, rowPx) }
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 (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
}
stripRect = RectF(0f, 0f, w, h)
contentW = w; contentH = h
}
private fun capHeight(px: Float): Float {
measurePaint.textSize = px
measurePaint.getTextBounds("0", 0, 1, inkRect)
@@ -1263,6 +1354,8 @@ class DroidDeckHudView(context: Context) : View(context) {
// ---- Measure / draw ---------------------------------------------------
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
// The Strip spans the parent, past the side margin the floating sizes keep.
if (stripRect != null) { setMeasuredDimension(contentW.roundToInt(), resolveSize(contentH.roundToInt(), heightMeasureSpec)); return }
setMeasuredDimension(
resolveSize(contentW.roundToInt(), widthMeasureSpec),
resolveSize(contentH.roundToInt(), heightMeasureSpec),
@@ -1283,6 +1376,7 @@ class DroidDeckHudView(context: Context) : View(context) {
chipRect?.let { drawChip(canvas, it) }
tabRect?.let { drawTab(canvas, it) }
stripRect?.let { drawStrip(canvas, it) }
// Text
for (g in glyphs) {
@@ -1324,6 +1418,21 @@ class DroidDeckHudView(context: Context) : View(context) {
canvas.drawPath(graphPath, graphPaint)
}
/** The bar, with the accent line on the side that faces the game (under it at the top, over it at the bottom). */
private fun drawStrip(canvas: Canvas, rect: RectF) {
headerPaint.shader = null
headerPaint.color = panelColor()
canvas.drawRect(rect, headerPaint)
val stroke = outlineWidth()
if (stroke <= 0f) return
val line = max(stroke / 2f, density)
val p = parent as? View
val atBottom = p != null && p.height > 0 && y + height / 2f > p.height / 2f
headerPaint.color = withAlpha(outlineColor(), (110 + 145 * outlineIntensity).roundToInt().coerceAtMost(255))
if (atBottom) canvas.drawRect(rect.left, rect.top, rect.right, rect.top + line, headerPaint)
else canvas.drawRect(rect.left, rect.bottom - line, rect.right, rect.bottom, headerPaint)
}
private fun outlineWidth(): Float = if (outlineIntensity > 0f) outlineIntensity * sp(3.5f) else 0f
private fun outlineColor(): Int = if (outlineFollowAccent) accent else Color.rgb(200, 200, 200)
private fun panelColor(): Int = Color.argb((bgOpacity.coerceIn(0f, 1f) * 255f).roundToInt(),
@@ -1439,6 +1548,8 @@ class DroidDeckHudView(context: Context) : View(context) {
return lockController.onTouchEvent(event)
}
internal val isStrip: Boolean get() = stripRect != null
internal val contentWidth: Float get() = contentW
internal val contentHeight: Float get() = contentH
@@ -24,6 +24,7 @@ internal fun DroidDeckHudSettings(host: MenuHost, a: DrawerActions, track: (Stri
DroidDeckHudSize.PILL to stringResource(R.string.hud_size_pill),
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),
),
size, chipModifier = track("hud-size")) { a.onHudSetting("hudSize", it.token) }
ToggleRow(host, "hud-locked", stringResource(R.string.hud_locked), stringResource(R.string.hud_locked_hint), on("hudLocked"),
@@ -125,9 +126,10 @@ private val METRICS = listOf(
)
// Switches a size lists but never draws (DroidDeckHudView): the Pill and Minimal always show the FPS, the
// Pill has no graph, Tiles has no graph and no 0.01% low.
// Pill has no graph, Tiles has no graph and no 0.01% low, the Strip always shows the FPS.
private val HIDDEN = mapOf(
DroidDeckHudSize.PILL to setOf("FPS", "FPS graph"),
DroidDeckHudSize.MINIMAL to setOf("FPS"),
DroidDeckHudSize.TILES to setOf("FPS graph", "0.01% low"),
DroidDeckHudSize.STRIP to setOf("FPS"),
)
+1
View File
@@ -659,6 +659,7 @@
<string name="hud_size_pill">كبسولة</string>
<string name="hud_size_minimal">مصغّر</string>
<string name="hud_size_mega">ضخم</string>
<string name="hud_size_strip">شريط</string>
<string name="hud_locked">تثبيت في مكانه</string>
<string name="hud_locked_hint">اسحب HUD لتحريكه؛ والضغط مطولًا يثبّته أو يلغي تثبيته. أثناء تثبيته، تظل عناصر التحكم على الشاشة الموجودة تحته تعمل.</string>
<string name="hud_group_look">المظهر</string>
@@ -653,6 +653,7 @@
<string name="hud_size_pill">Píldora</string>
<string name="hud_size_minimal">Mínimo</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Barra</string>
<string name="hud_locked">Fijar posición</string>
<string name="hud_locked_hint">Arrastra el HUD para moverlo; una pulsación larga lo bloquea o lo desbloquea. Mientras está bloqueado, los controles en pantalla que tiene debajo siguen funcionando.</string>
<string name="hud_group_look">Aspecto</string>
+1
View File
@@ -651,6 +651,7 @@
<string name="hud_size_pill">Хапче</string>
<string name="hud_size_minimal">Минимален</string>
<string name="hud_size_mega">Мега</string>
<string name="hud_size_strip">Лента</string>
<string name="hud_locked">Заключване на място</string>
<string name="hud_locked_hint">Плъзнете HUD, за да го преместите; продължително натискане го заключва или отключва. Докато е заключен, екранните контроли под него продължават да работят.</string>
<string name="hud_group_look">Визия</string>
+1
View File
@@ -655,6 +655,7 @@
<string name="hud_size_pill">Pilulka</string>
<string name="hud_size_minimal">Minimální</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Lišta</string>
<string name="hud_locked">Zamknout na místě</string>
<string name="hud_locked_hint">Přetažením HUD přesunete; dlouhým stiskem ho zamknete nebo odemknete. Když je zamknutý, ovládací prvky na obrazovce pod ním dál fungují.</string>
<string name="hud_group_look">Vzhled</string>
+1
View File
@@ -651,6 +651,7 @@
<string name="hud_size_pill">Pille</string>
<string name="hud_size_minimal">Minimal</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Bjælke</string>
<string name="hud_locked">Lås fast</string>
<string name="hud_locked_hint">Træk i HUD for at flytte det; et langt tryk låser eller frigør det. Mens det er låst, virker skærmknapperne under det stadig.</string>
<string name="hud_group_look">Udseende</string>
+1
View File
@@ -651,6 +651,7 @@
<string name="hud_size_pill">Kapsel</string>
<string name="hud_size_minimal">Minimal</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Leiste</string>
<string name="hud_locked">Position sperren</string>
<string name="hud_locked_hint">Ziehe das HUD, um es zu verschieben; langes Drücken sperrt oder entsperrt es. Solange es gesperrt ist, funktionieren die Bildschirmsteuerungen darunter weiter.</string>
<string name="hud_group_look">Aussehen</string>
+1
View File
@@ -651,6 +651,7 @@
<string name="hud_size_pill">Κάψουλα</string>
<string name="hud_size_minimal">Ελάχιστο</string>
<string name="hud_size_mega">Μέγα</string>
<string name="hud_size_strip">Λωρίδα</string>
<string name="hud_locked">Κλείδωμα θέσης</string>
<string name="hud_locked_hint">Σύρετε το HUD για να το μετακινήσετε· ένα παρατεταμένο πάτημα το κλειδώνει ή το ξεκλειδώνει. Όσο είναι κλειδωμένο, τα χειριστήρια οθόνης από κάτω του εξακολουθούν να λειτουργούν.</string>
<string name="hud_group_look">Εμφάνιση</string>
+1
View File
@@ -653,6 +653,7 @@
<string name="hud_size_pill">Píldora</string>
<string name="hud_size_minimal">Mínimo</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Barra</string>
<string name="hud_locked">Fijar posición</string>
<string name="hud_locked_hint">Arrastra el HUD para moverlo; una pulsación larga lo bloquea o lo desbloquea. Mientras está bloqueado, los controles en pantalla que tiene debajo siguen funcionando.</string>
<string name="hud_group_look">Aspecto</string>
+1
View File
@@ -651,6 +651,7 @@
<string name="hud_size_pill">Kapseli</string>
<string name="hud_size_minimal">Minimaalinen</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Palkki</string>
<string name="hud_locked">Lukitse paikalleen</string>
<string name="hud_locked_hint">Siirrä HUD:ia vetämällä; pitkä painallus lukitsee tai vapauttaa sen. Lukittuna sen alla olevat näytön ohjaimet toimivat edelleen.</string>
<string name="hud_group_look">Ulkoasu</string>
+1
View File
@@ -653,6 +653,7 @@
<string name="hud_size_pill">Pilule</string>
<string name="hud_size_minimal">Minimal</string>
<string name="hud_size_mega">Méga</string>
<string name="hud_size_strip">Bandeau</string>
<string name="hud_locked">Verrouiller la position</string>
<string name="hud_locked_hint">Faites glisser le HUD pour le déplacer ; un appui long le verrouille ou le déverrouille. Tant qu\'il est verrouillé, les commandes à l\'écran situées dessous restent utilisables.</string>
<string name="hud_group_look">Apparence</string>
+1
View File
@@ -651,6 +651,7 @@
<string name="hud_size_pill">पिल</string>
<string name="hud_size_minimal">मिनिमल</string>
<string name="hud_size_mega">मेगा</string>
<string name="hud_size_strip">पट्टी</string>
<string name="hud_locked">जगह पर लॉक करें</string>
<string name="hud_locked_hint">HUD को खिसकाने के लिए उसे ड्रैग करें; देर तक दबाने से वह लॉक या अनलॉक होता है। लॉक रहने पर भी उसके नीचे के ऑन-स्क्रीन कंट्रोल काम करते रहते हैं।</string>
<string name="hud_group_look">लुक</string>
+1
View File
@@ -651,6 +651,7 @@
<string name="hud_size_pill">Kapszula</string>
<string name="hud_size_minimal">Minimális</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Sáv</string>
<string name="hud_locked">Rögzítés a helyén</string>
<string name="hud_locked_hint">Húzd a HUD-ot az áthelyezéshez; hosszú nyomással rögzítheted vagy feloldhatod. Rögzítve is működnek az alatta lévő képernyős vezérlők.</string>
<string name="hud_group_look">Megjelenés</string>
+1
View File
@@ -649,6 +649,7 @@
<string name="hud_size_pill">Pil</string>
<string name="hud_size_minimal">Minimal</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Bilah</string>
<string name="hud_locked">Kunci posisi</string>
<string name="hud_locked_hint">Seret HUD untuk memindahkannya; tekan lama untuk mengunci atau membuka kuncinya. Saat terkunci, kontrol layar di bawahnya tetap berfungsi.</string>
<string name="hud_group_look">Tampilan</string>
+1
View File
@@ -653,6 +653,7 @@
<string name="hud_size_pill">Pillola</string>
<string name="hud_size_minimal">Minimo</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Barra</string>
<string name="hud_locked">Blocca in posizione</string>
<string name="hud_locked_hint">Trascina l\'HUD per spostarlo; una pressione prolungata lo blocca o lo sblocca. Mentre è bloccato, i controlli su schermo sotto di esso continuano a funzionare.</string>
<string name="hud_group_look">Aspetto</string>
+1
View File
@@ -638,6 +638,7 @@
<string name="hud_size_pill">カプセル</string>
<string name="hud_size_minimal">ミニマル</string>
<string name="hud_size_mega">メガ</string>
<string name="hud_size_strip">バー</string>
<string name="hud_locked">位置を固定</string>
<string name="hud_locked_hint">HUDはドラッグで移動できます。長押しで固定または解除します。固定中も、下にある画面上のコントロールは使えます。</string>
<string name="hud_group_look">外観</string>
+1
View File
@@ -649,6 +649,7 @@
<string name="hud_size_pill">캡슐</string>
<string name="hud_size_minimal">미니멀</string>
<string name="hud_size_mega">메가</string>
<string name="hud_size_strip">바</string>
<string name="hud_locked">위치 고정</string>
<string name="hud_locked_hint">HUD를 드래그하여 이동하고, 길게 눌러 고정하거나 해제합니다. 고정된 동안에도 아래에 있는 화면 컨트롤은 계속 작동합니다.</string>
<string name="hud_group_look">외관</string>
+1
View File
@@ -649,6 +649,7 @@
<string name="hud_size_pill">Pil</string>
<string name="hud_size_minimal">Minimal</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Jalur</string>
<string name="hud_locked">Kunci di tempat</string>
<string name="hud_locked_hint">Seret HUD untuk mengalihkannya; tekan lama untuk mengunci atau membuka kuncinya. Semasa dikunci, kawalan skrin di bawahnya masih berfungsi.</string>
<string name="hud_group_look">Rupa</string>
+1
View File
@@ -651,6 +651,7 @@
<string name="hud_size_pill">Pille</string>
<string name="hud_size_minimal">Minimal</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Linje</string>
<string name="hud_locked">Lås på plass</string>
<string name="hud_locked_hint">Dra HUD-en for å flytte den; et langt trykk låser eller låser den opp. Mens den er låst, fungerer skjermkontrollene under den fortsatt.</string>
<string name="hud_group_look">Utseende</string>
+1
View File
@@ -651,6 +651,7 @@
<string name="hud_size_pill">Pil</string>
<string name="hud_size_minimal">Minimaal</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Balk</string>
<string name="hud_locked">Vastzetten</string>
<string name="hud_locked_hint">Sleep de HUD om hem te verplaatsen; lang drukken zet hem vast of los. Zolang hij vastzit, blijven de schermknoppen eronder werken.</string>
<string name="hud_group_look">Weergave</string>
+1
View File
@@ -655,6 +655,7 @@
<string name="hud_size_pill">Pigułka</string>
<string name="hud_size_minimal">Minimalny</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Pasek</string>
<string name="hud_locked">Zablokuj w miejscu</string>
<string name="hud_locked_hint">Przeciągnij HUD, aby go przesunąć; długie naciśnięcie blokuje go lub odblokowuje. Gdy jest zablokowany, sterowanie ekranowe pod nim nadal działa.</string>
<string name="hud_group_look">Wygląd</string>
@@ -653,6 +653,7 @@
<string name="hud_size_pill">Pílula</string>
<string name="hud_size_minimal">Mínimo</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Barra</string>
<string name="hud_locked">Bloquear posição</string>
<string name="hud_locked_hint">Arraste o HUD para o mover; um toque longo bloqueia-o ou desbloqueia-o. Enquanto estiver bloqueado, os controlos no ecrã por baixo dele continuam a funcionar.</string>
<string name="hud_group_look">Aspeto</string>
+1
View File
@@ -653,6 +653,7 @@
<string name="hud_size_pill">Pílula</string>
<string name="hud_size_minimal">Mínimo</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Barra</string>
<string name="hud_locked">Travar posição</string>
<string name="hud_locked_hint">Arraste o HUD para movê-lo; um toque longo o trava ou destrava. Enquanto estiver travado, os controles na tela embaixo dele continuam funcionando.</string>
<string name="hud_group_look">Aparência</string>
+1
View File
@@ -653,6 +653,7 @@
<string name="hud_size_pill">Pastilă</string>
<string name="hud_size_minimal">Minimal</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Bară</string>
<string name="hud_locked">Blochează pe loc</string>
<string name="hud_locked_hint">Trage HUD-ul pentru a-l muta; o apăsare lungă îl blochează sau îl deblochează. Cât timp e blocat, comenzile de pe ecran de sub el funcționează în continuare.</string>
<string name="hud_group_look">Aspect</string>
+1
View File
@@ -655,6 +655,7 @@
<string name="hud_size_pill">Капсула</string>
<string name="hud_size_minimal">Минимальный</string>
<string name="hud_size_mega">Мега</string>
<string name="hud_size_strip">Полоса</string>
<string name="hud_locked">Закрепить на месте</string>
<string name="hud_locked_hint">Перетащите HUD, чтобы переместить его; долгое нажатие закрепляет или открепляет его. Пока он закреплён, экранные элементы управления под ним продолжают работать.</string>
<string name="hud_group_look">Внешний вид</string>
+1
View File
@@ -651,6 +651,7 @@
<string name="hud_size_pill">Piller</string>
<string name="hud_size_minimal">Minimal</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">List</string>
<string name="hud_locked">Lås på plats</string>
<string name="hud_locked_hint">Dra HUD:en för att flytta den; ett långt tryck låser eller låser upp den. När den är låst fungerar skärmkontrollerna under den fortfarande.</string>
<string name="hud_group_look">Utseende</string>
+1
View File
@@ -649,6 +649,7 @@
<string name="hud_size_pill">แคปซูล</string>
<string name="hud_size_minimal">มินิมอล</string>
<string name="hud_size_mega">เมกะ</string>
<string name="hud_size_strip">แถบ</string>
<string name="hud_locked">ล็อกตำแหน่ง</string>
<string name="hud_locked_hint">ลาก HUD เพื่อย้าย กดค้างเพื่อล็อกหรือปลดล็อก ขณะล็อก ปุ่มควบคุมบนหน้าจอที่อยู่ด้านล่างยังใช้งานได้</string>
<string name="hud_group_look">รูปลักษณ์</string>
+1
View File
@@ -651,6 +651,7 @@
<string name="hud_size_pill">Hap</string>
<string name="hud_size_minimal">Minimal</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Şerit</string>
<string name="hud_locked">Yerinde kilitle</string>
<string name="hud_locked_hint">Taşımak için HUD\'u sürükleyin; uzun basmak onu kilitler veya kilidini açar. Kilitliyken altındaki ekran kontrolleri çalışmaya devam eder.</string>
<string name="hud_group_look">Görünüm</string>
+1
View File
@@ -655,6 +655,7 @@
<string name="hud_size_pill">Капсула</string>
<string name="hud_size_minimal">Мінімальний</string>
<string name="hud_size_mega">Мега</string>
<string name="hud_size_strip">Смуга</string>
<string name="hud_locked">Закріпити на місці</string>
<string name="hud_locked_hint">Перетягніть HUD, щоб перемістити його; довге натискання закріплює або відкріплює його. Поки його закріплено, екранні елементи керування під ним працюють і далі.</string>
<string name="hud_group_look">Вигляд</string>
+1
View File
@@ -649,6 +649,7 @@
<string name="hud_size_pill">Dạng viên</string>
<string name="hud_size_minimal">Tối giản</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Thanh</string>
<string name="hud_locked">Khóa vị trí</string>
<string name="hud_locked_hint">Kéo HUD để di chuyển; nhấn giữ để khóa hoặc mở khóa. Khi đã khóa, các nút điều khiển trên màn hình bên dưới vẫn hoạt động.</string>
<string name="hud_group_look">Giao diện</string>
@@ -638,6 +638,7 @@
<string name="hud_size_pill">胶囊</string>
<string name="hud_size_minimal">极简</string>
<string name="hud_size_mega">超大</string>
<string name="hud_size_strip">横条</string>
<string name="hud_locked">锁定位置</string>
<string name="hud_locked_hint">拖动 HUD 可移动位置;长按可锁定或解锁。锁定时,下方的屏幕控件仍可使用。</string>
<string name="hud_group_look">外观</string>
@@ -638,6 +638,7 @@
<string name="hud_size_pill">膠囊</string>
<string name="hud_size_minimal">極簡</string>
<string name="hud_size_mega">超大</string>
<string name="hud_size_strip">橫條</string>
<string name="hud_locked">鎖定位置</string>
<string name="hud_locked_hint">拖曳 HUD 可移動位置;長按可鎖定或解鎖。鎖定時,下方的螢幕控制項仍可使用。</string>
<string name="hud_group_look">外觀</string>
@@ -638,6 +638,7 @@
<string name="hud_size_pill">膠囊</string>
<string name="hud_size_minimal">極簡</string>
<string name="hud_size_mega">超大</string>
<string name="hud_size_strip">橫條</string>
<string name="hud_locked">鎖定位置</string>
<string name="hud_locked_hint">拖曳 HUD 可移動位置;長按可鎖定或解鎖。鎖定時,下方的螢幕控制項仍可使用。</string>
<string name="hud_group_look">外觀</string>
+1
View File
@@ -675,6 +675,7 @@
<string name="hud_size_pill">Pill</string>
<string name="hud_size_minimal">Minimal</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Strip</string>
<string name="hud_locked">Lock in place</string>
<string name="hud_locked_hint">Drag the HUD to move it; a long press locks or unlocks it. While it is locked, on-screen controls under it still work.</string>
<string name="hud_group_look">Look</string>
@@ -45,6 +45,7 @@ class DroidDeckHudPanelTest {
}
val snapshot = SNAPSHOT
for (size in DroidDeckHudSize.values()) {
if (size == DroidDeckHudSize.STRIP) continue
val view = DroidDeckHudView(RuntimeEnvironment.getApplication())
view.applyConfig(DroidDeckHudConfig.encode(DroidDeckHudConfig.DEFAULTS + ("hudSize" to size.token)))
view.setFrameStats(stats)
@@ -70,6 +71,73 @@ class DroidDeckHudPanelTest {
}
}
@Test fun stripIsOneLineAcrossTheParentWithTheClockOnTheRight() {
val app = RuntimeEnvironment.getApplication()
val parent = FrameLayout(app)
val view = DroidDeckHudView(app)
parent.addView(view, FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT))
parent.measure(View.MeasureSpec.makeMeasureSpec(2400, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(1080, View.MeasureSpec.EXACTLY))
parent.layout(0, 0, 2400, 1080)
view.applyConfig(DroidDeckHudConfig.encode(DroidDeckHudConfig.DEFAULTS + ("hudSize" to DroidDeckHudSize.STRIP.token) +
("showBattery" to "1")))
view.showForTest(SNAPSHOT, "DXVK", 0L)
val unspecified = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)
view.measure(unspecified, unspecified)
assertTrue(view.isStrip)
assertEquals(2400, view.measuredWidth)
val lines = view.linesForTest()
assertEquals(lines.toString(), 1, lines.size)
val line = lines.single()
listOf("DXVK", "fps", "GPU", "CPU", "RAM", "BAT 79%").forEach { assertTrue(line, it in line) }
assertTrue(line, line.indexOf("DXVK") < line.indexOf("GPU") && line.indexOf("GPU") < line.indexOf("BAT"))
val bitmap = Bitmap.createBitmap(view.measuredWidth, view.measuredHeight, Bitmap.Config.ARGB_8888)
view.layout(0, 0, view.measuredWidth, view.measuredHeight)
view.draw(Canvas(bitmap))
val png = ByteArrayOutputStream().also { bitmap.compress(Bitmap.CompressFormat.PNG, 100, it) }
println("DROIDDECKHUD-STRIP-PNG ${Base64.getEncoder().encodeToString(png.toByteArray())}")
}
@Test fun stripLeavesOffWhatNoLongerFitsBeforeTheClock() {
val app = RuntimeEnvironment.getApplication()
val parent = FrameLayout(app)
val view = DroidDeckHudView(app)
parent.addView(view, FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT))
parent.measure(View.MeasureSpec.makeMeasureSpec(700, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(400, View.MeasureSpec.EXACTLY))
parent.layout(0, 0, 700, 400)
view.applyConfig(DroidDeckHudConfig.encode(DroidDeckHudConfig.DEFAULTS + ("hudSize" to DroidDeckHudSize.STRIP.token)))
view.showForTest(SNAPSHOT, "DXVK", 0L)
val line = view.linesForTest().single()
assertTrue(line, "fps" in line)
assertFalse(line, "BAT" in line)
}
@Test fun stripFollowsTheHudScaleInHeightAndKeepsTheFullWidth() {
val app = RuntimeEnvironment.getApplication()
val parent = FrameLayout(app)
val view = DroidDeckHudView(app)
parent.addView(view, FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT))
parent.measure(View.MeasureSpec.makeMeasureSpec(2400, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(1080, View.MeasureSpec.EXACTLY))
parent.layout(0, 0, 2400, 1080)
fun at(scale: Int): Pair<Float, Float> {
view.applyConfig(DroidDeckHudConfig.encode(DroidDeckHudConfig.DEFAULTS + ("hudSize" to DroidDeckHudSize.STRIP.token) +
("hudScale" to scale.toString())))
view.showForTest(SNAPSHOT, "DXVK", 0L)
val unspecified = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)
view.measure(unspecified, unspecified)
view.layout(0, 0, view.measuredWidth, view.measuredHeight)
val bitmap = Bitmap.createBitmap(view.measuredWidth, view.measuredHeight, Bitmap.Config.ARGB_8888)
view.draw(Canvas(bitmap))
val png = ByteArrayOutputStream().also { bitmap.compress(Bitmap.CompressFormat.PNG, 100, it) }
println("DROIDDECKHUD-STRIP$scale-PNG ${Base64.getEncoder().encodeToString(png.toByteArray())}")
return Pair(view.contentWidth, view.contentHeight)
}
val small = at(70); val big = at(150)
assertEquals(2400f, small.first); assertEquals(2400f, big.first)
assertEquals(big.second / small.second, 150f / 70f, 0.01f)
}
@Test fun pillShowsEachBatteryPartOnItsOwnSwitch() {
fun pill(vararg settings: Pair<String, String>): List<String> {
val view = DroidDeckHudView(RuntimeEnvironment.getApplication())