Passing RecyclerView touch to MotionLayout not working

Viewed 846

I have layout like below on the picture. For animation I am using MotionLayout. When user touches Search, I animate scrolling view up, so Search becomes top most view. Under the search. I have list of items in RecyclerView. I want to revert scrolling up, by scrolling list items down. But I couldn't find the way to do this. I can't get touch event from Recyclerview.

enter image description here

Here is my layout code:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.motion.widget.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/manage_wallets"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:showPaths="true"
    app:layoutDescription="@xml/manage_wallets_fragment_scene">

    <com.example.views.ShadowlessToolbarView
        android:id="@+id/customToolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <com.example.views.CoinSearchView
        android:id="@+id/searchView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:layout_marginStart="16dp"
        android:layout_marginEnd="16dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/customToolbar" />

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginTop="12dp"
        android:clipToPadding="false"
        android:paddingBottom="32dp"
        android:nestedScrollingEnabled="false"
        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/searchView"
        tools:itemCount="4"
        tools:listitem="@layout/view_holder_item" />

</androidx.constraintlayout.motion.widget.MotionLayout>

Here is my scene code:

<ConstraintSet android:id="@+id/start">
    <Constraint android:id="@+id/customToolbar" />
</ConstraintSet>

<ConstraintSet android:id="@+id/end">
    <Constraint android:id="@+id/customToolbar"
        android:layout_height="0dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        android:layout_width="match_parent"
        app:layout_constraintBottom_toTopOf="parent" />
</ConstraintSet>

<Transition
    app:constraintSetEnd="@+id/end"
    app:constraintSetStart="@+id/start" >
    <OnClick
        app:targetId="@+id/searchView"
        app:clickAction="transitionToEnd"/>
</Transition>
<Transition
    app:constraintSetStart="@+id/start"
    app:constraintSetEnd="@+id/end" >
    <OnSwipe
        motion:touchAnchorId="@+id/recyclerView"
        motion:touchAnchorSide="top"
        motion:dragDirection="dragDown" />
</Transition>
0 Answers
Related