0

I am trying to understand how the animations in the new NavigationUI works. I am utilising the NavigationAdvancedSample and added fragment animations to the actions in the form and list nav_graphs. The end result is this:

form.xml

<navigation
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/form"
app:startDestination="@id/register">

<fragment
        android:id="@+id/register"
        android:name="com.example.android.navigationadvancedsample.formscreen.Register"
        android:label="@string/title_register"
        tools:layout="@layout/fragment_register">
    <action
        android:id="@+id/action_register_to_registered"
        app:destination="@id/registered"
        app:enterAnim="@anim/enter_from_bottom"
        app:exitAnim="@anim/stay"
        app:popEnterAnim="@anim/stay"
        app:popExitAnim="@anim/exit_to_bottom"/>
</fragment>
<fragment
    android:id="@+id/registered"
    android:name="com.example.android.navigationadvancedsample.formscreen.Registered"
    android:label="Registered"
    tools:layout="@layout/fragment_registered"/>

list.xml

<navigation
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/list"
app:startDestination="@+id/leaderboard">

<fragment
        android:id="@+id/leaderboard"
        android:name="com.example.android.navigationadvancedsample.listscreen.Leaderboard"
        android:label="@string/title_list"
        tools:layout="@layout/fragment_leaderboard">
    <action
        android:id="@+id/action_leaderboard_to_userProfile"
        app:destination="@id/userProfile"
        app:enterAnim="@anim/enter_from_bottom"
        app:popExitAnim="@anim/exit_to_bottom"/>
</fragment>
<fragment
    android:id="@+id/userProfile"
    android:name="com.example.android.navigationadvancedsample.listscreen.UserProfile"
    android:label="@string/title_detail"
    tools:layout="@layout/fragment_user_profile">
    <deepLink
        android:id="@+id/deepLink"
        app:uri="www.example.com/user/{userName}"
        android:autoVerify="true"/>
    <argument
        android:name="userName"
        app:argType="string"/>
</fragment>

Now my question: When I navigate in both nav graphs using the above defined actions and then navigate back and forth in the bottomnavbar, it animates using the fragment animations defined in the actions rather than the default NavigationUI animations like defined in the NavigationUI.kt. Is this an intended behavior and if so, how can you circumvent that, because the animations feel really weird.

Note: The animations are simple translation files like here

Oliver Adam
  • 174
  • 12

0 Answers0