Skip to content

TV UI: Settings screen - #6550

Open
eliotcougar wants to merge 4 commits into
2dust:masterfrom
eliotcougar:codex/tv-settings
Open

eliotcougar wants to merge 4 commits into
2dust:masterfrom
eliotcougar:codex/tv-settings

Conversation

@eliotcougar

Copy link
Copy Markdown
Contributor

Scope

Adds a dedicated Settings screen under ui.tv.settings following the upstream UI separation guidance. The TV drawer opens it directly; the phone drawer still opens the existing mobile Settings activity. This replaces the pre-refactor approach in #6447 and targets master directly. It does not add preferences, migrate stored data, or change VPN or core behavior.

What stays shared and what stays separate

  • Shared: SettingsForm.kt keeps the existing preference list, ordering, defaults, enablement and visibility rules, validation, and save handlers in one place. Both screens use the existing Settings ViewModel, persistence, and app-wide theme setup. The form asks for five kinds of rows but owns no focus requesters, dialogs, layout or platform checks.
  • Phone: SettingsActivity.kt keeps the original screen, touch controls, and Material dialogs. Its adapter forwards each row to the existing widgets; no files under ui.mobile.compose change.
  • TV: TvSettingsActivity.kt and its rows and dialogs own the TV layout, D-pad focus, keyboard handoff, and picker behavior. Center starts editing; the logical leading direction (Left in LTR, Right in RTL) goes from a row to Back. Pickers focus the current option once per opening and return focus to the opening row. This does not share a renderer with the phone.

Question for @2dust

Does sharing the existing preference definitions through SettingsForm fit the architecture you want? It keeps a new setting in one place while leaving both UI implementations independent. Or would you prefer separate form declarations under mobile and tv, with sharing limited to the Settings ViewModel and underlying state/actions? The first commit isolates the form extraction so you can review that choice on its own before looking at the TV screen.

Validation

  • Compared all preference bindings, defaults, resource IDs, order, gating, and handlers with upstream.
  • Play Store debug builds for both emulator ABIs, Kotlin compilation, and 175 JVM tests passed. Additional regression and emulator QA files are not part of this PR.
  • Android 11 TV: Checked D-pad row navigation and Back, current-language focus when opening the picker, scrolling away and back without stealing Cancel focus, focus return after light/dark recreation, numeric input and persistence, and editing an unmasked synthetic local proxy password without saving it.
  • Android 17 phone: Opened mobile Settings from the drawer, opened and dismissed Language, changed and restored the theme using the existing touch picker, and returned to the main screen.

Move preference keys, defaults, conditions and handlers to the Settings form. Keep the existing mobile Scaffold and Compose controls behind a small Settings-only presentation interface.
Route Settings from the TV drawer only. Reuse upstream TV focus and keyboard controls with separate settings rows and dialogs, keeping the shared form and ViewModel behavior intact.
Leave focus restoration in the TV renderer and focus the current option once
per picker opening. Keep the proxy password visible inside the TV editor only.

Keep the phone controls, setting definitions, and handlers unchanged.
@eliotcougar eliotcougar changed the title TV UI: Dedicated D-pad Settings screen TV UI: Settings screen Nov 28, 2026
import com.v2ray.ang.util.LogUtil
import com.v2ray.ang.util.Utils
import com.v2ray.ang.ui.settings.SettingsForm
import com.v2ray.ang.ui.settings.SettingsRows

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

最好不要给原来的代码做修改了。
tv 的如果重名了可以加上 tv 前缀

@2dust

2dust commented Nov 30, 2026

Copy link
Copy Markdown
Owner

还有不要想 ui 的代码共用,如果是业务代码请放到 vm 中,如果是 ui 代码复制后再修改,代码重复了没有关系,就是要分离

@2dust

2dust commented Nov 30, 2026

Copy link
Copy Markdown
Owner

原则就是 tv ui 如果和 mobile 不同就全新重写,不要修改原来的 ui 适配 tv。
因为按照你现在的设计,所有的界面都会被重写,那么适配的代码会非常的复杂,难以维护。
分开是最好的,你也可以发挥你的想法,不受到原来的限制。

Restore upstream mobile Settings and remove the shared row interface. Place the TV form and controls under ui.tv.settings and preserve the existing SettingsViewModel and preference behavior.
@eliotcougar
eliotcougar marked this pull request as ready for review November 30, 2026 17:53
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.

2 participants