android: Generalize string message dialog
This commit is contained in:
parent
6c7e284f64
commit
1a85d8804a
|
@ -11,7 +11,7 @@ import androidx.fragment.app.DialogFragment
|
|||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import org.yuzu.yuzu_emu.R
|
||||
|
||||
class InstallDialogFragment : DialogFragment() {
|
||||
class LongMessageDialogFragment : DialogFragment() {
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val titleId = requireArguments().getInt(TITLE)
|
||||
val description = requireArguments().getString(DESCRIPTION)
|
||||
|
@ -37,7 +37,7 @@ class InstallDialogFragment : DialogFragment() {
|
|||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "MessageDialogFragment"
|
||||
const val TAG = "LongMessageDialogFragment"
|
||||
|
||||
private const val TITLE = "Title"
|
||||
private const val DESCRIPTION = "Description"
|
||||
|
@ -47,8 +47,8 @@ class InstallDialogFragment : DialogFragment() {
|
|||
titleId: Int,
|
||||
description: String,
|
||||
helpLinkId: Int = 0
|
||||
): InstallDialogFragment {
|
||||
val dialog = InstallDialogFragment()
|
||||
): LongMessageDialogFragment {
|
||||
val dialog = LongMessageDialogFragment()
|
||||
val bundle = Bundle()
|
||||
bundle.apply {
|
||||
putInt(TITLE, titleId)
|
|
@ -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.utils.SettingsFile
|
||||
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.model.GamesViewModel
|
||||
import org.yuzu.yuzu_emu.model.HomeViewModel
|
||||
|
@ -548,7 +548,7 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
|||
installResult.append(
|
||||
getString(
|
||||
R.string.install_game_content_failed_count,
|
||||
|
||||
errorTotal
|
||||
)
|
||||
)
|
||||
installResult.append(separator)
|
||||
|
@ -572,16 +572,16 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
|||
)
|
||||
installResult.append(separator)
|
||||
}
|
||||
InstallDialogFragment.newInstance(
|
||||
LongMessageDialogFragment.newInstance(
|
||||
R.string.install_game_content_failure,
|
||||
installResult.toString().trim(),
|
||||
R.string.install_game_content_help_link
|
||||
).show(supportFragmentManager, MessageDialogFragment.TAG)
|
||||
).show(supportFragmentManager, LongMessageDialogFragment.TAG)
|
||||
} else {
|
||||
InstallDialogFragment.newInstance(
|
||||
LongMessageDialogFragment.newInstance(
|
||||
R.string.install_game_content_success,
|
||||
installResult.toString().trim(),
|
||||
).show(supportFragmentManager, MessageDialogFragment.TAG)
|
||||
installResult.toString().trim()
|
||||
).show(supportFragmentManager, LongMessageDialogFragment.TAG)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue