joaquim-verges / Helium

Lightweight, Intuitive Framework for Android
Apache License 2.0
341 stars 18 forks source link

Provide convenient method to construct the Presenter if it has non-empty constructors in case of fragment. #12

Closed msimar closed 6 years ago

msimar commented 6 years ago

Added for reference https://proandroiddev.com/viewmodel-with-dagger2-architecture-components-2e06f06c9455

Otherwise end up issues https://github.com/googlesamples/android-architecture-components/issues/207

joaquim-verges commented 6 years ago

good point, I have it for Activity but not for Fragment. I'll add that asap. Thanks!

In the meantime you can use ViewModelProviders.of(fragment) instead of RetainedPresenters.get() to pass in your presenter factory. RetainedPresenters is really just a convenience wrapper on top of ViewModelProviders.

msimar commented 6 years ago

Yeah, I noticed RetainedPresenters and already using ViewModelProviders.