Android dialog with new motion system fade in

Viewed 284

I was going through the new material motion system page here and was specifically looking at the fade animation for dialog. Unfortunately I cannot seem to find any documentation on how to use it.

What I came up so far is something like this:

class MyDialogFragment() : DialogFragment() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        enterTransition = MaterialFade().apply { duration = 5_000 }
    }

    override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
        return MaterialAlertDialogBuilder(requireContext())
            .setTitle("Dialog title")
            .setMessage("Dialog message. Bla bla bla...")
            .setPositiveButton("oki") { _, _ ->
                Log.e("MyDialogFragment", "Positive button clicked")
            }
            .create()
    }
}

But this doesn't seem to change the transition at all. Any suggestions on how to get this to work or any links to related, updated documentation would be appreciated.

0 Answers
Related