Skip to content

Instantly share code, notes, and snippets.

@Audhil
Last active April 17, 2018 13:29
Show Gist options
  • Save Audhil/32ddc0c07dfc1cc8c9585079578644c6 to your computer and use it in GitHub Desktop.
Save Audhil/32ddc0c07dfc1cc8c9585079578644c6 to your computer and use it in GitHub Desktop.
AlertDialogs with Extn funcs blog_5
class SomeFragment : Fragment() {
private var notesDialog: AlertDialog? = null
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
showDialog()
}
// showing dialog
fun showDialog() {
if (notesDialog == null)
////////////////////////////////////////////////////////////////
// making Alert dialog - admire beauty of kotlin
////////////////////////////////////////////////////////////////
notesDialog = showNotesAlertDialog {
cancelable = false
closeIconClickListener {
showVLog("Notes Dialog close icon clicked")
}
doneIconClickListener {
showVLog("Notes Dialog done icon clicked")
}
}
// and showing
notesDialog?.show()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment