2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

android: Generalize string message dialog

This commit is contained in:
Abandoned Cart 2023-06-16 07:50:47 -04:00
parent 6c7e284f64
commit 1a85d8804a
2 changed files with 11 additions and 11 deletions

View file

@ -11,7 +11,7 @@ import androidx.fragment.app.DialogFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import org.yuzu.yuzu_emu.R import org.yuzu.yuzu_emu.R
class InstallDialogFragment : DialogFragment() { class LongMessageDialogFragment : DialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val titleId = requireArguments().getInt(TITLE) val titleId = requireArguments().getInt(TITLE)
val description = requireArguments().getString(DESCRIPTION) val description = requireArguments().getString(DESCRIPTION)
@ -37,7 +37,7 @@ class InstallDialogFragment : DialogFragment() {
} }
companion object { companion object {
const val TAG = "MessageDialogFragment" const val TAG = "LongMessageDialogFragment"
private const val TITLE = "Title" private const val TITLE = "Title"
private const val DESCRIPTION = "Description" private const val DESCRIPTION = "Description"
@ -47,8 +47,8 @@ class InstallDialogFragment : DialogFragment() {
titleId: Int, titleId: Int,
description: String, description: String,
helpLinkId: Int = 0 helpLinkId: Int = 0
): InstallDialogFragment { ): LongMessageDialogFragment {
val dialog = InstallDialogFragment() val dialog = LongMessageDialogFragment()
val bundle = Bundle() val bundle = Bundle()
bundle.apply { bundle.apply {
putInt(TITLE, titleId) putInt(TITLE, titleId)

View file

@ -43,7 +43,7 @@ import org.yuzu.yuzu_emu.features.settings.model.SettingsViewModel
import org.yuzu.yuzu_emu.features.settings.ui.SettingsActivity import org.yuzu.yuzu_emu.features.settings.ui.SettingsActivity
import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile
import org.yuzu.yuzu_emu.fragments.IndeterminateProgressDialogFragment import org.yuzu.yuzu_emu.fragments.IndeterminateProgressDialogFragment
import org.yuzu.yuzu_emu.fragments.InstallDialogFragment import org.yuzu.yuzu_emu.fragments.LongMessageDialogFragment
import org.yuzu.yuzu_emu.fragments.MessageDialogFragment import org.yuzu.yuzu_emu.fragments.MessageDialogFragment
import org.yuzu.yuzu_emu.model.GamesViewModel import org.yuzu.yuzu_emu.model.GamesViewModel
import org.yuzu.yuzu_emu.model.HomeViewModel import org.yuzu.yuzu_emu.model.HomeViewModel
@ -548,7 +548,7 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
installResult.append( installResult.append(
getString( getString(
R.string.install_game_content_failed_count, R.string.install_game_content_failed_count,
errorTotal
) )
) )
installResult.append(separator) installResult.append(separator)
@ -572,16 +572,16 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
) )
installResult.append(separator) installResult.append(separator)
} }
InstallDialogFragment.newInstance( LongMessageDialogFragment.newInstance(
R.string.install_game_content_failure, R.string.install_game_content_failure,
installResult.toString().trim(), installResult.toString().trim(),
R.string.install_game_content_help_link R.string.install_game_content_help_link
).show(supportFragmentManager, MessageDialogFragment.TAG) ).show(supportFragmentManager, LongMessageDialogFragment.TAG)
} else { } else {
InstallDialogFragment.newInstance( LongMessageDialogFragment.newInstance(
R.string.install_game_content_success, R.string.install_game_content_success,
installResult.toString().trim(), installResult.toString().trim()
).show(supportFragmentManager, MessageDialogFragment.TAG) ).show(supportFragmentManager, LongMessageDialogFragment.TAG)
} }
} }
} }