Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class StreamSettings : AppCompatActivity() {
"category_screen_position" -> R.drawable.phc_video_camera
"category_display_behavior" -> R.drawable.phc_perf_resolution
"category_audio_settings" -> R.drawable.phc_audio
"category_microphone_settings" -> R.drawable.ic_mic_gm
"category_gamepad_settings" -> R.drawable.phc_gamepad
"category_input_settings" -> R.drawable.phc_keyboard
"category_onscreen_controls" -> R.drawable.phc_game_controller
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@
<string name="title_checkbox_resume_stream">自动恢复串流</string>
<string name="summary_checkbox_resume_stream">当从后台切回Moonlight时,自动恢复串流会话。</string>
<string name="category_host_settings">主机</string>
<string name="title_checkbox_enable_sops">让游戏设置匹配串流规格</string>
<string name="title_checkbox_enable_sops">自动优化主机设置</string>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
<string name="summary_checkbox_enable_sops">允许兼容的主机软件根据请求的串流分辨率和质量调整受支持游戏;更改发生在主机上。</string>
<string name="title_checkbox_host_audio">同时在主机播放声音</string>
<string name="summary_checkbox_host_audio">在主机和本设备上同时输出串流音频。</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
<string name="title_checkbox_small_icon_mode">使用小封面</string>
<string name="summary_checkbox_small_icon_mode">使用小圖示以在螢幕上顯示更多應用程式</string>
<string name="category_host_settings">主機</string>
<string name="title_checkbox_enable_sops">讓遊戲設定符合串流規格</string>
<string name="title_checkbox_enable_sops">最佳化遊戲設定</string>
<string name="summary_checkbox_enable_sops">允許相容的主機軟體依照所請求的串流解析度與品質調整支援的遊戲;變更發生在主機上。</string>
<string name="title_checkbox_host_audio">在電腦上播放音訊</string>
<string name="summary_checkbox_host_audio">在電腦和本裝置同時輸出音訊</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@
<string name="summary_checkbox_resume_stream">Automatically resume the stream when returning to Moonlight from the background</string>

<string name="category_host_settings">Host</string>
<string name="title_checkbox_enable_sops">Match game settings to the stream</string>
<string name="title_checkbox_enable_sops">Optimize game settings</string>
<string name="summary_checkbox_enable_sops">Allow compatible host software to adjust supported games for the requested stream resolution and quality. Changes are made on the host.</string>
<string name="title_checkbox_host_audio">Play audio on PC</string>
<string name="summary_checkbox_host_audio">Play audio from the computer and this device</string>
Expand Down
31 changes: 25 additions & 6 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

<PreferenceCategory android:title="@string/category_basic_settings"
android:key="category_basic_settings"
android:order="0"
android:layout="@layout/preference_category_material">
<ListPreference
android:key="list_resolution"
Expand Down Expand Up @@ -52,6 +53,7 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/category_advanced_features"
android:key="category_advanced_features"
android:order="4"
android:layout="@layout/preference_category_material"
app:initialExpandedChildrenCount="6">
<CheckBoxPreference
Expand Down Expand Up @@ -111,16 +113,11 @@
android:title="@string/title_force_mtk_max_operating_rate"
android:summary="@string/summary_force_mtk_max_operating_rate"
android:defaultValue="false" />
<CheckBoxPreference
android:key="checkbox_full_range"
android:title="@string/title_full_range"
android:summary="@string/summary_full_range"
android:defaultValue="false" />

</PreferenceCategory>
<!-- Runtime gating is enforced again in Game before capture starts. -->
<PreferenceCategory android:title="@string/category_framegen_settings"
android:key="category_framegen_settings"
android:order="5"
android:layout="@layout/preference_category_material">
<Preference
android:key="pref_framegen_pick_lossless_dll"
Expand Down Expand Up @@ -179,6 +176,7 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/category_host_settings"
android:key="category_host_settings"
android:order="2"
android:layout="@layout/preference_category_material"
app:initialExpandedChildrenCount="8">
<CheckBoxPreference
Expand Down Expand Up @@ -266,6 +264,7 @@
android:key="category_screen_position"
android:title="@string/category_screen_position_settings"
android:icon="@drawable/ic_screen_position"
android:order="1"
android:layout="@layout/preference_category_material">
<ListPreference
android:key="video_format"
Expand Down Expand Up @@ -312,6 +311,11 @@
android:entries="@array/hdr_mode_entries"
android:entryValues="@array/hdr_mode_values"
android:defaultValue="1" />
<CheckBoxPreference
android:key="checkbox_full_range"
android:title="@string/title_full_range"
android:summary="@string/summary_full_range"
android:defaultValue="false" />
<Preference
android:key="capability_diagnostic"
android:title="@string/title_capability_diagnostic"
Expand All @@ -320,6 +324,7 @@
<PreferenceCategory
android:key="category_display_behavior"
android:title="@string/category_display_behavior"
android:order="3"
android:layout="@layout/preference_category_material">
<CheckBoxPreference
android:key="checkbox_enable_pip"
Expand Down Expand Up @@ -383,6 +388,7 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/category_ui_settings"
android:key="category_ui_settings"
android:order="12"
android:layout="@layout/preference_category_material"
app:initialExpandedChildrenCount="9">
<com.limelight.preferences.LanguagePreference
Expand Down Expand Up @@ -527,6 +533,7 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/category_audio_settings"
android:key="category_audio_settings"
android:order="6"
android:layout="@layout/preference_category_material"
app:initialExpandedChildrenCount="11">
<ListPreference
Expand Down Expand Up @@ -597,6 +604,12 @@
android:entries="@array/audio_vibration_scene_names"
android:entryValues="@array/audio_vibration_scene_values"
android:defaultValue="0" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/category_microphone_settings"
android:key="category_microphone_settings"
android:order="7"
android:layout="@layout/preference_category_material"
app:initialExpandedChildrenCount="4">
<CheckBoxPreference
android:key="checkbox_enable_mic"
android:title="@string/title_checkbox_enable_mic"
Expand Down Expand Up @@ -707,6 +720,7 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/category_gamepad_settings"
android:key="category_gamepad_settings"
android:order="8"
android:layout="@layout/preference_category_material"
app:initialExpandedChildrenCount="4">
<Preference
Expand Down Expand Up @@ -803,6 +817,7 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/category_input_settings"
android:key="category_input_settings"
android:order="9"
android:layout="@layout/preference_category_material"
app:initialExpandedChildrenCount="4">
<ListPreference
Expand Down Expand Up @@ -953,6 +968,7 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/category_on_screen_controls_settings"
android:key="category_onscreen_controls"
android:order="10"
android:layout="@layout/preference_category_material">
<CheckBoxPreference
android:defaultValue="false"
Expand Down Expand Up @@ -1004,6 +1020,7 @@
android:key="category_crown_features"
android:title="@string/category_crown_features"
android:icon="@drawable/ic_enhance"
android:order="11"
android:layout="@layout/preference_category_material">
<CheckBoxPreference
android:defaultValue="false"
Expand All @@ -1017,6 +1034,7 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/category_backup_restore"
android:key="category_backup_restore"
android:order="13"
android:layout="@layout/preference_category_material"
app:initialExpandedChildrenCount="5">
<Preference
Expand Down Expand Up @@ -1045,6 +1063,7 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/category_help"
android:key="category_help"
android:order="14"
android:layout="@layout/preference_category_material">
<!-- <com.limelight.preferences.WebLauncherPreference
android:title="@string/title_setup_guide"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.limelight.preferences

import java.io.File
import javax.xml.parsers.DocumentBuilderFactory
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertTrue
Expand Down Expand Up @@ -118,15 +119,14 @@ class SettingsResourceHygieneTest {
}

@Test
fun consolidatedCategoriesKeepEveryPreferenceKey() {
fun settingsCategoriesKeepEveryPreferenceKey() {
val preferences = parse(File(resourceDir, "xml/preferences.xml"))
val categories = preferences.documentElement
.getElementsByTagName("PreferenceCategory")
.asElementSequence()
.associateBy { it.getAttributeNS(ANDROID_NAMESPACE, "key") }

setOf(
"category_microphone_settings",
"category_enhanced_touch",
"category_float_ball",
"category_connection_settings",
Expand All @@ -135,6 +135,16 @@ class SettingsResourceHygieneTest {
}

val expectedKeysByCategory = mapOf(
"category_screen_position" to setOf(
"video_format",
"checkbox_enable_hdr",
"checkbox_enable_hdr_high_brightness",
"checkbox_hdr_brightness_override",
"seekbar_hdr_peak_brightness_nits",
"list_hdr_mode",
"checkbox_full_range",
"capability_diagnostic",
),
"category_host_settings" to setOf(
"list_background_stream_behavior",
"list_quit_behavior",
Expand All @@ -151,7 +161,7 @@ class SettingsResourceHygieneTest {
"list_float_ball_double_click_action",
"list_float_ball_long_click_action",
),
"category_audio_settings" to setOf(
"category_microphone_settings" to setOf(
"checkbox_enable_mic",
"list_mic_menu_action_mode",
"checkbox_show_mic_button",
Expand Down Expand Up @@ -180,6 +190,30 @@ class SettingsResourceHygieneTest {
),
)

listOf(
"category_basic_settings",
"category_screen_position",
"category_host_settings",
"category_display_behavior",
"category_advanced_features",
"category_framegen_settings",
"category_audio_settings",
"category_microphone_settings",
"category_gamepad_settings",
"category_input_settings",
"category_onscreen_controls",
"category_crown_features",
"category_ui_settings",
"category_backup_restore",
"category_help",
).forEachIndexed { order, categoryKey ->
assertEquals(
"Unexpected sidebar order for $categoryKey",
order.toString(),
categories[categoryKey]?.getAttributeNS(ANDROID_NAMESPACE, "order"),
)
}

expectedKeysByCategory.forEach { (categoryKey, expectedKeys) ->
val category = categories[categoryKey]
assertNotNull("Missing target category: $categoryKey", category)
Expand All @@ -189,7 +223,7 @@ class SettingsResourceHygieneTest {
.toSet()
expectedKeys.forEach { preferenceKey ->
assertTrue(
"$preferenceKey was not moved under $categoryKey",
"$preferenceKey is missing from $categoryKey",
preferenceKey in actualKeys,
)
}
Expand Down
Loading