mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-09-07 12:19:08 +01:00
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.
This commit is contained in:
parent
792ce5cb2f
commit
274b2be24f
3 changed files with 32 additions and 12 deletions
|
@ -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.HomeViewModel
|
||||||
import org.yuzu.yuzu_emu.model.SetupPage
|
import org.yuzu.yuzu_emu.model.SetupPage
|
||||||
import org.yuzu.yuzu_emu.ui.main.MainActivity
|
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() {
|
class SetupFragment : Fragment() {
|
||||||
private var _binding: FragmentSetupBinding? = null
|
private var _binding: FragmentSetupBinding? = null
|
||||||
|
@ -101,7 +104,8 @@ class SetupFragment : Fragment() {
|
||||||
true,
|
true,
|
||||||
R.string.install_prod_keys_warning,
|
R.string.install_prod_keys_warning,
|
||||||
R.string.install_prod_keys_warning_description,
|
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(
|
SetupPage(
|
||||||
R.drawable.ic_controller,
|
R.drawable.ic_controller,
|
||||||
|
@ -114,7 +118,12 @@ class SetupFragment : Fragment() {
|
||||||
true,
|
true,
|
||||||
R.string.add_games_warning,
|
R.string.add_games_warning,
|
||||||
R.string.add_games_warning_description,
|
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(
|
SetupPage(
|
||||||
R.drawable.ic_check,
|
R.drawable.ic_check,
|
||||||
|
@ -158,16 +167,25 @@ class SetupFragment : Fragment() {
|
||||||
binding.buttonNext.setOnClickListener {
|
binding.buttonNext.setOnClickListener {
|
||||||
val index = binding.viewPager2.currentItem
|
val index = binding.viewPager2.currentItem
|
||||||
val currentPage = pages[index]
|
val currentPage = pages[index]
|
||||||
if (currentPage.hasWarning && !hasBeenWarned[index]) {
|
|
||||||
SetupWarningDialogFragment.newInstance(
|
// Checks if the user has completed the task on the current page
|
||||||
currentPage.warningTitleId,
|
if (currentPage.hasWarning) {
|
||||||
currentPage.warningDescriptionId,
|
if (currentPage.taskCompleted.invoke()) {
|
||||||
currentPage.warningHelpLinkId,
|
pageForward()
|
||||||
index
|
return@setOnClickListener
|
||||||
).show(childFragmentManager, SetupWarningDialogFragment.TAG)
|
}
|
||||||
} else {
|
|
||||||
pageForward()
|
if (!hasBeenWarned[index]) {
|
||||||
|
SetupWarningDialogFragment.newInstance(
|
||||||
|
currentPage.warningTitleId,
|
||||||
|
currentPage.warningDescriptionId,
|
||||||
|
currentPage.warningHelpLinkId,
|
||||||
|
index
|
||||||
|
).show(childFragmentManager, SetupWarningDialogFragment.TAG)
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
pageForward()
|
||||||
}
|
}
|
||||||
binding.buttonBack.setOnClickListener { pageBackward() }
|
binding.buttonBack.setOnClickListener { pageBackward() }
|
||||||
|
|
||||||
|
|
|
@ -14,5 +14,6 @@ data class SetupPage(
|
||||||
val hasWarning: Boolean,
|
val hasWarning: Boolean,
|
||||||
val warningTitleId: Int = 0,
|
val warningTitleId: Int = 0,
|
||||||
val warningDescriptionId: Int = 0,
|
val warningDescriptionId: Int = 0,
|
||||||
val warningHelpLinkId: Int = 0
|
val warningHelpLinkId: Int = 0,
|
||||||
|
val taskCompleted: () -> Boolean = { true }
|
||||||
)
|
)
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
<string name="add_games_description">Select your games folder</string>
|
<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">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_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="home_search_games">Search Games</string>
|
||||||
<string name="games_dir_selected">Games directory selected</string>
|
<string name="games_dir_selected">Games directory selected</string>
|
||||||
<string name="install_prod_keys">Install Prod.keys</string>
|
<string name="install_prod_keys">Install Prod.keys</string>
|
||||||
|
|
Loading…
Reference in a new issue