I have MotionLayout
with Carousel
. I want to run some code, when user swipe and move to next slide.
To simplity - I have three slides, SLIDE 1, SLIDE 2, SLIDE3. I need to run some code (change other UI elements, make a toast, ...) when current item is changed. Is this possible?
I tried following:
((MotionLayout)v).setTransitionListener(new MotionLayout.TransitionListener() {
@Override
public void onTransitionStarted(MotionLayout motionLayout, int i, int i1) {}
@Override
public void onTransitionChange(MotionLayout motionLayout, int i, int i1, float v) {}
@Override
public void onTransitionCompleted(MotionLayout motionLayout, int i) {}
@Override
public void onTransitionTrigger(MotionLayout motionLayout, int i, boolean b, float v) {}
});
But in onTransitionCompleted, I can find current transition only (if user swiped forward or backward, not the current item).
Complete code is not necessary, I used first example of the official experiments repo. Thank you for your help.