mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 07:05:49 +03:00
Suppress SpreadOperator
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
08909091ea
commit
1095f78e2d
1 changed files with 3 additions and 10 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue