GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: update README and concatMap · alanwgeorge/Android-RxJava@6fd11b4

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • README.md
  • app/src/main/java/com/morihacky/android/rxjava/pagination
    • PaginationFragment.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎README.md‎

Copy file name to clipboardExpand all lines: README.md
+9-5Lines changed: 9 additions & 5 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,20 @@ Hit the start button and rotate the screen to your heart's content; you'll see t
162162

163163
*There are certain quirks about the "hotness" of the source observable used in this example. Check [my blog post](http://blog.kaush.co/2015/07/11/a-note-about-the-warmth-share-operator/) out where I explain the specifics.*
164164

165-
## Work in Progress:
165+
### Pagination
166166

167-
Examples that I would like to have here, but haven't found the time yet to flush out.
167+
I leverage the simple use of a Subject here. Honestly, if you don't have your items coming down via an `Observable` already (like through Retrofit or a network request), there's no good reason to use Rx and complicate things.
168168

169+
This example basically sends the page number to a Subject, and the subject handles adding the items. Notice the use of `concatMap` and the return of an `Observable<List>` from `_itemsFromNetworkCall`.
169170

170-
### Pagination
171+
Here are some other fancy implementations (while i enjoyed reading them, i didn't land up using them for my real world app cause personally i don't think it's necessary):
171172

172-
a. Simple pagination
173-
b. Optimized pagination
173+
* [Matthias example of an Rx based pager](https://gist.github.com/mttkay/24881a0ce986f6ec4b4d)
174+
* [Recursive Paging example](http://stackoverflow.com/questions/28047272/handle-paging-with-rxjava)
174175

176+
## Work in Progress:
177+
178+
Examples that I would like to have here, but haven't found the time yet to flush out.
175179

176180
## Contributing:
177181

Collapse file

‎app/src/main/java/com/morihacky/android/rxjava/pagination/PaginationFragment.java‎

Copy file name to clipboardExpand all lines: app/src/main/java/com/morihacky/android/rxjava/pagination/PaginationFragment.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void onStart() {
6161

6262
Subscription s2 =//
6363
_paginator//
64-
.flatMap(nextPage -> _itemsFromNetworkCall(nextPage + 1, 10))//
64+
.concatMap(nextPage -> _itemsFromNetworkCall(nextPage + 1, 10))//
6565
.observeOn(AndroidSchedulers.mainThread())
6666
.map(items -> {
6767
int start = _adapter.getItemCount() - 1;

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.