I have a DialogFragment with this code in order to animate when it exits:
override fun dismiss() {
dismissListener?.invoke()
exitAnimation?.let {
val animation = AnimationUtils.loadAnimation(requireContext(), it)
animation.setAnimationListener(object : AnimationAdapter {
override fun onAnimationEnd(animation: Animation?) {
callDismiss()
}
})
view?.startAnimation(animation)
} ?: callDismiss()
}
private fun callDismiss() {
super.dismiss()
}
exitAnimation defaults to a slide out animation.
However I noticed that it won't always show the back fragment, I have certain path of screens where no matter what I do, it seems to always shows a background white screen when animating instead of the backward fragment.
I don't know if this is because I have something like:
A B C D, where D is the DialogFragment, but A B C are part of a NavigationController / NavigatorFragment and D is not part of the navigation graph and is started from a FragmentTranscation from C's parentFragmentManager
I have tested in several ways, like sending the activity's supportFragmentManager but it seems that white screen is always visible.
I want the background fragment to be visible as when using the same fragmentmanager.
Ok I just needed to make DialogFragment window transparent background.