| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9159200 commit b2b51f0
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,31 +16,51 @@ The long operation is simulated by a blocking Thread.sleep call. But since it's | |||
| 16 | 16 | To really see this shine. Hit the button multiple times and see how the button click which is a ui operation is never blocked because the long operation only runs in the background | |
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | - ### 2. Accumulate calls using buffer (wip) | ||
| 19 | + ### 2. Accumulate calls using buffer | ||
| 20 | 20 | ||
| 21 | 21 | This is a demo of how events can be accumulated using the "buffer" operation. | |
| 22 | 22 | ||
| 23 | 23 | A button is provided and we accumulate the number of clicks on that button, over a span of time and then spit out the final results. | |
| 24 | 24 | ||
| 25 | 25 | If you hit the button once. you'll get message saying the button was hit once. If you hit it 5 times continuosly within a span of 2 seconds, then you get a single log, saying you hit that button 5 times (vs 5 individual logs saying Button hit once). | |
| 26 | 26 | ||
| 27 | + Two implementations: | ||
| 28 | + | ||
| 29 | + 2a. Using a traditional observable - but encompassing the OnClick within the observable | ||
| 30 | + 2b. Using PublishSubject and sending single clicks to the Observable, which inturn then sends it to the Observer | ||
| 31 | + | ||
| 32 | + | ||
| 27 | 33 | ### 3. Instant/Auto searching (using a subject and debounce) | |
| 28 | 34 | ||
| 29 | 35 | This is a demo of how events can be swallowed in a way that only the last one is respected. A typical example of this is instant search result boxes. As you type the word "Bruce Lee", you don't want to execute searches for B, Br, Bru, Bruce, Bruce , Bruce L ... etc. But rather intelligently wait for a couple of moments, make sure the user has finished typing the whole word, and then shoot out a single call for "Bruce Lee". | |
| 30 | 36 | ||
| 31 | 37 | As you type in the input box, it will not shoot out log messages at every single input character change, but rather only pick the lastly emitted event (i.e. input) and log that. \n\nThis is the debounce/throttleWithTimeout method in RxJava. | |
| 32 | 38 | ||
| 33 | - ### 4. Working examples of github from JakeWharton's Retrofit preso at Netflix (wip) | ||
| 34 | 39 | ||
| 35 | - https://www.youtube.com/watch?v=aEuNBk1b5OE#t=2480 | ||
| 36 | - https://speakerdeck.com/jakewharton/2014-1 | ||
| 40 | + ### 4. Orchestrating Observables (flatmap + zip) (wip) | ||
| 41 | + | ||
| 42 | + If actions A and B depend on action X running; and action C depends on action Y running. What if you want to combine the result of all those calls and have a single output? | ||
| 43 | + | ||
| 44 | + ____________ A ________________ | ||
| 45 | + (flatmap) / | (zip) | ||
| 46 | + X ------------/_____________ B ________________| ----------- > Ouput | ||
| 47 | + | | ||
| 48 | + Y ------------------------- C ________________| | ||
| 49 | + | ||
| 37 | 50 | ||
| 38 | 51 | ||
| 39 | 52 | ### 5. Pagination (zip) (wip) | |
| 40 | 53 | ||
| 41 | 54 | a. Simple pagination | |
| 42 | 55 | b. Optimized pagination | |
| 43 | 56 | ||
| 44 | - ### 6. Replacing your event Bus (wip) | ||
| 57 | + | ||
| 58 | + ### 6. Working examples of github from JakeWharton's Retrofit preso at Netflix (wip) | ||
| 59 | + | ||
| 60 | + https://www.youtube.com/watch?v=aEuNBk1b5OE#t=2480 | ||
| 61 | + https://speakerdeck.com/jakewharton/2014-1 | ||
| 62 | + | ||
| 63 | + | ||
| 64 | + ### 7. Replacing your event Bus (wip) | ||
| 45 | 65 | ||
| 46 | 66 | http://stackoverflow.com/questions/19266834/rxjava-and-random-sporadic-events-on-android | |
| Back | FazBrowse Home | New Git URL |
0 commit comments