diff options
| author | 2023-04-29 01:47:13 -0400 | |
|---|---|---|
| committer | 2023-06-03 00:05:56 -0700 | |
| commit | 274b2be24fb37385bca799491a98c1f5f1b65a91 (patch) | |
| tree | 49e9f6e3556f53b8889072a62c8a6ad3444cadaf /src/android | |
| parent | android: Swap Default and Install buttons for GPU driver installation dialog (diff) | |
| download | yuzu-274b2be24fb37385bca799491a98c1f5f1b65a91.tar.gz yuzu-274b2be24fb37385bca799491a98c1f5f1b65a91.tar.xz yuzu-274b2be24fb37385bca799491a98c1f5f1b65a91.zip | |
android: Setup screen hotfix
Added help button link for add games warning and a check for whether a task was completed on a given screen.
Diffstat (limited to 'src/android')
3 files changed, 32 insertions, 12 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt index 57bef553a..2af78b02c 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt | |||
| @@ -28,6 +28,9 @@ import org.yuzu.yuzu_emu.features.settings.model.Settings | |||
| 28 | import org.yuzu.yuzu_emu.model.HomeViewModel | 28 | import org.yuzu.yuzu_emu.model.HomeViewModel |
| 29 | import org.yuzu.yuzu_emu.model.SetupPage | 29 | import org.yuzu.yuzu_emu.model.SetupPage |
| 30 | import org.yuzu.yuzu_emu.ui.main.MainActivity | 30 | import org.yuzu.yuzu_emu.ui.main.MainActivity |
| 31 | import org.yuzu.yuzu_emu.utils.DirectoryInitialization | ||
| 32 | import org.yuzu.yuzu_emu.utils.GameHelper | ||
| 33 | import java.io.File | ||
| 31 | 34 | ||
| 32 | class SetupFragment : Fragment() { | 35 | class SetupFragment : Fragment() { |
| 33 | private var _binding: FragmentSetupBinding? = null | 36 | private var _binding: FragmentSetupBinding? = null |
| @@ -101,7 +104,8 @@ class SetupFragment : Fragment() { | |||
| 101 | true, | 104 | true, |
| 102 | R.string.install_prod_keys_warning, | 105 | R.string.install_prod_keys_warning, |
| 103 | R.string.install_prod_keys_warning_description, | 106 | R.string.install_prod_keys_warning_description, |
| 104 | R.string.install_prod_keys_warning_help | 107 | R.string.install_prod_keys_warning_help, |
| 108 | { File(DirectoryInitialization.userDirectory + "/keys/prod.keys").exists() } | ||
| 105 | ), | 109 | ), |
| 106 | SetupPage( | 110 | SetupPage( |
| 107 | R.drawable.ic_controller, | 111 | R.drawable.ic_controller, |
| @@ -114,7 +118,12 @@ class SetupFragment : Fragment() { | |||
| 114 | true, | 118 | true, |
| 115 | R.string.add_games_warning, | 119 | R.string.add_games_warning, |
| 116 | R.string.add_games_warning_description, | 120 | R.string.add_games_warning_description, |
| 117 | 0 | 121 | R.string.add_games_warning_help, |
| 122 | { | ||
| 123 | val preferences = | ||
| 124 | PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext) | ||
| 125 | preferences.getString(GameHelper.KEY_GAME_PATH, "")!!.isNotEmpty() | ||
| 126 | } | ||
| 118 | ), | 127 | ), |
| 119 | SetupPage( | 128 | SetupPage( |
| 120 | R.drawable.ic_check, | 129 | R.drawable.ic_check, |
| @@ -158,16 +167,25 @@ class SetupFragment : Fragment() { | |||
| 158 | binding.buttonNext.setOnClickListener { | 167 | binding.buttonNext.setOnClickListener { |
| 159 | val index = binding.viewPager2.currentItem | 168 | val index = binding.viewPager2.currentItem |
| 160 | val currentPage = pages[index] | 169 | val currentPage = pages[index] |
| 161 | if (currentPage.hasWarning && !hasBeenWarned[index]) { | 170 | |
| 162 | SetupWarningDialogFragment.newInstance( | 171 | // Checks if the user has completed the task on the current page |
| 163 | currentPage.warningTitleId, | 172 | if (currentPage.hasWarning) { |
| 164 | currentPage.warningDescriptionId, | 173 | if (currentPage.taskCompleted.invoke()) { |
| 165 | currentPage.warningHelpLinkId, | 174 | pageForward() |
| 166 | index | 175 | return@setOnClickListener |
| 167 | ).show(childFragmentManager, SetupWarningDialogFragment.TAG) | 176 | } |
| 168 | } else { | 177 | |
| 169 | pageForward() | 178 | if (!hasBeenWarned[index]) { |
| 179 | SetupWarningDialogFragment.newInstance( | ||
| 180 | currentPage.warningTitleId, | ||
| 181 | currentPage.warningDescriptionId, | ||
| 182 | currentPage.warningHelpLinkId, | ||
| 183 | index | ||
| 184 | ).show(childFragmentManager, SetupWarningDialogFragment.TAG) | ||
| 185 | return@setOnClickListener | ||
| 186 | } | ||
| 170 | } | 187 | } |
| 188 | pageForward() | ||
| 171 | } | 189 | } |
| 172 | binding.buttonBack.setOnClickListener { pageBackward() } | 190 | binding.buttonBack.setOnClickListener { pageBackward() } |
| 173 | 191 | ||
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/SetupPage.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/SetupPage.kt index abe572a02..a0c878e1c 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/SetupPage.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/SetupPage.kt | |||
| @@ -14,5 +14,6 @@ data class SetupPage( | |||
| 14 | val hasWarning: Boolean, | 14 | val hasWarning: Boolean, |
| 15 | val warningTitleId: Int = 0, | 15 | val warningTitleId: Int = 0, |
| 16 | val warningDescriptionId: Int = 0, | 16 | val warningDescriptionId: Int = 0, |
| 17 | val warningHelpLinkId: Int = 0 | 17 | val warningHelpLinkId: Int = 0, |
| 18 | val taskCompleted: () -> Boolean = { true } | ||
| 18 | ) | 19 | ) |
diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index 6448a8d3f..5df65d084 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | <string name="add_games_description">Select your games folder</string> | 31 | <string name="add_games_description">Select your games folder</string> |
| 32 | <string name="add_games_warning">Skip selecting games folder?</string> | 32 | <string name="add_games_warning">Skip selecting games folder?</string> |
| 33 | <string name="add_games_warning_description">Games won\'t be displayed in the Games list if a folder isn\'t selected.</string> | 33 | <string name="add_games_warning_description">Games won\'t be displayed in the Games list if a folder isn\'t selected.</string> |
| 34 | <string name="add_games_warning_help">https://yuzu-emu.org/help/quickstart/#dumping-games</string> | ||
| 34 | <string name="home_search_games">Search Games</string> | 35 | <string name="home_search_games">Search Games</string> |
| 35 | <string name="games_dir_selected">Games directory selected</string> | 36 | <string name="games_dir_selected">Games directory selected</string> |
| 36 | <string name="install_prod_keys">Install Prod.keys</string> | 37 | <string name="install_prod_keys">Install Prod.keys</string> |