Skip to content

feat(settings): unify backgrounds and menu card controls - #480

Merged
qiin2333 merged 2 commits into
masterfrom
agent/settings-background-menu-cards
Aug 11, 2026
Merged

feat(settings): unify backgrounds and menu card controls#480
qiin2333 merged 2 commits into
masterfrom
agent/settings-background-menu-cards

Conversation

@qiin2333

@qiin2333 qiin2333 commented Aug 11, 2026

Copy link
Copy Markdown
Owner

改了啥呀

  • 设置页背景改为复用主页当前的 BackgroundSource.ResolvedTarget,主页、设置页和保存原图共享同一目标与 UUID 缓存键。
  • 背景刷新时显式失效当前解析结果;保存原图只读取当前缓存,不再偷偷重新请求随机图接口。
  • 删除只为保存图片服务的额外 LruCache,PNG 编码移到 IO 线程,减少大图内存占用和主线程卡顿。
  • 在常规设置页增加“游戏菜单卡片”入口,并抽出 GameMenuCardVisibilityEditor 供设置页和串流内菜单共同使用。

为啥要改

随机图片 API 对同一个 URL 的多次请求可能返回不同图片。原先主页、设置页、下载链路各自请求,导致设置背景或保存结果偶尔和主页不一样——这种会分身的杂鱼缓存状态该收拾掉啦。

另外,游戏菜单的卡片展示配置只藏在串流中的菜单里,不容易发现。现在可以在进入串流前直接配置,同时仍保留串流内即时调整。

用户影响

  • 设置页与主页始终使用同一张背景图,仅保留各自的蒙层差异。
  • 长按保存得到当前主页对应的未加滤镜原图,不会抽到下一张随机图。
  • 用户可以从设置页选择码率、音频与震动、陀螺仪、快捷键卡片;至少保留一张卡片。

验证

  • git diff --check
  • .\gradlew.bat :app:compileNonRootDebugKotlin :app:assembleNonRootDebug
  • 魅族 17 真机覆盖安装 app-nonRoot-debug.apk
  • 真机验证主页与设置页背景构图一致
  • 真机长按保存并对照 PNG,确认与当前主页原图一致
  • 检查 AndroidRuntime logcat,无崩溃

Summary by CodeRabbit

  • New Features

    • Added a settings option to choose which cards appear in the in-stream game menu, including bitrate, audio/haptics, gyro, and shortcuts.
    • Added selected-card summaries and prevents saving an empty selection.
    • Added Simplified Chinese and default localized text for the new setting.
  • Bug Fixes

    • Improved wallpaper loading across orientations and background sources.
    • Improved wallpaper saving reliability and prevented unnecessary network downloads.
    • Improved wallpaper refresh behavior when changing background sources.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: edf1c731-c1c8-47fd-991f-3bfa602c0f5d

📥 Commits

Reviewing files that changed from the base of the PR and between 047ade0 and 200f4a3.

📒 Files selected for processing (1)
  • app/src/main/java/com/limelight/preferences/StreamSettings.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/src/main/java/com/limelight/preferences/StreamSettings.kt

📝 Walkthrough

Walkthrough

The change replaces in-memory wallpaper caching with resolved-target Glide disk caching. It also adds a shared editor for game-menu card visibility and exposes the selector in Android settings with localized summaries.

Changes

Wallpaper caching

Layer / File(s) Summary
Resolved wallpaper target caching
app/src/main/java/com/limelight/preferences/BackgroundSource.kt
BackgroundSource caches resolved targets by source and orientation, generates cache keys, and invalidates cached resolutions when the active source changes.
Glide wallpaper loading
app/src/main/java/com/limelight/PcView.kt, app/src/main/java/com/limelight/preferences/StreamSettings.kt
Wallpaper requests use resolved cache keys, support local files and remote candidates, and cancel raw Glide FutureTarget instances.
Disk-cache wallpaper saving
app/src/main/java/com/limelight/PcView.kt
Wallpaper saving reads only from Glide disk cache and reports directory or bitmap encoding errors.

Game-menu card visibility

Layer / File(s) Summary
Shared card visibility editor
app/src/main/java/com/limelight/gamemenu/GameMenuCardVisibilityEditor.kt
The shared editor presents four selectable cards, persists confirmed selections, and returns localized selected labels.
Game-menu settings integration
app/src/main/java/com/limelight/gamemenu/GameMenu.kt, app/src/main/java/com/limelight/preferences/GameMenuCardsPreference.kt, app/src/main/res/xml/preferences.xml, app/src/main/res/values*/strings.xml
GameMenu and Android preferences use the shared editor and display localized selection summaries.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PcView
  participant BackgroundSource
  participant Glide
  participant Storage
  PcView->>BackgroundSource: Resolve current wallpaper target
  BackgroundSource-->>PcView: Return cache key and target
  PcView->>Glide: Load using disk-cache signature
  Glide-->>PcView: Return decoded bitmap
  PcView->>Glide: Retrieve cached wallpaper for saving
  Glide-->>PcView: Return cached bitmap data
  PcView->>Storage: Encode and write wallpaper
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: unified background handling and shared game menu card controls.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/settings-background-menu-cards

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qiin2333

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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/com/limelight/preferences/BackgroundSource.kt`:
- Around line 131-150: Update the legacy URL handling in StreamSettings around
the migration/load flow to persist through BackgroundSource.KEY_API_URL rather
than writing legacy keys directly. For a nonblank URL, call
setActivePreservingExtras with BackgroundSource.Api; for a blank URL, call
setActive with BackgroundSource.Auto, ensuring KEY_SOURCE and resolved-target
cache state are updated.
🪄 Autofix

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: 5aacdc48-9b8e-4ed1-8916-f1fb4463ad24

📥 Commits

Reviewing files that changed from the base of the PR and between ec56fc9 and 047ade0.

📒 Files selected for processing (9)
  • app/src/main/java/com/limelight/PcView.kt
  • app/src/main/java/com/limelight/gamemenu/GameMenu.kt
  • app/src/main/java/com/limelight/gamemenu/GameMenuCardVisibilityEditor.kt
  • app/src/main/java/com/limelight/preferences/BackgroundSource.kt
  • app/src/main/java/com/limelight/preferences/GameMenuCardsPreference.kt
  • app/src/main/java/com/limelight/preferences/StreamSettings.kt
  • app/src/main/res/values-zh-rCN/strings.xml
  • app/src/main/res/values/strings.xml
  • app/src/main/res/xml/preferences.xml

Comment thread app/src/main/java/com/limelight/preferences/BackgroundSource.kt
@qiin2333
qiin2333 marked this pull request as ready for review August 11, 2026 04:28
@qiin2333
qiin2333 merged commit 29af858 into master Aug 11, 2026
2 checks passed
@qiin2333
qiin2333 deleted the agent/settings-background-menu-cards branch August 11, 2026 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant