Closed tomoima525 closed 7 years ago
Thanks for interesting idea 👍 Currently, I prefer Callback style. But to be honest, I'm looking for the best way. One of my improvement idea is to inject Callback class to ViewModel. On the other hand, EventBus is also good.
Please let me consider till tonight (JST)! 📝
Good idea.
Well, how about using Lightweight-Stream-API's Consumer instead of Rx's Consumer?
It's not reactive x, but can remove one of cons - Need to wrap with try-catch (which is a bit ugly)
.
Anyway, I don't know what is the best way... and wanna see @konifar 's opinion. 😄
Thank you for the comments! If you are good to go with this, I'll fix the build(looks like test is failing)
Lightweight-Stream-API's Consumer instead of Rx's Consumer
I never thought about it. Let me try that too.
Sorry for late comment :bowing_man: Finally, I want to adopt original Callback interface style.
To be honest, Consumer
style you proposed is good as well :ok_woman:
I know the pros but I'm a bit negative for some cons.
1) Reactive style may not be friendly with all Androiders.
I think Reactive style is not familiar with all Androiders although Consumer
is simple interface. I feel .accept()
method is not Intuitive compared with callback.onClickXX()
. I would like to keep this project familiar to many Androiders if possible.
2) Consumer#accept(T)
method has only one parameter.
If I want to pass some parameters, I have to use Pair or create a class.
3) One consumer is responsible for one action.
This is cons you mentioned. If ViewModel has 4 click event, it's necessary to add 4 Consumer
class to ViewModel, right? I feel a bit complicated.
I think Consumer
style is also good! This is almost a matter of taste 🍷
@tomoima525 Sorry, can I close this? 🙇 I really appreciate your suggestion.
@konifar Sorry for the late response. Ok, that's fine with me! Thanks for the comment 😉
Issue
Overview (Required)
Pros
implements
requiredCons
Links
NA
Screenshot
NA