Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fragment transitions not working in jetpack Navigation framework

Transitions not working even after setting the enter, exit, popEnter and popExit transitions.

<fragment
    android:id="@+id/introFragment"
    android:name="IntroFragment"
    android:label="IntroFragment" >
    <action
        android:id="@+id/action_introFragment_to_signinFragment"
        app:destination="@id/signinFragment"
        app:enterAnim="@anim/slide_from_right"
        app:exitAnim="@anim/slide_to_left"
        app:popEnterAnim="@anim/slide_from_left"
        app:popExitAnim="@anim/slide_to_right"
        app:popUpTo="@+id/nav_graph" />
    <action
        android:id="@+id/action_introFragment_to_signupFragment"
        app:destination="@id/signupFragment"
        app:enterAnim="@anim/slide_from_right"
        app:exitAnim="@anim/slide_to_left"
        app:popEnterAnim="@anim/slide_from_left"
        app:popExitAnim="@anim/slide_to_right"
        app:popUpTo="@+id/nav_graph" />
</fragment>

I am using

def nav_version = "1.0.0-alpha05"
// Navigation Component - Jetpack
implementation "android.arch.navigation:navigation-fragment-ktx:$nav_version"
implementation "android.arch.navigation:navigation-ui-ktx:$nav_version"
androidTestImplementation "android.arch.navigation:navigation-testing-ktx:$nav_version"

My navigate code is

button.setOnClickListener(
            Navigation.createNavigateOnClickListener(R.id.signinFragment))

What am I missing?

like image 603
Kalyan Dechiraju Avatar asked Aug 12 '18 15:08

Kalyan Dechiraju


1 Answers

The issue is with my navigation code. I have to change my destination id to action id for my transitions to work!

button.setOnClickListener(Navigation.createNavigateOnClickListener(
                                  R.id.action_introFragment_to_signinFragment))

May be this is due to multiple actions on my destination.

like image 132
Kalyan Dechiraju Avatar answered Oct 22 '22 04:10

Kalyan Dechiraju