Architecture-samples: New sample: MVP-Clean-RxJava-Dagger2

Created on 7 Apr 2016  路  15Comments  路  Source: android/architecture-samples

New sample community request

Most helpful comment

Is this an open issue for anyone to jump on?

I'd love to implement it.

All 15 comments

Is this an open issue for anyone to jump on?

I'd love to implement it.

@Kaerdan That would be really great - and YES - this is a sample/issue for the community. So "jump on" :) :+1:

@Kaerdan If you're using a fork, then it's only possible to create an issue in the original repo.
@JoseAlcerreca If I want to create an issue only for the repo/fork of Kaerdan, how should I do this? Do you have any suggestions?

Please bear in mind that Rx and dagger2 are being developed. An official Clean+Rx+Dagger2 sample would have to be a combination of the three branches. If you fork Clean and start adding Rx to it, the implementation will be different from what @ErikHellman is working on, probably :), so they would have to be merged afterwards.

But of course if you want to work on it on your own, in your own repo that's fantastic. Development branches can use your implementation as reference too.

Let's not open any more issues @Rainer-Lang, and keep the conversation about it here :+1:

@JoseAlcerreca Yeah, I have that in mind, I added Rx in Domain part and it looks really nice. Now, I'm waiting for Rx and Dagger2 branches. At lease the first one, the I can finish mvp-clean-rxjava.
It looks like no one is developing Dagger2 branch, probably I should try to implement it, but it is a discussion for another issue.

Cool! Can you share your progress?

We just started development on the Dagger2 branch! I'll assign the issue ASAP.

Sure, check this branch: https://github.com/Kaerdan/android-architecture/tree/dev-todo-mvp-clean-rxjava
UseCase is now responsible for subscribing and observing on different threads. So Presenter just run a UseCase and subscribe, I think it is a little bit cleaner then asking a Handler to run a UseCase for you, as it is done in todo-mvp-clean. Also concrete UseCase provides Scheduler that in want to use, so the whole concurrency model became more flexible.

Regarding Dagger2, I can write the changes I want to do, you evaluate them and I will implement.

@Kaerdan Maybe you could help: At the end of an activity (fragment) (eg user pressed backpress) I have to save data in database and even I have to send data to a server (long running task).
How could this be done with MVP-Clean-RxJava-Dagger2? Could you give some hints or make an example for this?

@Rainer-Lang I don't really see a problem. You can just create a specific UseCase and use it. I can't recommend anything concrete, because I don't know your intents. One of the pitfalls of your scenario is that no one will be able to process Exception if something will go wrong.
Probably it will be better if somebody who launches this activity (fragment), could also send this data to your server. But again I don't know your real intents, so I can only guess.
@JoseAlcerreca Sorry for unrelated discussion.

@NikitaKozlov In the example it's used Observable.create(), but there are different known issues. Have a look here:
https://artemzin.com/blog/rxjava-defer-execution-of-function-via-fromcallable/
and http://blog.danlew.net/2015/07/23/deferring-observable-code-until-subscription-in-rxjava/

Any new progress on the sample MVP-Clean-RxJava-Dagger2? Is the sample finished?

BTW, I really like the implementation of @NikitaKozlov, since it reminds me of this repo:
https://github.com/android10/Android-CleanArchitecture/tree/core/refactor-project-structure

+1

I implemented a MVP-Clean-RxJava-Dagger2 sample too, based on the MVP-Clean sample.
Replaced the callbacks with Rxjava & replaced the Injection part by Dagger2.
For the UseCases, I considered to keep the possibility to do complicate schedule controls.
I wish i could do it based on @NikitaKozlov 's work,
but because I just happened to use MVP-Clean-RxJava-Dagger2 in a new product as I mentioned when we met in DevFest Tokyo 2016 @JoseAlcerreca. I want to share my idea here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AnirudhaAgashe picture AnirudhaAgashe  路  7Comments

aitorvs picture aitorvs  路  4Comments

bmomani1 picture bmomani1  路  4Comments

jpventura picture jpventura  路  5Comments

jacquesgiraudel picture jacquesgiraudel  路  6Comments