Skip to content

Commit

Permalink
added hideCancel flag to FrameSaveErrorDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
mzorz committed Nov 4, 2020
1 parent 179b016 commit a1c5a80
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ class FrameSaveErrorDialog : DialogFragment() {
.setMessage(arguments?.getString(ARG_MESSAGE))

okListener?.let {
builder.setNegativeButton(android.R.string.cancel) { _, _ -> dismiss() }
val hideCancel = arguments?.getBoolean(ARG_HIDE_CANCEL) ?: false
if (!hideCancel) {
builder.setNegativeButton(android.R.string.cancel) { _, _ -> dismiss() }
}
builder.setPositiveButton(
arguments?.getString(ARG_OK_LABEL) ?: activity?.getString(android.R.string.ok)) {
_, _ -> okListener?.OnOkClicked(this)
Expand All @@ -33,18 +36,21 @@ class FrameSaveErrorDialog : DialogFragment() {
@JvmStatic private val ARG_MESSAGE = "message"
@JvmStatic private val ARG_TITLE = "title"
@JvmStatic private val ARG_OK_LABEL = "ok_label"
@JvmStatic private val ARG_HIDE_CANCEL = "hide_cancel"

@JvmStatic fun newInstance(
title: String,
message: String,
okButtonLabel: String? = null,
listener: FrameSaveErrorDialogOk? = null
listener: FrameSaveErrorDialogOk? = null,
hideCancelButton: Boolean = false
): FrameSaveErrorDialog =
FrameSaveErrorDialog().apply {
arguments = Bundle().apply {
putString(ARG_TITLE, title)
putString(ARG_MESSAGE, message)
putString(ARG_OK_LABEL, okButtonLabel)
putBoolean(ARG_HIDE_CANCEL, hideCancelButton)
}
okListener = listener
}
Expand Down

0 comments on commit a1c5a80

Please sign in to comment.