diff options
18 files changed, 174 insertions, 96 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Settings.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Settings.kt index 08e2a973d..2bf0e1b0d 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Settings.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Settings.kt | |||
| @@ -82,7 +82,6 @@ object Settings { | |||
| 82 | 82 | ||
| 83 | enum class MenuTag(val titleId: Int) { | 83 | enum class MenuTag(val titleId: Int) { |
| 84 | SECTION_ROOT(R.string.advanced_settings), | 84 | SECTION_ROOT(R.string.advanced_settings), |
| 85 | SECTION_GENERAL(R.string.preferences_general), | ||
| 86 | SECTION_SYSTEM(R.string.preferences_system), | 85 | SECTION_SYSTEM(R.string.preferences_system), |
| 87 | SECTION_RENDERER(R.string.preferences_graphics), | 86 | SECTION_RENDERER(R.string.preferences_graphics), |
| 88 | SECTION_AUDIO(R.string.preferences_audio), | 87 | SECTION_AUDIO(R.string.preferences_audio), |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/RunnableSetting.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/RunnableSetting.kt index 522cc49df..425160024 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/RunnableSetting.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/RunnableSetting.kt | |||
| @@ -3,10 +3,13 @@ | |||
| 3 | 3 | ||
| 4 | package org.yuzu.yuzu_emu.features.settings.model.view | 4 | package org.yuzu.yuzu_emu.features.settings.model.view |
| 5 | 5 | ||
| 6 | import androidx.annotation.DrawableRes | ||
| 7 | |||
| 6 | class RunnableSetting( | 8 | class RunnableSetting( |
| 7 | titleId: Int, | 9 | titleId: Int, |
| 8 | descriptionId: Int, | 10 | descriptionId: Int, |
| 9 | val isRuntimeRunnable: Boolean, | 11 | val isRuntimeRunnable: Boolean, |
| 12 | @DrawableRes val iconId: Int = 0, | ||
| 10 | val runnable: () -> Unit | 13 | val runnable: () -> Unit |
| 11 | ) : SettingsItem(emptySetting, titleId, descriptionId) { | 14 | ) : SettingsItem(emptySetting, titleId, descriptionId) { |
| 12 | override val type = TYPE_RUNNABLE | 15 | override val type = TYPE_RUNNABLE |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SubmenuSetting.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SubmenuSetting.kt index b343e527e..94953b18a 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SubmenuSetting.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SubmenuSetting.kt | |||
| @@ -3,11 +3,14 @@ | |||
| 3 | 3 | ||
| 4 | package org.yuzu.yuzu_emu.features.settings.model.view | 4 | package org.yuzu.yuzu_emu.features.settings.model.view |
| 5 | 5 | ||
| 6 | import androidx.annotation.DrawableRes | ||
| 7 | import androidx.annotation.StringRes | ||
| 6 | import org.yuzu.yuzu_emu.features.settings.model.Settings | 8 | import org.yuzu.yuzu_emu.features.settings.model.Settings |
| 7 | 9 | ||
| 8 | class SubmenuSetting( | 10 | class SubmenuSetting( |
| 9 | titleId: Int, | 11 | @StringRes titleId: Int, |
| 10 | descriptionId: Int, | 12 | @StringRes descriptionId: Int, |
| 13 | @DrawableRes val iconId: Int, | ||
| 11 | val menuKey: Settings.MenuTag | 14 | val menuKey: Settings.MenuTag |
| 12 | ) : SettingsItem(emptySetting, titleId, descriptionId) { | 15 | ) : SettingsItem(emptySetting, titleId, descriptionId) { |
| 13 | override val type = TYPE_SUBMENU | 16 | override val type = TYPE_SUBMENU |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragment.kt index 70d8ec14b..769baf744 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragment.kt | |||
| @@ -20,7 +20,6 @@ import androidx.lifecycle.repeatOnLifecycle | |||
| 20 | import androidx.navigation.findNavController | 20 | import androidx.navigation.findNavController |
| 21 | import androidx.navigation.fragment.navArgs | 21 | import androidx.navigation.fragment.navArgs |
| 22 | import androidx.recyclerview.widget.LinearLayoutManager | 22 | import androidx.recyclerview.widget.LinearLayoutManager |
| 23 | import com.google.android.material.divider.MaterialDividerItemDecoration | ||
| 24 | import com.google.android.material.transition.MaterialSharedAxis | 23 | import com.google.android.material.transition.MaterialSharedAxis |
| 25 | import kotlinx.coroutines.flow.collectLatest | 24 | import kotlinx.coroutines.flow.collectLatest |
| 26 | import kotlinx.coroutines.launch | 25 | import kotlinx.coroutines.launch |
| @@ -68,15 +67,9 @@ class SettingsFragment : Fragment() { | |||
| 68 | ) | 67 | ) |
| 69 | 68 | ||
| 70 | binding.toolbarSettingsLayout.title = getString(args.menuTag.titleId) | 69 | binding.toolbarSettingsLayout.title = getString(args.menuTag.titleId) |
| 71 | val dividerDecoration = MaterialDividerItemDecoration( | ||
| 72 | requireContext(), | ||
| 73 | LinearLayoutManager.VERTICAL | ||
| 74 | ) | ||
| 75 | dividerDecoration.isLastItemDecorated = false | ||
| 76 | binding.listSettings.apply { | 70 | binding.listSettings.apply { |
| 77 | adapter = settingsAdapter | 71 | adapter = settingsAdapter |
| 78 | layoutManager = LinearLayoutManager(requireContext()) | 72 | layoutManager = LinearLayoutManager(requireContext()) |
| 79 | addItemDecoration(dividerDecoration) | ||
| 80 | } | 73 | } |
| 81 | 74 | ||
| 82 | binding.toolbarSettings.setNavigationOnClickListener { | 75 | binding.toolbarSettings.setNavigationOnClickListener { |
| @@ -94,17 +87,6 @@ class SettingsFragment : Fragment() { | |||
| 94 | } | 87 | } |
| 95 | } | 88 | } |
| 96 | } | 89 | } |
| 97 | launch { | ||
| 98 | settingsViewModel.isUsingSearch.collectLatest { | ||
| 99 | if (it) { | ||
| 100 | reenterTransition = MaterialSharedAxis(MaterialSharedAxis.Z, true) | ||
| 101 | exitTransition = MaterialSharedAxis(MaterialSharedAxis.Z, false) | ||
| 102 | } else { | ||
| 103 | reenterTransition = MaterialSharedAxis(MaterialSharedAxis.X, false) | ||
| 104 | exitTransition = MaterialSharedAxis(MaterialSharedAxis.X, true) | ||
| 105 | } | ||
| 106 | } | ||
| 107 | } | ||
| 108 | } | 90 | } |
| 109 | 91 | ||
| 110 | if (args.menuTag == Settings.MenuTag.SECTION_ROOT) { | 92 | if (args.menuTag == Settings.MenuTag.SECTION_ROOT) { |
| @@ -112,8 +94,6 @@ class SettingsFragment : Fragment() { | |||
| 112 | binding.toolbarSettings.setOnMenuItemClickListener { | 94 | binding.toolbarSettings.setOnMenuItemClickListener { |
| 113 | when (it.itemId) { | 95 | when (it.itemId) { |
| 114 | R.id.action_search -> { | 96 | R.id.action_search -> { |
| 115 | reenterTransition = MaterialSharedAxis(MaterialSharedAxis.Z, true) | ||
| 116 | exitTransition = MaterialSharedAxis(MaterialSharedAxis.Z, false) | ||
| 117 | view.findNavController() | 97 | view.findNavController() |
| 118 | .navigate(R.id.action_settingsFragment_to_settingsSearchFragment) | 98 | .navigate(R.id.action_settingsFragment_to_settingsSearchFragment) |
| 119 | true | 99 | true |
| @@ -129,11 +109,6 @@ class SettingsFragment : Fragment() { | |||
| 129 | setInsets() | 109 | setInsets() |
| 130 | } | 110 | } |
| 131 | 111 | ||
| 132 | override fun onResume() { | ||
| 133 | super.onResume() | ||
| 134 | settingsViewModel.setIsUsingSearch(false) | ||
| 135 | } | ||
| 136 | |||
| 137 | private fun setInsets() { | 112 | private fun setInsets() { |
| 138 | ViewCompat.setOnApplyWindowInsetsListener( | 113 | ViewCompat.setOnApplyWindowInsetsListener( |
| 139 | binding.root | 114 | binding.root |
| @@ -144,10 +119,9 @@ class SettingsFragment : Fragment() { | |||
| 144 | val leftInsets = barInsets.left + cutoutInsets.left | 119 | val leftInsets = barInsets.left + cutoutInsets.left |
| 145 | val rightInsets = barInsets.right + cutoutInsets.right | 120 | val rightInsets = barInsets.right + cutoutInsets.right |
| 146 | 121 | ||
| 147 | val sideMargin = resources.getDimensionPixelSize(R.dimen.spacing_medlarge) | ||
| 148 | val mlpSettingsList = binding.listSettings.layoutParams as MarginLayoutParams | 122 | val mlpSettingsList = binding.listSettings.layoutParams as MarginLayoutParams |
| 149 | mlpSettingsList.leftMargin = sideMargin + leftInsets | 123 | mlpSettingsList.leftMargin = leftInsets |
| 150 | mlpSettingsList.rightMargin = sideMargin + rightInsets | 124 | mlpSettingsList.rightMargin = rightInsets |
| 151 | binding.listSettings.layoutParams = mlpSettingsList | 125 | binding.listSettings.layoutParams = mlpSettingsList |
| 152 | binding.listSettings.updatePadding( | 126 | binding.listSettings.updatePadding( |
| 153 | bottom = barInsets.bottom | 127 | bottom = barInsets.bottom |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt index 766414a6c..8b71e32f3 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | package org.yuzu.yuzu_emu.features.settings.ui | 4 | package org.yuzu.yuzu_emu.features.settings.ui |
| 5 | 5 | ||
| 6 | import android.content.Context | ||
| 7 | import android.content.SharedPreferences | 6 | import android.content.SharedPreferences |
| 8 | import android.os.Build | 7 | import android.os.Build |
| 9 | import android.widget.Toast | 8 | import android.widget.Toast |
| @@ -32,8 +31,6 @@ class SettingsFragmentPresenter( | |||
| 32 | private val preferences: SharedPreferences | 31 | private val preferences: SharedPreferences |
| 33 | get() = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext) | 32 | get() = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext) |
| 34 | 33 | ||
| 35 | private val context: Context get() = YuzuApplication.appContext | ||
| 36 | |||
| 37 | // Extension for populating settings list based on paired settings | 34 | // Extension for populating settings list based on paired settings |
| 38 | fun ArrayList<SettingsItem>.add(key: String) { | 35 | fun ArrayList<SettingsItem>.add(key: String) { |
| 39 | val item = SettingsItem.settingsItems[key]!! | 36 | val item = SettingsItem.settingsItems[key]!! |
| @@ -53,7 +50,6 @@ class SettingsFragmentPresenter( | |||
| 53 | val sl = ArrayList<SettingsItem>() | 50 | val sl = ArrayList<SettingsItem>() |
| 54 | when (menuTag) { | 51 | when (menuTag) { |
| 55 | Settings.MenuTag.SECTION_ROOT -> addConfigSettings(sl) | 52 | Settings.MenuTag.SECTION_ROOT -> addConfigSettings(sl) |
| 56 | Settings.MenuTag.SECTION_GENERAL -> addGeneralSettings(sl) | ||
| 57 | Settings.MenuTag.SECTION_SYSTEM -> addSystemSettings(sl) | 53 | Settings.MenuTag.SECTION_SYSTEM -> addSystemSettings(sl) |
| 58 | Settings.MenuTag.SECTION_RENDERER -> addGraphicsSettings(sl) | 54 | Settings.MenuTag.SECTION_RENDERER -> addGraphicsSettings(sl) |
| 59 | Settings.MenuTag.SECTION_AUDIO -> addAudioSettings(sl) | 55 | Settings.MenuTag.SECTION_AUDIO -> addAudioSettings(sl) |
| @@ -75,30 +71,53 @@ class SettingsFragmentPresenter( | |||
| 75 | 71 | ||
| 76 | private fun addConfigSettings(sl: ArrayList<SettingsItem>) { | 72 | private fun addConfigSettings(sl: ArrayList<SettingsItem>) { |
| 77 | sl.apply { | 73 | sl.apply { |
| 78 | add(SubmenuSetting(R.string.preferences_general, 0, Settings.MenuTag.SECTION_GENERAL)) | ||
| 79 | add(SubmenuSetting(R.string.preferences_system, 0, Settings.MenuTag.SECTION_SYSTEM)) | ||
| 80 | add(SubmenuSetting(R.string.preferences_graphics, 0, Settings.MenuTag.SECTION_RENDERER)) | ||
| 81 | add(SubmenuSetting(R.string.preferences_audio, 0, Settings.MenuTag.SECTION_AUDIO)) | ||
| 82 | add(SubmenuSetting(R.string.preferences_debug, 0, Settings.MenuTag.SECTION_DEBUG)) | ||
| 83 | add( | 74 | add( |
| 84 | RunnableSetting(R.string.reset_to_default, 0, false) { | 75 | SubmenuSetting( |
| 85 | settingsViewModel.setShouldShowResetSettingsDialog(true) | 76 | R.string.preferences_system, |
| 86 | } | 77 | R.string.preferences_system_description, |
| 78 | R.drawable.ic_system_settings, | ||
| 79 | Settings.MenuTag.SECTION_SYSTEM | ||
| 80 | ) | ||
| 81 | ) | ||
| 82 | add( | ||
| 83 | SubmenuSetting( | ||
| 84 | R.string.preferences_graphics, | ||
| 85 | R.string.preferences_graphics_description, | ||
| 86 | R.drawable.ic_graphics, | ||
| 87 | Settings.MenuTag.SECTION_RENDERER | ||
| 88 | ) | ||
| 89 | ) | ||
| 90 | add( | ||
| 91 | SubmenuSetting( | ||
| 92 | R.string.preferences_audio, | ||
| 93 | R.string.preferences_audio_description, | ||
| 94 | R.drawable.ic_audio, | ||
| 95 | Settings.MenuTag.SECTION_AUDIO | ||
| 96 | ) | ||
| 97 | ) | ||
| 98 | add( | ||
| 99 | SubmenuSetting( | ||
| 100 | R.string.preferences_debug, | ||
| 101 | R.string.preferences_debug_description, | ||
| 102 | R.drawable.ic_code, | ||
| 103 | Settings.MenuTag.SECTION_DEBUG | ||
| 104 | ) | ||
| 105 | ) | ||
| 106 | add( | ||
| 107 | RunnableSetting( | ||
| 108 | R.string.reset_to_default, | ||
| 109 | R.string.reset_to_default_description, | ||
| 110 | false, | ||
| 111 | R.drawable.ic_restore | ||
| 112 | ) { settingsViewModel.setShouldShowResetSettingsDialog(true) } | ||
| 87 | ) | 113 | ) |
| 88 | } | 114 | } |
| 89 | } | 115 | } |
| 90 | 116 | ||
| 91 | private fun addGeneralSettings(sl: ArrayList<SettingsItem>) { | 117 | private fun addSystemSettings(sl: ArrayList<SettingsItem>) { |
| 92 | sl.apply { | 118 | sl.apply { |
| 93 | add(BooleanSetting.RENDERER_USE_SPEED_LIMIT.key) | 119 | add(BooleanSetting.RENDERER_USE_SPEED_LIMIT.key) |
| 94 | add(ShortSetting.RENDERER_SPEED_LIMIT.key) | 120 | add(ShortSetting.RENDERER_SPEED_LIMIT.key) |
| 95 | add(IntSetting.CPU_ACCURACY.key) | ||
| 96 | add(BooleanSetting.PICTURE_IN_PICTURE.key) | ||
| 97 | } | ||
| 98 | } | ||
| 99 | |||
| 100 | private fun addSystemSettings(sl: ArrayList<SettingsItem>) { | ||
| 101 | sl.apply { | ||
| 102 | add(BooleanSetting.USE_DOCKED_MODE.key) | 121 | add(BooleanSetting.USE_DOCKED_MODE.key) |
| 103 | add(IntSetting.REGION_INDEX.key) | 122 | add(IntSetting.REGION_INDEX.key) |
| 104 | add(IntSetting.LANGUAGE_INDEX.key) | 123 | add(IntSetting.LANGUAGE_INDEX.key) |
| @@ -116,6 +135,7 @@ class SettingsFragmentPresenter( | |||
| 116 | add(IntSetting.RENDERER_ANTI_ALIASING.key) | 135 | add(IntSetting.RENDERER_ANTI_ALIASING.key) |
| 117 | add(IntSetting.RENDERER_SCREEN_LAYOUT.key) | 136 | add(IntSetting.RENDERER_SCREEN_LAYOUT.key) |
| 118 | add(IntSetting.RENDERER_ASPECT_RATIO.key) | 137 | add(IntSetting.RENDERER_ASPECT_RATIO.key) |
| 138 | add(BooleanSetting.PICTURE_IN_PICTURE.key) | ||
| 119 | add(BooleanSetting.RENDERER_USE_DISK_SHADER_CACHE.key) | 139 | add(BooleanSetting.RENDERER_USE_DISK_SHADER_CACHE.key) |
| 120 | add(BooleanSetting.RENDERER_FORCE_MAX_CLOCK.key) | 140 | add(BooleanSetting.RENDERER_FORCE_MAX_CLOCK.key) |
| 121 | add(BooleanSetting.RENDERER_ASYNCHRONOUS_SHADERS.key) | 141 | add(BooleanSetting.RENDERER_ASYNCHRONOUS_SHADERS.key) |
| @@ -249,6 +269,7 @@ class SettingsFragmentPresenter( | |||
| 249 | add(BooleanSetting.RENDERER_DEBUG.key) | 269 | add(BooleanSetting.RENDERER_DEBUG.key) |
| 250 | 270 | ||
| 251 | add(HeaderSetting(R.string.cpu)) | 271 | add(HeaderSetting(R.string.cpu)) |
| 272 | add(IntSetting.CPU_ACCURACY.key) | ||
| 252 | add(BooleanSetting.CPU_DEBUG_MODE.key) | 273 | add(BooleanSetting.CPU_DEBUG_MODE.key) |
| 253 | add(SettingsItem.FASTMEM_COMBINED) | 274 | add(SettingsItem.FASTMEM_COMBINED) |
| 254 | } | 275 | } |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/RunnableViewHolder.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/RunnableViewHolder.kt index 83a2e94f1..036195624 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/RunnableViewHolder.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/RunnableViewHolder.kt | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | package org.yuzu.yuzu_emu.features.settings.ui.viewholder | 4 | package org.yuzu.yuzu_emu.features.settings.ui.viewholder |
| 5 | 5 | ||
| 6 | import android.view.View | 6 | import android.view.View |
| 7 | import androidx.core.content.res.ResourcesCompat | ||
| 7 | import org.yuzu.yuzu_emu.NativeLibrary | 8 | import org.yuzu.yuzu_emu.NativeLibrary |
| 8 | import org.yuzu.yuzu_emu.databinding.ListItemSettingBinding | 9 | import org.yuzu.yuzu_emu.databinding.ListItemSettingBinding |
| 9 | import org.yuzu.yuzu_emu.features.settings.model.view.RunnableSetting | 10 | import org.yuzu.yuzu_emu.features.settings.model.view.RunnableSetting |
| @@ -16,6 +17,19 @@ class RunnableViewHolder(val binding: ListItemSettingBinding, adapter: SettingsA | |||
| 16 | 17 | ||
| 17 | override fun bind(item: SettingsItem) { | 18 | override fun bind(item: SettingsItem) { |
| 18 | setting = item as RunnableSetting | 19 | setting = item as RunnableSetting |
| 20 | if (item.iconId != 0) { | ||
| 21 | binding.icon.visibility = View.VISIBLE | ||
| 22 | binding.icon.setImageDrawable( | ||
| 23 | ResourcesCompat.getDrawable( | ||
| 24 | binding.icon.resources, | ||
| 25 | item.iconId, | ||
| 26 | binding.icon.context.theme | ||
| 27 | ) | ||
| 28 | ) | ||
| 29 | } else { | ||
| 30 | binding.icon.visibility = View.GONE | ||
| 31 | } | ||
| 32 | |||
| 19 | binding.textSettingName.setText(item.nameId) | 33 | binding.textSettingName.setText(item.nameId) |
| 20 | if (item.descriptionId != 0) { | 34 | if (item.descriptionId != 0) { |
| 21 | binding.textSettingDescription.setText(item.descriptionId) | 35 | binding.textSettingDescription.setText(item.descriptionId) |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SubmenuViewHolder.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SubmenuViewHolder.kt index 1cf581a9d..8100c65dd 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SubmenuViewHolder.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/viewholder/SubmenuViewHolder.kt | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | package org.yuzu.yuzu_emu.features.settings.ui.viewholder | 4 | package org.yuzu.yuzu_emu.features.settings.ui.viewholder |
| 5 | 5 | ||
| 6 | import android.view.View | 6 | import android.view.View |
| 7 | import androidx.core.content.res.ResourcesCompat | ||
| 7 | import org.yuzu.yuzu_emu.databinding.ListItemSettingBinding | 8 | import org.yuzu.yuzu_emu.databinding.ListItemSettingBinding |
| 8 | import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem | 9 | import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem |
| 9 | import org.yuzu.yuzu_emu.features.settings.model.view.SubmenuSetting | 10 | import org.yuzu.yuzu_emu.features.settings.model.view.SubmenuSetting |
| @@ -15,6 +16,19 @@ class SubmenuViewHolder(val binding: ListItemSettingBinding, adapter: SettingsAd | |||
| 15 | 16 | ||
| 16 | override fun bind(item: SettingsItem) { | 17 | override fun bind(item: SettingsItem) { |
| 17 | this.item = item as SubmenuSetting | 18 | this.item = item as SubmenuSetting |
| 19 | if (item.iconId != 0) { | ||
| 20 | binding.icon.visibility = View.VISIBLE | ||
| 21 | binding.icon.setImageDrawable( | ||
| 22 | ResourcesCompat.getDrawable( | ||
| 23 | binding.icon.resources, | ||
| 24 | item.iconId, | ||
| 25 | binding.icon.context.theme | ||
| 26 | ) | ||
| 27 | ) | ||
| 28 | } else { | ||
| 29 | binding.icon.visibility = View.GONE | ||
| 30 | } | ||
| 31 | |||
| 18 | binding.textSettingName.setText(item.nameId) | 32 | binding.textSettingName.setText(item.nameId) |
| 19 | if (item.descriptionId != 0) { | 33 | if (item.descriptionId != 0) { |
| 20 | binding.textSettingDescription.setText(item.descriptionId) | 34 | binding.textSettingDescription.setText(item.descriptionId) |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SettingsSearchFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SettingsSearchFragment.kt index 9d0594c6e..f95d545bf 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SettingsSearchFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SettingsSearchFragment.kt | |||
| @@ -40,8 +40,10 @@ class SettingsSearchFragment : Fragment() { | |||
| 40 | 40 | ||
| 41 | override fun onCreate(savedInstanceState: Bundle?) { | 41 | override fun onCreate(savedInstanceState: Bundle?) { |
| 42 | super.onCreate(savedInstanceState) | 42 | super.onCreate(savedInstanceState) |
| 43 | enterTransition = MaterialSharedAxis(MaterialSharedAxis.Z, false) | 43 | enterTransition = MaterialSharedAxis(MaterialSharedAxis.X, true) |
| 44 | returnTransition = MaterialSharedAxis(MaterialSharedAxis.Z, true) | 44 | returnTransition = MaterialSharedAxis(MaterialSharedAxis.X, false) |
| 45 | reenterTransition = MaterialSharedAxis(MaterialSharedAxis.X, false) | ||
| 46 | exitTransition = MaterialSharedAxis(MaterialSharedAxis.X, true) | ||
| 45 | } | 47 | } |
| 46 | 48 | ||
| 47 | override fun onCreateView( | 49 | override fun onCreateView( |
| @@ -55,7 +57,6 @@ class SettingsSearchFragment : Fragment() { | |||
| 55 | 57 | ||
| 56 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 58 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
| 57 | super.onViewCreated(view, savedInstanceState) | 59 | super.onViewCreated(view, savedInstanceState) |
| 58 | settingsViewModel.setIsUsingSearch(true) | ||
| 59 | 60 | ||
| 60 | if (savedInstanceState != null) { | 61 | if (savedInstanceState != null) { |
| 61 | binding.searchText.setText(savedInstanceState.getString(SEARCH_TEXT)) | 62 | binding.searchText.setText(savedInstanceState.getString(SEARCH_TEXT)) |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/SettingsViewModel.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/SettingsViewModel.kt index 53fa7a8de..6f947674e 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/SettingsViewModel.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/SettingsViewModel.kt | |||
| @@ -29,9 +29,6 @@ class SettingsViewModel : ViewModel() { | |||
| 29 | val shouldReloadSettingsList: StateFlow<Boolean> get() = _shouldReloadSettingsList | 29 | val shouldReloadSettingsList: StateFlow<Boolean> get() = _shouldReloadSettingsList |
| 30 | private val _shouldReloadSettingsList = MutableStateFlow(false) | 30 | private val _shouldReloadSettingsList = MutableStateFlow(false) |
| 31 | 31 | ||
| 32 | val isUsingSearch: StateFlow<Boolean> get() = _isUsingSearch | ||
| 33 | private val _isUsingSearch = MutableStateFlow(false) | ||
| 34 | |||
| 35 | val sliderProgress: StateFlow<Int> get() = _sliderProgress | 32 | val sliderProgress: StateFlow<Int> get() = _sliderProgress |
| 36 | private val _sliderProgress = MutableStateFlow(-1) | 33 | private val _sliderProgress = MutableStateFlow(-1) |
| 37 | 34 | ||
| @@ -57,10 +54,6 @@ class SettingsViewModel : ViewModel() { | |||
| 57 | _shouldReloadSettingsList.value = value | 54 | _shouldReloadSettingsList.value = value |
| 58 | } | 55 | } |
| 59 | 56 | ||
| 60 | fun setIsUsingSearch(value: Boolean) { | ||
| 61 | _isUsingSearch.value = value | ||
| 62 | } | ||
| 63 | |||
| 64 | fun setSliderTextValue(value: Float, units: String) { | 57 | fun setSliderTextValue(value: Float, units: String) { |
| 65 | _sliderProgress.value = value.toInt() | 58 | _sliderProgress.value = value.toInt() |
| 66 | _sliderTextValue.value = String.format( | 59 | _sliderTextValue.value = String.format( |
diff --git a/src/android/app/src/main/res/drawable/ic_audio.xml b/src/android/app/src/main/res/drawable/ic_audio.xml new file mode 100644 index 000000000..e306c3b0c --- /dev/null +++ b/src/android/app/src/main/res/drawable/ic_audio.xml | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 2 | android:width="24dp" | ||
| 3 | android:height="24dp" | ||
| 4 | android:viewportHeight="24" | ||
| 5 | android:viewportWidth="24"> | ||
| 6 | <path | ||
| 7 | android:fillColor="?attr/colorControlNormal" | ||
| 8 | android:pathData="M3,9v6h4l5,5L12,4L7,9L3,9zM16.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02zM14,3.23v2.06c2.89,0.86 5,3.54 5,6.71s-2.11,5.85 -5,6.71v2.06c4.01,-0.91 7,-4.49 7,-8.77s-2.99,-7.86 -7,-8.77z" /> | ||
| 9 | </vector> | ||
diff --git a/src/android/app/src/main/res/drawable/ic_code.xml b/src/android/app/src/main/res/drawable/ic_code.xml new file mode 100644 index 000000000..26f83b39b --- /dev/null +++ b/src/android/app/src/main/res/drawable/ic_code.xml | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 2 | android:width="24dp" | ||
| 3 | android:height="24dp" | ||
| 4 | android:viewportWidth="960" | ||
| 5 | android:viewportHeight="960"> | ||
| 6 | <path | ||
| 7 | android:fillColor="?attr/colorControlNormal" | ||
| 8 | android:pathData="M320,720 L80,480l240,-240 57,57 -184,184 183,183 -56,56ZM640,720 L583,663 767,479 584,296 640,240 880,480 640,720Z"/> | ||
| 9 | </vector> | ||
diff --git a/src/android/app/src/main/res/drawable/ic_graphics.xml b/src/android/app/src/main/res/drawable/ic_graphics.xml new file mode 100644 index 000000000..2fdb5a4d6 --- /dev/null +++ b/src/android/app/src/main/res/drawable/ic_graphics.xml | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 2 | android:width="24dp" | ||
| 3 | android:height="24dp" | ||
| 4 | android:viewportWidth="960" | ||
| 5 | android:viewportHeight="960"> | ||
| 6 | <path | ||
| 7 | android:fillColor="?attr/colorControlNormal" | ||
| 8 | android:pathData="M160,840q-33,0 -56.5,-23.5T80,760v-560q0,-33 23.5,-56.5T160,120h560q33,0 56.5,23.5T800,200v80h80v80h-80v80h80v80h-80v80h80v80h-80v80q0,33 -23.5,56.5T720,840L160,840ZM160,760h560v-560L160,200v560ZM240,680h200v-160L240,520v160ZM480,400h160v-120L480,280v120ZM240,480h200v-200L240,280v200ZM480,680h160v-240L480,440v240ZM160,200v560,-560Z"/> | ||
| 9 | </vector> | ||
diff --git a/src/android/app/src/main/res/drawable/ic_system_settings.xml b/src/android/app/src/main/res/drawable/ic_system_settings.xml new file mode 100644 index 000000000..7701a2bab --- /dev/null +++ b/src/android/app/src/main/res/drawable/ic_system_settings.xml | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 2 | android:width="24dp" | ||
| 3 | android:height="24dp" | ||
| 4 | android:viewportWidth="960" | ||
| 5 | android:viewportHeight="960"> | ||
| 6 | <path | ||
| 7 | android:fillColor="?attr/colorControlNormal" | ||
| 8 | android:pathData="M320,960q-17,0 -28.5,-11.5T280,920q0,-17 11.5,-28.5T320,880q17,0 28.5,11.5T360,920q0,17 -11.5,28.5T320,960ZM480,960q-17,0 -28.5,-11.5T440,920q0,-17 11.5,-28.5T480,880q17,0 28.5,11.5T520,920q0,17 -11.5,28.5T480,960ZM640,960q-17,0 -28.5,-11.5T600,920q0,-17 11.5,-28.5T640,880q17,0 28.5,11.5T680,920q0,17 -11.5,28.5T640,960ZM320,800q-33,0 -56.5,-23.5T240,720v-640q0,-33 23.5,-56.5T320,0h320q33,0 56.5,23.5T720,80v640q0,33 -23.5,56.5T640,800L320,800ZM320,720h320v-40L320,680v40ZM320,600h320v-400L320,200v400ZM320,120h320v-40L320,80v40ZM320,120v-40,40ZM320,720v-40,40Z"/> | ||
| 9 | </vector> | ||
diff --git a/src/android/app/src/main/res/layout/list_item_setting.xml b/src/android/app/src/main/res/layout/list_item_setting.xml index f1037a740..544280e75 100644 --- a/src/android/app/src/main/res/layout/list_item_setting.xml +++ b/src/android/app/src/main/res/layout/list_item_setting.xml | |||
| @@ -10,41 +10,59 @@ | |||
| 10 | android:focusable="true" | 10 | android:focusable="true" |
| 11 | android:gravity="center_vertical" | 11 | android:gravity="center_vertical" |
| 12 | android:minHeight="72dp" | 12 | android:minHeight="72dp" |
| 13 | android:padding="@dimen/spacing_large"> | 13 | android:padding="16dp"> |
| 14 | 14 | ||
| 15 | <LinearLayout | 15 | <LinearLayout |
| 16 | android:layout_width="match_parent" | 16 | android:layout_width="match_parent" |
| 17 | android:layout_height="wrap_content" | 17 | android:layout_height="wrap_content" |
| 18 | android:orientation="vertical"> | 18 | android:orientation="horizontal"> |
| 19 | 19 | ||
| 20 | <com.google.android.material.textview.MaterialTextView | 20 | <ImageView |
| 21 | android:id="@+id/text_setting_name" | 21 | android:id="@+id/icon" |
| 22 | style="@style/TextAppearance.Material3.HeadlineMedium" | 22 | android:layout_width="24dp" |
| 23 | android:layout_width="match_parent" | 23 | android:layout_height="24dp" |
| 24 | android:layout_height="wrap_content" | 24 | android:layout_marginStart="8dp" |
| 25 | android:textAlignment="viewStart" | 25 | android:layout_marginEnd="24dp" |
| 26 | android:textSize="16sp" | 26 | android:layout_gravity="center_vertical" |
| 27 | app:lineHeight="22dp" | 27 | android:visibility="gone" |
| 28 | tools:text="Setting Name" /> | 28 | app:tint="?attr/colorOnSurface" /> |
| 29 | |||
| 30 | <com.google.android.material.textview.MaterialTextView | ||
| 31 | android:id="@+id/text_setting_description" | ||
| 32 | style="@style/TextAppearance.Material3.BodySmall" | ||
| 33 | android:layout_width="match_parent" | ||
| 34 | android:layout_height="wrap_content" | ||
| 35 | android:layout_marginTop="@dimen/spacing_small" | ||
| 36 | android:textAlignment="viewStart" | ||
| 37 | tools:text="@string/app_disclaimer" /> | ||
| 38 | 29 | ||
| 39 | <com.google.android.material.textview.MaterialTextView | 30 | <LinearLayout |
| 40 | android:id="@+id/text_setting_value" | ||
| 41 | style="@style/TextAppearance.Material3.LabelMedium" | ||
| 42 | android:layout_width="match_parent" | 31 | android:layout_width="match_parent" |
| 43 | android:layout_height="wrap_content" | 32 | android:layout_height="wrap_content" |
| 44 | android:layout_marginTop="@dimen/spacing_small" | 33 | android:orientation="vertical"> |
| 45 | android:textAlignment="viewStart" | 34 | |
| 46 | android:textStyle="bold" | 35 | <com.google.android.material.textview.MaterialTextView |
| 47 | tools:text="1x" /> | 36 | android:id="@+id/text_setting_name" |
| 37 | style="@style/TextAppearance.Material3.HeadlineMedium" | ||
| 38 | android:layout_width="match_parent" | ||
| 39 | android:layout_height="wrap_content" | ||
| 40 | android:textAlignment="viewStart" | ||
| 41 | android:textSize="17sp" | ||
| 42 | app:lineHeight="22dp" | ||
| 43 | tools:text="Setting Name" /> | ||
| 44 | |||
| 45 | <com.google.android.material.textview.MaterialTextView | ||
| 46 | android:id="@+id/text_setting_description" | ||
| 47 | style="@style/TextAppearance.Material3.BodySmall" | ||
| 48 | android:layout_width="match_parent" | ||
| 49 | android:layout_height="wrap_content" | ||
| 50 | android:layout_marginTop="@dimen/spacing_small" | ||
| 51 | android:textAlignment="viewStart" | ||
| 52 | tools:text="@string/app_disclaimer" /> | ||
| 53 | |||
| 54 | <com.google.android.material.textview.MaterialTextView | ||
| 55 | android:id="@+id/text_setting_value" | ||
| 56 | style="@style/TextAppearance.Material3.LabelMedium" | ||
| 57 | android:layout_width="match_parent" | ||
| 58 | android:layout_height="wrap_content" | ||
| 59 | android:layout_marginTop="@dimen/spacing_small" | ||
| 60 | android:textAlignment="viewStart" | ||
| 61 | android:textStyle="bold" | ||
| 62 | android:textSize="13sp" | ||
| 63 | tools:text="1x" /> | ||
| 64 | |||
| 65 | </LinearLayout> | ||
| 48 | 66 | ||
| 49 | </LinearLayout> | 67 | </LinearLayout> |
| 50 | 68 | ||
diff --git a/src/android/app/src/main/res/layout/list_item_setting_switch.xml b/src/android/app/src/main/res/layout/list_item_setting_switch.xml index a5767adee..a8f5aff78 100644 --- a/src/android/app/src/main/res/layout/list_item_setting_switch.xml +++ b/src/android/app/src/main/res/layout/list_item_setting_switch.xml | |||
| @@ -8,9 +8,7 @@ | |||
| 8 | android:clickable="true" | 8 | android:clickable="true" |
| 9 | android:focusable="true" | 9 | android:focusable="true" |
| 10 | android:minHeight="72dp" | 10 | android:minHeight="72dp" |
| 11 | android:paddingVertical="@dimen/spacing_large" | 11 | android:padding="16dp"> |
| 12 | android:paddingStart="@dimen/spacing_large" | ||
| 13 | android:paddingEnd="24dp"> | ||
| 14 | 12 | ||
| 15 | <com.google.android.material.materialswitch.MaterialSwitch | 13 | <com.google.android.material.materialswitch.MaterialSwitch |
| 16 | android:id="@+id/switch_widget" | 14 | android:id="@+id/switch_widget" |
| @@ -24,7 +22,7 @@ | |||
| 24 | android:layout_height="wrap_content" | 22 | android:layout_height="wrap_content" |
| 25 | android:layout_alignParentTop="true" | 23 | android:layout_alignParentTop="true" |
| 26 | android:layout_centerVertical="true" | 24 | android:layout_centerVertical="true" |
| 27 | android:layout_marginEnd="@dimen/spacing_large" | 25 | android:layout_marginEnd="24dp" |
| 28 | android:layout_toStartOf="@+id/switch_widget" | 26 | android:layout_toStartOf="@+id/switch_widget" |
| 29 | android:gravity="center_vertical" | 27 | android:gravity="center_vertical" |
| 30 | android:orientation="vertical"> | 28 | android:orientation="vertical"> |
| @@ -35,7 +33,7 @@ | |||
| 35 | android:layout_width="wrap_content" | 33 | android:layout_width="wrap_content" |
| 36 | android:layout_height="wrap_content" | 34 | android:layout_height="wrap_content" |
| 37 | android:textAlignment="viewStart" | 35 | android:textAlignment="viewStart" |
| 38 | android:textSize="16sp" | 36 | android:textSize="17sp" |
| 39 | app:lineHeight="28dp" | 37 | app:lineHeight="28dp" |
| 40 | tools:text="@string/frame_limit_enable" /> | 38 | tools:text="@string/frame_limit_enable" /> |
| 41 | 39 | ||
diff --git a/src/android/app/src/main/res/layout/list_item_settings_header.xml b/src/android/app/src/main/res/layout/list_item_settings_header.xml index cf85bc0da..21276b19e 100644 --- a/src/android/app/src/main/res/layout/list_item_settings_header.xml +++ b/src/android/app/src/main/res/layout/list_item_settings_header.xml | |||
| @@ -7,7 +7,8 @@ | |||
| 7 | android:layout_height="wrap_content" | 7 | android:layout_height="wrap_content" |
| 8 | android:layout_gravity="start|center_vertical" | 8 | android:layout_gravity="start|center_vertical" |
| 9 | android:paddingHorizontal="@dimen/spacing_large" | 9 | android:paddingHorizontal="@dimen/spacing_large" |
| 10 | android:paddingVertical="16dp" | 10 | android:paddingTop="16dp" |
| 11 | android:paddingBottom="8dp" | ||
| 11 | android:textAlignment="viewStart" | 12 | android:textAlignment="viewStart" |
| 12 | android:textColor="?attr/colorPrimary" | 13 | android:textColor="?attr/colorPrimary" |
| 13 | android:textStyle="bold" | 14 | android:textStyle="bold" |
diff --git a/src/android/app/src/main/res/values/arrays.xml b/src/android/app/src/main/res/values/arrays.xml index dc10159c9..51bcc49a3 100644 --- a/src/android/app/src/main/res/values/arrays.xml +++ b/src/android/app/src/main/res/values/arrays.xml | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | <resources> | 2 | <resources> |
| 3 | 3 | ||
| 4 | <string-array name="regionNames"> | 4 | <string-array name="regionNames"> |
| 5 | <item>@string/auto</item> | ||
| 6 | <item>@string/region_australia</item> | 5 | <item>@string/region_australia</item> |
| 7 | <item>@string/region_china</item> | 6 | <item>@string/region_china</item> |
| 8 | <item>@string/region_europe</item> | 7 | <item>@string/region_europe</item> |
| @@ -13,7 +12,6 @@ | |||
| 13 | </string-array> | 12 | </string-array> |
| 14 | 13 | ||
| 15 | <integer-array name="regionValues"> | 14 | <integer-array name="regionValues"> |
| 16 | <item>-1</item> | ||
| 17 | <item>3</item> | 15 | <item>3</item> |
| 18 | <item>4</item> | 16 | <item>4</item> |
| 19 | <item>2</item> | 17 | <item>2</item> |
diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index c551a6106..98c3f20f8 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml | |||
| @@ -240,6 +240,7 @@ | |||
| 240 | <string name="shutting_down">Shutting down…</string> | 240 | <string name="shutting_down">Shutting down…</string> |
| 241 | <string name="reset_setting_confirmation">Do you want to reset this setting back to its default value?</string> | 241 | <string name="reset_setting_confirmation">Do you want to reset this setting back to its default value?</string> |
| 242 | <string name="reset_to_default">Reset to default</string> | 242 | <string name="reset_to_default">Reset to default</string> |
| 243 | <string name="reset_to_default_description">Resets all advanced settings</string> | ||
| 243 | <string name="reset_all_settings">Reset all settings?</string> | 244 | <string name="reset_all_settings">Reset all settings?</string> |
| 244 | <string name="reset_all_settings_description">All advanced settings will be reset to their default configuration. This can not be undone.</string> | 245 | <string name="reset_all_settings_description">All advanced settings will be reset to their default configuration. This can not be undone.</string> |
| 245 | <string name="settings_reset">Settings reset</string> | 246 | <string name="settings_reset">Settings reset</string> |
| @@ -271,10 +272,14 @@ | |||
| 271 | <string name="preferences_settings">Settings</string> | 272 | <string name="preferences_settings">Settings</string> |
| 272 | <string name="preferences_general">General</string> | 273 | <string name="preferences_general">General</string> |
| 273 | <string name="preferences_system">System</string> | 274 | <string name="preferences_system">System</string> |
| 275 | <string name="preferences_system_description">Docked mode, region, language</string> | ||
| 274 | <string name="preferences_graphics">Graphics</string> | 276 | <string name="preferences_graphics">Graphics</string> |
| 277 | <string name="preferences_graphics_description">Accuracy level, resolution, shader cache</string> | ||
| 275 | <string name="preferences_audio">Audio</string> | 278 | <string name="preferences_audio">Audio</string> |
| 279 | <string name="preferences_audio_description">Output engine, volume</string> | ||
| 276 | <string name="preferences_theme">Theme and color</string> | 280 | <string name="preferences_theme">Theme and color</string> |
| 277 | <string name="preferences_debug">Debug</string> | 281 | <string name="preferences_debug">Debug</string> |
| 282 | <string name="preferences_debug_description">CPU/GPU debugging, graphics API, fastmem</string> | ||
| 278 | 283 | ||
| 279 | <!-- ROM loading errors --> | 284 | <!-- ROM loading errors --> |
| 280 | <string name="loader_error_encrypted">Your ROM is encrypted</string> | 285 | <string name="loader_error_encrypted">Your ROM is encrypted</string> |