Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When adding a RecyclerView as a child/grand-child to the MotionLayout, the Motion-Layout cannot progress across transitions. #255

Open
eddardsnarf opened this issue Apr 12, 2023 · 0 comments

Comments

@eddardsnarf
Copy link

Context:
I'm using a modified version of the fragment-transition example, in which we have a MotionLayout containing the TouchFrameLayout. Inside of it I've replaced the fragments in the example with the ListFragment.
Afterwards I've modified the main_scene.xml to have multiple transitions like:

MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:motion="http://schemas.android.com/apk/res-auto"
    android:id="@+id/motionLayout">
    <Transition
        android:id="@+id/transition_start_mid"
        motion:constraintSetEnd="@id/mid"
        motion:constraintSetStart="@id/start"
        motion:duration="500"
        motion:motionInterpolator="linear" >

        <OnSwipe
            motion:touchAnchorId="@id/container"
            motion:touchAnchorSide="top"
            motion:onTouchUp="decelerateAndComplete"
            motion:dragDirection="dragUp"
            />
    </Transition>

    <Transition
        android:id="@+id/transition_mid_end"
        motion:constraintSetEnd="@id/end"
        motion:constraintSetStart="@id/mid"
        motion:duration="500"
        motion:motionInterpolator="linear" >

        <OnSwipe
            motion:touchAnchorId="@id/container"
            motion:touchAnchorSide="top"
            motion:onTouchUp="decelerateAndComplete"
            motion:dragDirection="dragUp"/>
    </Transition>


    <ConstraintSet android:id="@+id/start">
        <Constraint
            android:id="@id/main"
            android:layout_width="0dp"
            android:layout_height="100dp"
            motion:layout_constraintStart_toStartOf="parent"
            motion:layout_constraintEnd_toEndOf="parent"
            motion:layout_constraintBottom_toBottomOf="parent">
            <CustomAttribute
                motion:attributeName="BackgroundColor"
                motion:customColorValue="@color/colorPrimary" />
        </Constraint>
    </ConstraintSet>

    <ConstraintSet android:id="@+id/mid">
        <Constraint
            android:id="@id/container"
            android:layout_width="0dp"
            android:layout_height="400dp"
            motion:layout_constraintStart_toStartOf="parent"
            motion:layout_constraintEnd_toEndOf="parent"
            motion:layout_constraintBottom_toBottomOf="parent">
            <CustomAttribute
                motion:attributeName="BackgroundColor"
                motion:customColorValue="@color/colorPrimary" />
        </Constraint>
    </ConstraintSet>

    <ConstraintSet android:id="@+id/end">
        <Constraint
            android:id="@id/container"
            android:layout_width="0dp"
            android:layout_height="0dp"
            motion:layout_constraintStart_toStartOf="parent"
            motion:layout_constraintEnd_toEndOf="parent"
            motion:layout_constraintTop_toTopOf="parent"
            motion:layout_constraintBottom_toBottomOf="parent">
            <CustomAttribute
                motion:attributeName="BackgroundColor"
                motion:customColorValue="@color/colorAccent" />
        </Constraint>
    </ConstraintSet>

</MotionScene>

The issue is that if the user tries to scroll the "bottom-sheet" up and down by using the recycler-view, the motionlayout won't progress from one transition to another. Thus making the whole interaction a bit unintuitive.

Is there some way to tell the MotionLayout to use the nested scrolling to progress across transitions?

I'll attach a video of my tests (Please ignore the sticky navy blue view at the bottom.).

Screen.Recording.2023-04-12.at.17.03.06.mov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant