|
@@ -64,29 +64,22 @@ open class ConfirmationDialogFragment : DialogFragment(), Injectable {
|
|
|
}
|
|
|
|
|
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
|
|
- var messageArguments = requireArguments().getStringArray(ARG_MESSAGE_ARGUMENTS)
|
|
|
+ val messageArguments = requireArguments().getStringArray(ARG_MESSAGE_ARGUMENTS) ?: arrayOf<String>()
|
|
|
val titleId = requireArguments().getInt(ARG_TITLE_ID, -1)
|
|
|
val messageId = requireArguments().getInt(ARG_MESSAGE_RESOURCE_ID, -1)
|
|
|
val positiveButtonTextId = requireArguments().getInt(ARG_POSITIVE_BTN_RES, -1)
|
|
|
val negativeButtonTextId = requireArguments().getInt(ARG_NEGATIVE_BTN_RES, -1)
|
|
|
val neutralButtonTextId = requireArguments().getInt(ARG_NEUTRAL_BTN_RES, -1)
|
|
|
|
|
|
- if (messageArguments == null) {
|
|
|
- messageArguments = arrayOf<String>()
|
|
|
- }
|
|
|
-
|
|
|
+ @Suppress("SpreadOperator")
|
|
|
val message = getString(messageId, *messageArguments)
|
|
|
|
|
|
val builder = MaterialAlertDialogBuilder(requireActivity())
|
|
|
+ .setTitle(if (titleId == 0) { R.string.dialog_alert_title } else { titleId })
|
|
|
.setIcon(com.owncloud.android.R.drawable.ic_warning)
|
|
|
.setIconAttribute(R.attr.alertDialogIcon)
|
|
|
.setMessage(message)
|
|
|
|
|
|
- if (titleId == 0) {
|
|
|
- builder.setTitle(R.string.dialog_alert_title)
|
|
|
- } else if (titleId != -1) {
|
|
|
- builder.setTitle(titleId)
|
|
|
- }
|
|
|
if (positiveButtonTextId != -1) {
|
|
|
builder.setPositiveButton(positiveButtonTextId) { dialog: DialogInterface, _: Int ->
|
|
|
mListener?.onConfirmation(tag)
|