Skip to content

Commit 92c0ea6

Browse files
author
Kaushik Gopal
committed
chore: cleanup text
1 parent cd202c8 commit 92c0ea6

File tree

3 files changed

+33
-10
lines changed

3 files changed

+33
-10
lines changed

README.md

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
Learning RxJava for Android by example
22
==============
33

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).
75

86
## Examples:
97

@@ -44,7 +42,7 @@ Since it was a presentation, Jake only put up the most important code snippets i
4442

4543
### Orchestrating Observables. Make parallel network calls, then combine the result into a single data point (flatmap + zip)
4644

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.
4846

4947

5048
(flatmap)
@@ -54,15 +52,18 @@ The below ascii diagram expresses the intention of our next example with panache
5452
\ |
5553
\____________ f5 _______|
5654

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.
6056

57+
### Double binding with TextViews
6158

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.
6260

61+
While the example here is pretty rudimentary, the technique used to achieve the double binding using a `Publish Subject` is much more interesting.
6362

6463
## Work in Progress:
6564

65+
Examples that I would like to have here, but haven't found the time yet to flush out.
66+
6667
### First retrieve from cached data, if no cache found make a network call if you can't find your data (concat) (wip)
6768
[Courtesy: gist](https://gist.github.com/adelnizamutdinov/7483969)
6869

@@ -73,4 +74,26 @@ b. Optimized pagination
7374

7475
### Event Bus with RxJAva (wip)
7576

76-
http://stackoverflow.com/questions/19266834/rxjava-and-random-sporadic-events-on-android
77+
http://stackoverflow.com/questions/19266834/rxjava-and-random-sporadic-events-on-android
78+
79+
80+
## Contributing:
81+
82+
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.

app/src/main/java/com/morihacky/android/rxjava/DoubleBindingTextViewFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void call(Float aFloat) {
4646

4747
onNumberChanged();
4848
_number2.requestFocus();
49-
49+
5050
return layout;
5151
}
5252

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
<string name="btn_demo_timeout">delayed jobs (timeout)</string>
1818
<string name="btn_demo_retrofit">Retrofit + RxJava</string>
1919
<string name="btn_demo_double_binding_textview">Double binding (PublishSubject)</string>
20-
<string name="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+
<string name="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>
2121
</resources>

0 commit comments

Comments
 (0)