android-paging

Dagger2: Using CompositeDisposable with Android Paging Library

。_饼干妹妹 提交于 2021-02-11 14:18:04
问题 I'm using Dagger2. I will be injecting CompositeDisposable in ViewModel through @Inject constructor(private val compositeDisposable: CompositeDisposable) And my screen would also be using Android Pagination library and inside PageKeyedDataSource class I would be adding every network call into compositeDisposable using it's .add(diposable) . I also would be adding CompositeDisposable in PageKeyedDataSource constructor through Dagger graph. Is there any way that CompositeDisposable in ViewModel

How to use pagination to Firestore Query using timestamp

你。 提交于 2021-02-11 12:20:10
问题 I wanted to query firestore database with the timestamp recently posted For ex: I have collection of posts Indexed with timestamp ascending and descending order when the user opens the feed it will show the today's date(timestamp Today Descending ) Posts. when the user scrolls it fetches next 3 ids and so on and ends with last item of today.But without ending with last item post of today I wanted to show the next day posts and so on for last seven days so the recycler view will be endless

Android Pagination Library wont stop loading items in recyclerview

℡╲_俬逩灬. 提交于 2021-02-10 15:15:36
问题 I am using Android Pagination Library... It's working in a weird way - Items keep loading infinitely, there is no stop even when there are no more data to load. For example, I have 2 Items to load, instead of loading just the 2 items and stop loading, It keeps loading the 2 items repeatedly... Here is a gif of what I am facing. First here is my repository CommentDataSource.java Note - when I change the value of " PAGE_SIZE " to " 1 ", It seems to work but the whole purpose of the pagination

Android Pagination Library wont stop loading items in recyclerview

不打扰是莪最后的温柔 提交于 2021-02-10 15:14:30
问题 I am using Android Pagination Library... It's working in a weird way - Items keep loading infinitely, there is no stop even when there are no more data to load. For example, I have 2 Items to load, instead of loading just the 2 items and stop loading, It keeps loading the 2 items repeatedly... Here is a gif of what I am facing. First here is my repository CommentDataSource.java Note - when I change the value of " PAGE_SIZE " to " 1 ", It seems to work but the whole purpose of the pagination

Android Paging 3 library: how to change list with new param?

元气小坏坏 提交于 2021-01-29 12:36:35
问题 I have a search fragment that shows list of searched items. if user type something, I pass that string to url as new query parameter and get new list using paging 3 library. first solution is: //viewModel lateinit var postListUrl: String val postList: Flow<PagingData<Post>> = Pager(PagingConfig(pageSize = 20)) { PostPagingSource(postRepository, postListUrl) }.flow.cachedIn(viewModelScope) //fragment fun showPostList(url: String) { postListAdapter.submitData(lifecycle, PagingData.empty())

What does the initialKey parameter do in the Pager constructor

﹥>﹥吖頭↗ 提交于 2021-01-29 12:22:09
问题 I am trying to understand what the initialKey does in the Pager constructor, but I cannot find any sort of explanation, not even in the official documentation: https://developer.android.com/reference/kotlin/androidx/paging/Pager#%3Cinit%3E(androidx.paging.PagingConfig,%20androidx.paging.Pager.Key,%20androidx.paging.RemoteMediator,%20kotlin.Function0) Can anyone explain what it does or how it works and how to use it? 回答1: After testing I believe the initialKey param is meant to indicate a

how to use paging when recyclerview item have another recyclerview

自古美人都是妖i 提交于 2021-01-29 10:54:11
问题 i have a recyclerview item ,it contains an another recyclerview to show image list: <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.RecyclerView android:id="@+id/imageRv" android:layout_width="0dp" android:layout_height="wrap_content" /> if i use paging in ViewHolder,i have to invoke like this class GankViewHolder(parent: View) :

Android Paging 3 library: how to change list with new param?

こ雲淡風輕ζ 提交于 2021-01-29 10:49:29
问题 I have a search fragment that shows list of searched items. if user type something, I pass that string to url as new query parameter and get new list using paging 3 library. first solution is: //viewModel lateinit var postListUrl: String val postList: Flow<PagingData<Post>> = Pager(PagingConfig(pageSize = 20)) { PostPagingSource(postRepository, postListUrl) }.flow.cachedIn(viewModelScope) //fragment fun showPostList(url: String) { postListAdapter.submitData(lifecycle, PagingData.empty())

Use PagedListAdapter inside NestedScrollView

本小妞迷上赌 提交于 2021-01-27 04:07:09
问题 I have a RecyclerView that has a PagedListAdapter . When I put the RecyclerView inside NestedScrollView the PagedList cannot compute the end of the list so start requests continuous burst for new data. The main question is How should I use PagedListAdapter inside NestedScrollView ? 回答1: I had a similar problem, and it seems to be caused by the fact that NestedScrollView provides infinite dimensions and so RecyclerView will layout all its children. so I looked on github and found an

Use PagedListAdapter inside NestedScrollView

你说的曾经没有我的故事 提交于 2021-01-27 04:07:08
问题 I have a RecyclerView that has a PagedListAdapter . When I put the RecyclerView inside NestedScrollView the PagedList cannot compute the end of the list so start requests continuous burst for new data. The main question is How should I use PagedListAdapter inside NestedScrollView ? 回答1: I had a similar problem, and it seems to be caused by the fact that NestedScrollView provides infinite dimensions and so RecyclerView will layout all its children. so I looked on github and found an