Merge pull request #13009 from t895/message-dialog-fix

android: Message dialog tweaks
This commit is contained in:
liamwhite 2024-02-13 14:46:56 -05:00 committed by GitHub
commit ad4ae39903
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 5 deletions

View file

@ -104,7 +104,10 @@ class AddonsFragment : Fragment() {
requireActivity(),
titleId = R.string.addon_notice,
descriptionId = R.string.addon_notice_description,
positiveAction = { addonViewModel.showModInstallPicker(true) }
dismissible = false,
positiveAction = { addonViewModel.showModInstallPicker(true) },
negativeAction = {},
negativeButtonTitleId = R.string.close
).show(parentFragmentManager, MessageDialogFragment.TAG)
addonViewModel.showModNoticeDialog(false)
}
@ -119,7 +122,8 @@ class AddonsFragment : Fragment() {
requireActivity(),
titleId = R.string.confirm_uninstall,
descriptionId = R.string.confirm_uninstall_description,
positiveAction = { addonViewModel.onDeleteAddon(it) }
positiveAction = { addonViewModel.onDeleteAddon(it) },
negativeAction = {}
).show(parentFragmentManager, MessageDialogFragment.TAG)
addonViewModel.setAddonToDelete(null)
}

View file

@ -42,9 +42,9 @@ class MessageDialogFragment : DialogFragment() {
} else if (positiveButtonString.isNotEmpty()) {
positiveButtonString
} else if (messageDialogViewModel.positiveAction != null) {
getString(R.string.close)
} else {
getString(android.R.string.ok)
} else {
getString(R.string.close)
}
val negativeButtonId = requireArguments().getInt(NEGATIVE_BUTTON_TITLE_ID)
@ -131,7 +131,7 @@ class MessageDialogFragment : DialogFragment() {
* @param positiveButtonTitleId String resource ID that will be used for the positive button.
* [positiveButtonTitleString] used if 0.
* @param positiveButtonTitleString String that will be used for the positive button.
* android.R.string.ok used if empty. android.R.string.close will be used if [positiveAction]
* android.R.string.close used if empty. android.R.string.ok will be used if [positiveAction]
* is not null.
* @param positiveAction Lambda to run when the positive button is clicked.
* @param showNegativeButton Normally the negative button isn't shown if there is no