summaryrefslogtreecommitdiffstats
path: root/src/android/app
diff options
context:
space:
mode:
authorCharles Lombardo <clombardo169@gmail.com>2023-04-29 07:47:13 +0200
committerbunnei <bunneidev@gmail.com>2023-06-03 09:05:56 +0200
commit274b2be24fb37385bca799491a98c1f5f1b65a91 (patch)
tree49e9f6e3556f53b8889072a62c8a6ad3444cadaf /src/android/app
parentandroid: Swap Default and Install buttons for GPU driver installation dialog (diff)
downloadyuzu-274b2be24fb37385bca799491a98c1f5f1b65a91.tar
yuzu-274b2be24fb37385bca799491a98c1f5f1b65a91.tar.gz
yuzu-274b2be24fb37385bca799491a98c1f5f1b65a91.tar.bz2
yuzu-274b2be24fb37385bca799491a98c1f5f1b65a91.tar.lz
yuzu-274b2be24fb37385bca799491a98c1f5f1b65a91.tar.xz
yuzu-274b2be24fb37385bca799491a98c1f5f1b65a91.tar.zst
yuzu-274b2be24fb37385bca799491a98c1f5f1b65a91.zip
Diffstat (limited to 'src/android/app')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt40
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/model/SetupPage.kt3
-rw-r--r--src/android/app/src/main/res/values/strings.xml1
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
import org.yuzu.yuzu_emu.model.HomeViewModel
import org.yuzu.yuzu_emu.model.SetupPage
import org.yuzu.yuzu_emu.ui.main.MainActivity
+import org.yuzu.yuzu_emu.utils.DirectoryInitialization
+import org.yuzu.yuzu_emu.utils.GameHelper
+import java.io.File
class SetupFragment : Fragment() {
private var _binding: FragmentSetupBinding? = null
@@ -101,7 +104,8 @@ class SetupFragment : Fragment() {
true,
R.string.install_prod_keys_warning,
R.string.install_prod_keys_warning_description,
- R.string.install_prod_keys_warning_help
+ R.string.install_prod_keys_warning_help,
+ { File(DirectoryInitialization.userDirectory + "/keys/prod.keys").exists() }
),
SetupPage(
R.drawable.ic_controller,
@@ -114,7 +118,12 @@ class SetupFragment : Fragment() {
true,
R.string.add_games_warning,
R.string.add_games_warning_description,
- 0
+ R.string.add_games_warning_help,
+ {
+ val preferences =
+ PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext)
+ preferences.getString(GameHelper.KEY_GAME_PATH, "")!!.isNotEmpty()
+ }
),
SetupPage(
R.drawable.ic_check,
@@ -158,16 +167,25 @@ class SetupFragment : Fragment() {
binding.buttonNext.setOnClickListener {
val index = binding.viewPager2.currentItem
val currentPage = pages[index]
- if (currentPage.hasWarning && !hasBeenWarned[index]) {
- SetupWarningDialogFragment.newInstance(
- currentPage.warningTitleId,
- currentPage.warningDescriptionId,
- currentPage.warningHelpLinkId,
- index
- ).show(childFragmentManager, SetupWarningDialogFragment.TAG)
- } else {
- pageForward()
+
+ // Checks if the user has completed the task on the current page
+ if (currentPage.hasWarning) {
+ if (currentPage.taskCompleted.invoke()) {
+ pageForward()
+ return@setOnClickListener
+ }
+
+ if (!hasBeenWarned[index]) {
+ SetupWarningDialogFragment.newInstance(
+ currentPage.warningTitleId,
+ currentPage.warningDescriptionId,
+ currentPage.warningHelpLinkId,
+ index
+ ).show(childFragmentManager, SetupWarningDialogFragment.TAG)
+ return@setOnClickListener
+ }
}
+ pageForward()
}
binding.buttonBack.setOnClickListener { pageBackward() }
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(
val hasWarning: Boolean,
val warningTitleId: Int = 0,
val warningDescriptionId: Int = 0,
- val warningHelpLinkId: Int = 0
+ val warningHelpLinkId: Int = 0,
+ val taskCompleted: () -> Boolean = { true }
)
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 @@
<string name="add_games_description">Select your games folder</string>
<string name="add_games_warning">Skip selecting games folder?</string>
<string name="add_games_warning_description">Games won\'t be displayed in the Games list if a folder isn\'t selected.</string>
+ <string name="add_games_warning_help">https://yuzu-emu.org/help/quickstart/#dumping-games</string>
<string name="home_search_games">Search Games</string>
<string name="games_dir_selected">Games directory selected</string>
<string name="install_prod_keys">Install Prod.keys</string>