ncapdevi / FragNav

An Android library for managing multiple stacks of fragments
1.5k stars 220 forks source link

SharedElement Example #62

Closed andanicalik closed 5 years ago

andanicalik commented 7 years ago

Can you add example about use shared element ? I add shared element and transition to FragNavTransactionOptions but animation doesn't shown.

ncapdevi commented 7 years ago

Hey @andanicalik Can you show me the transactionOptions that you're building, how you're sending them in, and where you're trying to grab them?

Thanks

andanicalik commented 7 years ago

Hi. I added my code. Thank you for your interest @ncapdevi .

FragNavTransactionOptions options = FragNavTransactionOptions.newBuilder() .addSharedElement(new Pair<View, String>(viewHolder.imageViewExerciseCategory, "exerciseCategory")).transition(R.transition.exercise_category).build();

ExerciseSubCategoryFragment fragment = ExerciseSubCategoryFragment.newInstance(categoryId); mFragmentNavigation.pushFragment(fragment, options);

-> exercise_category.xml

`<transitionSet xmlns:android="http://schemas.android.com/apk/res/android" android:transitionOrdering="together">

<changeTransform />
<changeImageTransform />

`

ediazest commented 7 years ago

Hi @andanicalik, have you had any luck with this?

ncapdevi commented 7 years ago

What we really need is a PR for the sample app to have shared elements. If we can get that, it's easier to test.

Thomas-Vos commented 7 years ago

I have the same issue and can't get it to work. Could it be because this library uses add(...) instead of replace(...) for the fragment transaction?

ncapdevi commented 7 years ago

@Thomas-Vos Not entirely sure on that. I was under the impression that add(...)would work, but it's possible that it doesn't. What I really need is to have a solid sample app to test this out.