Created
April 21, 2019 02:46
-
-
Save enginebai/f2043f1f1839f0dae01922afef0a3452 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface PostRepository { | |
fun getFeeds(): Observable<PagedList<Post>> | |
} | |
class PostRepositoryImpl : PostRepository { | |
override fun getFeeds(): Observable<PagedList<Post>> { | |
val dataSource = PostPagingDataSourceFactory() | |
val pagedListConfig = PagedList.Config.Builder() | |
.setPageSize(10) | |
.setPrefetchDistance(4) | |
.build() | |
return RxPagedListBuilder(dataSource, pagedListConfig) | |
.setFetchScheduler(Schedulers.io()) | |
.setNotifyScheduler(AndroidSchedulers.mainThread()) | |
.buildObservable() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment