@@ -12,7 +12,9 @@ import com.google.android.material.snackbar.Snackbar
12
12
import com.woocommerce.android.R.string
13
13
import com.woocommerce.android.model.UiString
14
14
import com.woocommerce.android.support.help.HelpOrigin
15
+ import com.woocommerce.android.ui.dialog.DialogParams
15
16
import com.woocommerce.android.ui.dialog.WooDialog
17
+ import com.woocommerce.android.ui.dialog.WooDialogFragment
16
18
import com.woocommerce.android.viewmodel.MultiLiveEvent.Event
17
19
import java.util.concurrent.atomic.AtomicBoolean
18
20
@@ -129,6 +131,33 @@ open class MultiLiveEvent<T : Event> : MutableLiveData<T>() {
129
131
130
132
data class LaunchUrlInChromeTab (val url : String ) : Event()
131
133
134
+ data class ShowDialogFragment (
135
+ @StringRes val titleId : Int? = null ,
136
+ @StringRes val messageId : Int? = null ,
137
+ @StringRes val positiveButtonId : Int? = null ,
138
+ @StringRes val negativeButtonId : Int? = null ,
139
+ @StringRes val neutralButtonId : Int? = null ,
140
+ val positiveActionName : String? = null ,
141
+ val negativeActionName : String? = null ,
142
+ val neutralActionName : String? = null ,
143
+ val cancelable : Boolean = true
144
+ ) : Event() {
145
+ fun showIn (fragmentManager : androidx.fragment.app.FragmentManager , listener : WooDialogFragment .DialogInteractionListener ) {
146
+ val dialogParams = DialogParams (
147
+ titleId = titleId,
148
+ messageId = messageId,
149
+ positiveButtonId = positiveButtonId,
150
+ negativeButtonId = negativeButtonId,
151
+ neutralButtonId = neutralButtonId,
152
+ cancelable = cancelable
153
+ )
154
+ val dialogFragment = WooDialogFragment .newInstance(dialogParams).apply {
155
+ setDialogInteractionListener(listener)
156
+ }
157
+ dialogFragment.show(fragmentManager, WooDialogFragment .TAG )
158
+ }
159
+ }
160
+
132
161
data class ShowDialog (
133
162
@StringRes val titleId : Int? = null ,
134
163
@StringRes val messageId : Int? = null ,
0 commit comments