The animation when I am going from a fragment to an activity is working fine but when I click back it returns without the custom animation I insert. The same if I make the navigation from a fragment to another with the same animations works fine. Here is the action code I am using:
<action
android:id="@+id/toTicker"
app:destination="@id/tickerActivity"
app:enterAnim="@anim/slide_bottom_up"
app:exitAnim="@anim/slide_up_bottom"
app:popEnterAnim="@anim/slide_bottom_up"
app:popExitAnim="@anim/slide_up_bottom"/>
As per this issue, you need to call the static ActivityNavigator.applyPopAnimationsToPendingTransition()
method in your other activity to get the pop animations to apply - it should be called directly following when you call finish()
or as part of callbacks to onBackPressed()
(which internally will call finish()
):
override fun onBackPressed() {
super.onBackPressed()
ActivityNavigator.applyPopAnimationsToPendingTransition(this)
}
Updating the documentation to specifically call this out is being tracked in this documentation issue.