Suppress SpreadOperator

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2023-10-31 09:54:23 +01:00
parent 08909091ea
commit 1095f78e2d
No known key found for this signature in database
GPG key ID: 4E577DC593B59BDF

View file

@ -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)