My parent view is a Motion Layout. In it I have a ViewPager which has 2 pages. Each page has a vertical recycler view.
My desired effect is for a textView, which is a child of this motion layout, to change its color on page swipe (and to do it smoothly).
PROBLEM: Nothing happens on swipe. Just a regular ViewPager swipe
Here is my transition:
<Transition
app:constraintSetEnd="@id/end"
app:constraintSetStart="@id/start">
<OnSwipe
app:dragDirection="dragLeft"
app:touchAnchorSide="right"
app:touchAnchorId="@id/news_viewPager"/>
</Transition>
I've set a listener on the Motion Layout motionlayout.addTransitionListener() and I'm debugging in its four methods (such as onTransitionChange()) to see if the animation is set off, but it doesn't even starts.
I've tried adding touchRegionId, disableScroll & disablePostScroll but I'm out of ideas.
Could someone please explain to me why it is not working, and a solution to it (or at least an alternative)? Thank you.
Just in case, here's my full scene xml:
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ConstraintSet android:id="@+id/start">
<Constraint android:id="@id/new_videos_title">
<CustomAttribute
app:attributeName="textColor"
app:customColorValue="@color/navBarOn" />
</Constraint>
<Constraint android:id="@id/news_viewPager" />
<Constraint android:id="@id/new_articles_title">
<CustomAttribute
app:attributeName="textColor"
app:customColorValue="@color/navBarOff" />
</Constraint>
</ConstraintSet>
<ConstraintSet android:id="@+id/end">
<Constraint android:id="@id/news_viewPager" />
<Constraint android:id="@id/new_videos_title">
<CustomAttribute
app:attributeName="textColor"
app:customColorValue="@color/navBarOff" />
</Constraint>
<Constraint android:id="@id/new_articles_title">
<CustomAttribute
app:attributeName="textColor"
app:customColorValue="@color/navBarOn" />
</Constraint>
</ConstraintSet>
<Transition
app:constraintSetEnd="@id/end"
app:constraintSetStart="@id/start">
<OnSwipe
app:dragDirection="dragLeft"
app:touchAnchorSide="right"
app:touchAnchorId="@id/news_viewPager"/>
</Transition>