Skip to content
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

[todo-mvp-dagger] DaggerAppCompatActivity - more downsides than benefits? #516

Open
johnnymartinovic opened this issue Mar 2, 2018 · 0 comments

Comments

@johnnymartinovic
Copy link

Biggest problem for me when using DaggerAppCompatActivity is that there is no good way of handling data in savedInstanceState object or some other configuration change behaviours.

In AddEditTaskActivity, mIsDataMissing is extracted from savedInstanceState and can be accessed through method isDataMissing(). This method must be public as it is called from AddEditTaskModule. It finally must be called by AddEditTaskPresenter using Dagger Lazy functionality in a specific place - in takeView method - because if it is called any sooner, that variable will not be set in AddEditTaskActivity at all.

Another example is TasksActivity, where filter type in TasksPresenter is set through contract TasksContract.Presenter method setFiltering.

I guess that there is no unified way of initializing Presenter class or handling various Android specifics, like configuration changes, saving instance state etc. Therefore, I think that DaggerAppCompatActivity usage brings more "mess" to the code than simply calling good old inject method on Activity's onCreate method, where custom module parameters can be set and finally passed to Presenters constructor in a clear injection way.

Please correct me if I am wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant