Метод loadAfter библиотеки подкачки называется бесконечным во вложенном RecyclerView - PullRequest
0 голосов
/ 11 июня 2019

У меня есть RecyclerView (ParentRV), который отображает список элементов.Каждый дочерний элемент (ViewHolder) представляет собой RecyclerView (ChildRV), который отображает список элементов.

Затем я реализую библиотеку подкачки для загрузки данных для ChildRV.Проблема в том, что DataSource библиотеки подкачки продолжает бесконечно вызывать метод loadAfter () после того, как я обновляю результат, возвращенный из метода loadInitial (), в PagedListAdapter.

Пожалуйста, помогите!Вот макеты для ParentRV и ChildRV.

parent_layout.xml

<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/white">

        <com.google.android.material.appbar.AppBarLayout
            android:id="@+id/appBar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:fitsSystemWindows="true">

                // ....

        </com.google.android.material.appbar.AppBarLayout>


        <com.example.ecommerce.presentation.widget.RefreshLayout
            android:id="@+id/refreshLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">


            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/sectionList"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:clipToPadding="false" />


        </com.example.ecommerce.presentation.widget.RefreshLayout>


    </androidx.coordinatorlayout.widget.CoordinatorLayout>

</layout>

child_layout.xml

<layout xmlns:android="http://schemas.android.com/apk/res/android">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/productList"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

    </FrameLayout>
</layout>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...