You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-8Lines changed: 31 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,7 @@
1
1
Learning RxJava for Android by example
2
2
==============
3
3
4
-
I've read and watched a lot on Rx. Most examples either use the J8 lambda notations/Scala/Groovy or some other awesome language that us Android developers are constantly envious of.
5
-
6
-
Unfortunately i could never find real-world simple examples in Android, that could show me how to use RxJava in Android. This repo is a solution to that problem.
4
+
This is a repository with real-world useful examples of using RxJava with Android. It usually will be in a constant state of "Work in Progress" (WIP).
7
5
8
6
## Examples:
9
7
@@ -44,7 +42,7 @@ Since it was a presentation, Jake only put up the most important code snippets i
44
42
45
43
### Orchestrating Observables. Make parallel network calls, then combine the result into a single data point (flatmap + zip)
46
44
47
-
The below ascii diagram expresses the intention of our next example with panache. f1,f2,3,f4,f5 are essentially network calls that when made, give back a result that' needed for a future calculation.
45
+
The below ascii diagram expresses the intention of our next example with panache. f1,f2,3,f4,f5 are essentially network calls that when made, give back a result that's needed for a future calculation.
48
46
49
47
50
48
(flatmap)
@@ -54,15 +52,18 @@ The below ascii diagram expresses the intention of our next example with panache
54
52
\ |
55
53
\____________ f5 _______|
56
54
57
-
The code for this example has already been written by one Mr.skehlet in the interwebs. Head over to [the gist](https://gist.github.com/skehlet/9418379) for the code. It's written in pure Java (6) so it's pretty comprehensible if you've understood the previous examples. I'll flush it out here again when time permits, and I find a lack of other compelling examples.
58
-
59
-
### Double binding with TextViews ()
55
+
The code for this example has already been written by one Mr.skehlet in the interwebs. Head over to [the gist](https://gist.github.com/skehlet/9418379) for the code. It's written in pure Java (6) so it's pretty comprehensible if you've understood the previous examples. I'll flush it out here again when time permits or I've run out of other compelling examples.
60
56
57
+
### Double binding with TextViews
61
58
59
+
Auto-updating views are a pretty cool thing. If you've dealt with Angular JS before, they have a pretty nifty concept called "two way data binding", where when an HTML element is bound to a model/entity object, it constantly "listens" to changes on that entity and auto-updates its state based on the model. Using the technique in this example, you could potentially use a pattern like the [Presentation View Model pattern](http://martinfowler.com/eaaDev/PresentationModel.html) with great ease.
62
60
61
+
While the example here is pretty rudimentary, the technique used to achieve the double binding using a `Publish Subject` is much more interesting.
63
62
64
63
## Work in Progress:
65
64
65
+
Examples that I would like to have here, but haven't found the time yet to flush out.
66
+
66
67
### First retrieve from cached data, if no cache found make a network call if you can't find your data (concat) (wip)
I try to ensure the examples are not overly contrived but reflect a real-world usecase. If you have similar useful examples demonstrating the use of RxJava, feel free to send in a pull request.
83
+
84
+
I'm wrapping my head around RxJava too so if you feel there's a better way of doing one of the examples mentioned above, open up an issue explaining how. Even better, send a pull request.
85
+
86
+
## License
87
+
88
+
Licensed under the Apache License, Version 2.0 (the "License").
89
+
You may obtain a copy of the License at
90
+
91
+
http://www.apache.org/licenses/LICENSE-2.0
92
+
93
+
Unless required by applicable law or agreed to in writing, software
94
+
distributed under the License is distributed on an "AS IS" BASIS,
95
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
96
+
See the License for the specific language governing permissions and
97
+
limitations under the License.
98
+
99
+
You agree that all contributions to this repository, in the form of fixes, pull-requests, new examples etc. follow the above mentioned license.
<stringname="msg_demo_doublebinding">The "technique" used here is more useful than the wonderful calculation achieved below. Using this mechanism you can achieve something simliar to AngularJs or the ViewModel pattern pretty easily.</string>
20
+
<stringname="msg_demo_doublebinding">Watch how the result gloriously auto-updates based on your changing inputs. Using a technique like this, you could achieve the two-way binding in Angular Js, or more efficiently use a pattern like the Presentation View Model.</string>
0 commit comments