我有插入由云功能发布的PostKey和Rating的数据。跟随此图片newfeedpost

我使用FirebaseIndexRecyclerAdapter来获取数据

FirebaseIndexRecyclerAdapter<Post, FeedFragment.PostViewHolder> firebaseIndexRecyclerAdapter = new FirebaseIndexRecyclerAdapter<Post, FeedFragment.PostViewHolder>(
            Post.class,
            R.layout.post_row,
            FeedFragment.PostViewHolder.class,
            FirebaseRef.mNewfeedRef.child(UID),
            FirebaseRef.mPostRef
    ) {


我认为的解决方案是


第一个是orderByValue()并在滚动到底部时将StartAt(0)加载到EndAt(5),将其称为StartAt(0)到EndAt(10),依此类推,但是每次都会加载可能浪费流量的旧数据。
第二个是创建新参考,假设是“ newfeed-post”,其中只有排名靠前的5个项目是从“ newfeed”获得的,当我向下滚动以加载更多内容时,我向云函数请求让云函数从中插入更多5个项目从“ newfeed”到“ newfeed-post”,即降低评级(例如位置6-10)。


请帮助,让我知道如何执行此操作。感谢:D

最佳答案

FirebaseUI-Android组件不支持分页。他们目前需要您提供一个查询,以产生所有要显示的结果。滚动列表时,无法逐步提供更多查询。另请参见discussion in this issue on the Github repo for FirebaseUI-Android

10-08 06:20