New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Novoda contributions #15
Conversation
This is adding a resumable logic to handle Observables on rotation if needed and add some wrapping logic around Dialogs and Navigation on Android
Would be good to have Javadocs for the most important parts. There are some confusing interfaces there such as ResumableObserver and ObserverOperator. And how does EventCachingOperator differ from RxJava operators |
Thanks for sharing this! I agree though that the scope of this PR is way too big. I don't understand what the responsibility of most of the classes even is. Can we break this down into a PR for each operator? Otherwise it'll be difficult to discuss any of this in a focused way. Maybe some samples / more context /more docs would help too. On a general note, I don't think we should turn RxAndroid into a framework, but I see that many of the classes here depend on each other and seem to form a framework / app blueprint. One of the key things that makes RxJava so universally applicable is that it does the opposite: it provides very fundamental building blocks on which apps can build what makes sense for them. ObservableVault for instance for me is not universally applicable across all Android apps since it suggests that Observables are retained in this particular way. RxAndroid, in my opinion should be a thin layer on top of RxJava that lifts framework classes into Rx Observables or provides helpers for platform specific problems that affect everyone. It should not, however, provide a general blueprint for how to build an app. Maybe we can open this to broader discussion? |
I fully agree on that, pointing to AndroidSchedulers and ViewObservable as prime examples. |
Let's break this PR down and discuss the ideas a bit further. I'll break that down and we can discuss on subsequent PRs. It might take me some time though since I am in France for droidcon Paris
Disclaimer: The information in this e-mail and any attachments is the Novoda Ltd, Company No: 347444, Registered in Scotland Registered |
What is "rotation tracking"? Orientation changes? Or gyroscope tracking? |
Sorry, orientation change.
Disclaimer: The information in this e-mail and any attachments is the Novoda Ltd, Company No: 347444, Registered in Scotland Registered |
Ah yes, that would be very useful :) |
No worries, take your time! We're still working on the build setup anyway |
I agree that one big strength of RxJava is that it's a toolkit, not a framework. However having some built in, well tested solutions for dealing with orientation changes and other common problems on Android would be hugely beneficial to many of us I think. |
Maybe. We use retained fragments and the replay operator. That works pretty |
@mttkay retained fragments aren't always an option. Anything using nested fragments with ChildFragmentManager can not be retained. Which means Fragments inside ViewPagers. In my code base at work we make extensive use of nested fragments, so currently without a good solution for handling configuration changes, using RxJava isn't viable. |
I don't think that's true. If the parent fragment is retained, so are all
|
The thing is sometimes you can't or don't want to rely on fragments.
Disclaimer: The information in this e-mail and any attachments is the Novoda Ltd, Company No: 347444, Registered in Scotland Registered |
I agree with @Dorvaryn, if we could ship some RX-driven solution to the horrible orientation problem on Android, the whole community would largely benefit from that @mttkay retaining fragments is not an option when using backstack (start a retained fragment, replace it with another, change orientation, go back, see how sad the situation is) |
I'll reopen smaller PRs with the different components to help discussion. |
A quick comment: If this ends up being larger, or feeling more like a framework, there's nothing stopping it from being released as a standalone project (vs part of RxAndroid) |
Novoda had an internal repo that we were working against for some of our projects and planned on releasing soon but it looks more like something that should sit in RxAndroid itself so here is a PR with what we came up with.
Working with RxJava we realised that, depending on the project, different approaches were possible.
When the project can't use the traditional data layer approach with a UI that subscribes to an observable provided by that layer (UI driven by remote API). We encountered a need for tracking the response to a specific observable from an activity over rotation.
Thus here is tooling to help make that possible on Android:
This is not useful for all architectures but it allows for some interesting usage:
I'm not sure about conventions in this project and general direction so let's discuss this and make it happen.