Extended Performancehud - #1776
Conversation
User can set limits for batterylevel and temperature. Warning if batterylevel is under the chosen value. Warning if batterytemperature is over the chosen value. If Limits are reached a beep sound is played and background of performancehud is blinking.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe performance HUD adds configurable battery level and temperature warnings. Numeric battery values are added to snapshots, runtime warnings trigger tones and background colors, and localized labels support the new QuickMenu controls. ChangesPerformance HUD battery warnings
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant PerformanceHudView
participant HudSnapshot
participant PerformanceHudConfig
participant ToneGenerator
participant backgroundDrawable
PerformanceHudView->>HudSnapshot: read batteryPercent and batteryTempValue
PerformanceHudView->>PerformanceHudConfig: read warning limits and enabled flags
PerformanceHudView->>ToneGenerator: play warning tone when threshold is exceeded
PerformanceHudView->>backgroundDrawable: apply warning or backup background color
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (5)
app/src/main/res/values-it/strings.xml (1)
353-356: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win"temp." abbreviation inconsistent with existing terminology.
performance_hud_battery_temp_warning/_limitabbreviate to "temp." whileperformance_hud_battery_temperature(line 349) spells out "Temperatura batteria" in full. Same root cause as de/es/fr — see the consolidated comment for details and per-file fixes.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/src/main/res/values-it/strings.xml` around lines 353 - 356, Update the Italian translations for performance_hud_battery_temp_warning and performance_hud_battery_temp_limit to use the full “Temperatura batteria” terminology, matching performance_hud_battery_temperature instead of the “temp.” abbreviation.app/src/main/res/values-es/strings.xml (1)
364-367: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win"temp." abbreviation inconsistent with existing terminology.
performance_hud_battery_temp_warning/_limitabbreviate to "temp." whileperformance_hud_battery_temperature(line 360) spells out "Temperatura de la batería" in full. Same root cause as de/fr/it — see the consolidated comment for details and per-file fixes.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/src/main/res/values-es/strings.xml` around lines 364 - 367, Update the Spanish strings performance_hud_battery_temp_warning and performance_hud_battery_temp_limit to use the full “temperatura” terminology, matching performance_hud_battery_temperature, and remove the inconsistent “temp.” abbreviation.app/src/main/res/values-de/strings.xml (1)
346-349: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win"Temp" abbreviation inconsistent with existing terminology.
The new strings use "Batterie Temp Warnung"/"Batterie Temp Limit", but every other temperature string in this file spells it out (
performance_hud_battery_temperature= "Akkutemperatur",performance_hud_cpu_temperature= "CPU-Temperatur",performance_hud_gpu_temperature= "GPU-Temperatur"). This is part of a shared root cause also present in the es/fr/it locale files — see the consolidated comment for a full breakdown and fix per file.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/src/main/res/values-de/strings.xml` around lines 346 - 349, Update the German strings performance_hud_battery_temp_warning and performance_hud_battery_temp_limit to use the established full temperature terminology consistent with the other battery, CPU, and GPU temperature strings; change only these two localized values.app/src/main/java/app/gamenative/ui/component/QuickMenu.kt (1)
1103-1109: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winTemperature value bypasses string resources, unlike every other adjustment row.
valueTextfor the battery temperature limit is built with a raw Kotlin template ("${...} °C"), while every other row in this file (FPS target, background opacity, color intensity, and the sibling battery level limit row) usesstringResource(...). This hardcodes the°Cunit and format, breaking the localization pattern the rest of the composable follows.♻️ Suggested fix: add a formatted string resource
- valueText = "${(performanceHudConfig.batteryTemperatureWarningLimit * 100f).roundToInt()} °C", + valueText = stringResource( + R.string.performance_hud_temperature_value, + (performanceHudConfig.batteryTemperatureWarningLimit * 100f).roundToInt(), + ),Add to
strings.xml:<string name="performance_hud_temperature_value">%1$d °C</string>Separately (informational, not a bug):
batteryTemperatureWarningLimitis stored as a 0–1 fraction and multiplied by 100 for display/comparison, reusing the percentage-slider convention for what is actually a Celsius value. It's internally consistent withPerformanceHudView.kt's comparison logic, but a raw temperature field (e.g., 0–100 Float) would read more clearly to future maintainers.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/src/main/java/app/gamenative/ui/component/QuickMenu.kt` around lines 1103 - 1109, Replace the raw valueText interpolation in the battery temperature QuickMenuAdjustmentRow with stringResource using a formatted performance_hud_temperature_value resource, passing the rounded Celsius value as its argument. Add the corresponding localized string resource in strings.xml and preserve the existing limit conversion and progress behavior.app/src/main/res/values-fr/strings.xml (1)
353-356: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win"temp." abbreviation inconsistent with existing terminology.
performance_hud_battery_temp_warning/_limitabbreviate to "temp." whileperformance_hud_battery_temperature(line 349) spells out "Température de la batterie" in full. Same root cause as de/es/it — see the consolidated comment for details and per-file fixes.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/src/main/res/values-fr/strings.xml` around lines 353 - 356, Update the French strings performance_hud_battery_temp_warning and performance_hud_battery_temp_limit to use the established full “température de la batterie” terminology, matching performance_hud_battery_temperature instead of the abbreviated “temp.” wording.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/src/main/java/app/gamenative/ui/widget/PerformanceHudView.kt`:
- Around line 122-125: Update the appearance initialization in
PerformanceHudView so backupBackgroundColor is refreshed after init applies
applyAppearance(), capturing the configured HUD background rather than the
pre-appearance value. Ensure the restore logic in the non-warning update path
around currentBackgroundColor uses this refreshed backup, preserving later
opacity changes.
- Around line 245-248: Update the battery warning evaluation in
PerformanceHudView so unavailable battery percentage values do not trigger the
low-battery warning. Preserve BatterySnapshot.percent nullability through the
snapshot handling near the referenced conversion, or explicitly require a
non-null value before comparing against batteryLevelWarningLimit; keep normal
threshold evaluation unchanged for available values.
- Around line 250-255: Update PerformanceHudView’s warning-tone handling to
reuse a persistent ToneGenerator instead of allocating one in each levelWarning
or tempWarning branch. Stop and release the generator during
onDetachedFromWindow(), ensuring repeated update cycles do not accumulate
unreleased instances.
- Line 3: Remove the resource-attribute reference from PerformanceHudView and
derive both immutable warning colors from the clamped config.backgroundOpacity
value. Update the color values during applyAppearance() or setConfig() so they
refresh when the HUD opacity changes, while preserving the existing warning
color behavior otherwise.
In `@app/src/main/res/values/strings.xml`:
- Around line 352-355: Replace the German values for
performance_hud_battery_level_warning, performance_hud_battery_level_limit,
performance_hud_battery_temp_warning, and performance_hud_battery_temp_limit in
the default strings resource with the specified English labels, preserving the
existing resource names.
---
Nitpick comments:
In `@app/src/main/java/app/gamenative/ui/component/QuickMenu.kt`:
- Around line 1103-1109: Replace the raw valueText interpolation in the battery
temperature QuickMenuAdjustmentRow with stringResource using a formatted
performance_hud_temperature_value resource, passing the rounded Celsius value as
its argument. Add the corresponding localized string resource in strings.xml and
preserve the existing limit conversion and progress behavior.
In `@app/src/main/res/values-de/strings.xml`:
- Around line 346-349: Update the German strings
performance_hud_battery_temp_warning and performance_hud_battery_temp_limit to
use the established full temperature terminology consistent with the other
battery, CPU, and GPU temperature strings; change only these two localized
values.
In `@app/src/main/res/values-es/strings.xml`:
- Around line 364-367: Update the Spanish strings
performance_hud_battery_temp_warning and performance_hud_battery_temp_limit to
use the full “temperatura” terminology, matching
performance_hud_battery_temperature, and remove the inconsistent “temp.”
abbreviation.
In `@app/src/main/res/values-fr/strings.xml`:
- Around line 353-356: Update the French strings
performance_hud_battery_temp_warning and performance_hud_battery_temp_limit to
use the established full “température de la batterie” terminology, matching
performance_hud_battery_temperature instead of the abbreviated “temp.” wording.
In `@app/src/main/res/values-it/strings.xml`:
- Around line 353-356: Update the Italian translations for
performance_hud_battery_temp_warning and performance_hud_battery_temp_limit to
use the full “Temperatura batteria” terminology, matching
performance_hud_battery_temperature instead of the “temp.” abbreviation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 434fd344-eec9-4b7d-8ff1-0d1beaebc49e
📒 Files selected for processing (19)
app/src/main/java/app/gamenative/ui/component/QuickMenu.ktapp/src/main/java/app/gamenative/ui/data/PerformanceHudConfig.ktapp/src/main/java/app/gamenative/ui/widget/PerformanceHudModels.ktapp/src/main/java/app/gamenative/ui/widget/PerformanceHudView.ktapp/src/main/res/values-da/strings.xmlapp/src/main/res/values-de/strings.xmlapp/src/main/res/values-es/strings.xmlapp/src/main/res/values-fr/strings.xmlapp/src/main/res/values-it/strings.xmlapp/src/main/res/values-ja/strings.xmlapp/src/main/res/values-ko/strings.xmlapp/src/main/res/values-pl/strings.xmlapp/src/main/res/values-pt-rBR/strings.xmlapp/src/main/res/values-ro/strings.xmlapp/src/main/res/values-ru/strings.xmlapp/src/main/res/values-uk/strings.xmlapp/src/main/res/values-zh-rCN/strings.xmlapp/src/main/res/values-zh-rTW/strings.xmlapp/src/main/res/values/strings.xml
There was a problem hiding this comment.
All reported issues were addressed across 19 files
Tip: cubic used a learning from your PR history. Let your coding agent read cubic learnings directly with the cubic MCP.
Re-trigger cubic
Remove use of opacity
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Warnings only if valid values.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/src/main/java/app/gamenative/ui/widget/PerformanceHudView.kt (1)
381-381: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winPreserve
nullfor unavailable temperatures.
batteryTempValueis nullable, and the warning guard relies on null to skip invalid readings, but this assignment converts a missing temperature to0. Pass throughbatterySnapshot.temperatureCdirectly.Based on the PR objective, warning checks should run only when battery values are valid.
Proposed fix
- batteryTempValue = batterySnapshot.temperatureC ?: 0, + batteryTempValue = batterySnapshot.temperatureC,Also applies to: 247-248
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/src/main/java/app/gamenative/ui/widget/PerformanceHudView.kt` at line 381, Update the battery temperature assignments in the Performance HUD update logic to pass batterySnapshot.temperatureC directly instead of converting null to 0. Preserve null through both referenced assignment locations so the existing warning guard skips unavailable temperature readings.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@app/src/main/java/app/gamenative/ui/widget/PerformanceHudView.kt`:
- Line 381: Update the battery temperature assignments in the Performance HUD
update logic to pass batterySnapshot.temperatureC directly instead of converting
null to 0. Preserve null through both referenced assignment locations so the
existing warning guard skips unavailable temperature readings.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 358e23c5-f5af-41ae-9185-cb1d58f70d4e
📒 Files selected for processing (2)
app/src/main/java/app/gamenative/ui/widget/PerformanceHudModels.ktapp/src/main/java/app/gamenative/ui/widget/PerformanceHudView.kt
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
There was a problem hiding this comment.
1 issue found across 19 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="app/src/main/java/app/gamenative/ui/widget/PerformanceHudView.kt">
<violation number="1" location="app/src/main/java/app/gamenative/ui/widget/PerformanceHudView.kt:125">
P3: Warning colors are embedded in the view instead of named shared color resources, making theme changes and visual maintenance harder. Define named warning colors in resources and resolve them here.
(Based on your team's feedback about hardcoded UI colors.)</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| ?.color?.defaultColor ?: Color.BLACK | ||
|
|
||
| private val backupBackgroundColor = currentBackgroundColor | ||
| private val batteryLevelBackgroundColor = Color.argb( |
There was a problem hiding this comment.
P3: Warning colors are embedded in the view instead of named shared color resources, making theme changes and visual maintenance harder. Define named warning colors in resources and resolve them here.
(Based on your team's feedback about hardcoded UI colors.)
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/src/main/java/app/gamenative/ui/widget/PerformanceHudView.kt, line 125:
<comment>Warning colors are embedded in the view instead of named shared color resources, making theme changes and visual maintenance harder. Define named warning colors in resources and resolve them here.
(Based on your team's feedback about hardcoded UI colors.) </comment>
<file context>
@@ -109,6 +118,21 @@ class PerformanceHudView(
+ ?.color?.defaultColor ?: Color.BLACK
+
+ private val backupBackgroundColor = currentBackgroundColor
+ private val batteryLevelBackgroundColor = Color.argb(
+ 102,
+ 128,
</file context>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Warning appears now if Temperarure is Equal or higher than the limit. Temperature is formatted as usual.
User can set limits for batterylevel and temperature. Warning if batterylevel is under the chosen value. Warning if batterytemperature is over the chosen value. If Limits are reached a beep sound is played and background of performancehud is blinking.
Description
User can set limits for batterylevel and temperature. Warning if batterylevel is under the chosen value. Warning if batterytemperature is over the chosen value. If Limits are reached a beep sound is played and background of performancehud is blinking.
Recording
Type of Change
Checklist
#code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed.CONTRIBUTING.md.Summary by cubic
Adds configurable low‑battery and high battery‑temperature alerts to the Performance HUD. Previously the HUD only displayed stats; now it blinks and plays a short tone when limits are crossed. Temperature alerts trigger when the reading is equal to or above the limit; alerts only fire with valid readings.
batteryPercentandbatteryTempValueto safely handle missing readings.Other changes
WineUtils: auto-addX:andY:drives to containers; create missing targets and setchmod 0777where needed.androidx.xr.projected:projected; update AGP to 8.9.1; set Gradle wrapper to 8.11.1; enable Foojay toolchains resolver.Written for commit 8f7cd50. Summary will update on new commits.
Summary by CodeRabbit