Skip to content

Instantly share code, notes, and snippets.

@k0siara
Created November 5, 2022 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k0siara/36426d425bb51fa9eb118c12e5c0dcc5 to your computer and use it in GitHub Desktop.
Save k0siara/36426d425bb51fa9eb118c12e5c0dcc5 to your computer and use it in GitHub Desktop.
ActivityHandling3Dialogs.kt
class MainActivity : FragmentActivity(),
NoticeDialogFragment.NoticeDialogListener,
SecondDialogFragment.Listener,
ThirdDialogFragment.Listener {
private val viewModel by ...
fun showNoticeDialog() {
val dialog = NoticeDialogFragment()
dialog.show(supportFragmentManager, "NoticeDialogFragment")
}
fun showSecondDialog() { ... }
fun showThirdDialog() { ... }
override fun onDialogPositiveClick(dialog: DialogFragment) {
viewModel.onNoticePositiveClicked()
}
override fun onDialogNegativeClick(dialog: DialogFragment) {
viewModel.onNoticeNegativeClicked()
}
override fun onSecondDialogItemSelected(item: Item) {
viewModel.onItemSelected(item)
}
override fun onSecondDialogCancelled() {
viewModel.onItemSelectionCancelled()
}
override fun onThirdDialogButtonClicked() {
viewModel.onStartSomething()
}
override fun onThirdDialogFilterChanged(filter: Filter) {
viewModel.onFilterChanged(filter)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment