Last active
February 4, 2018 17:13
-
-
Save mohsenoid/43d33aaa085cd005962fdf90489fdb4b to your computer and use it in GitHub Desktop.
modules https://hackernoon.com/yet-another-mvp-article-part-2-how-dagger-helps-with-the-project-90d049a45e00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mirhoseini.marvel.character.cache; | |
import dagger.Module; | |
import dagger.Provides; | |
@Module | |
class CacheModule { | |
private CacheView view; | |
CacheModule(CacheView view) { | |
this.view = view; | |
} | |
@Provides | |
public CacheView provideView() { | |
return view; | |
} | |
@Provides | |
@Cache | |
public CachePresenter providePresenter(CachePresenterImpl presenter) { | |
presenter.bind(view); | |
return presenter; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mirhoseini.marvel.character.search; | |
import dagger.Module; | |
import dagger.Provides; | |
@Module | |
class SearchModule { | |
private SearchView view; | |
SearchModule(SearchView view) { | |
this.view = view; | |
} | |
@Provides | |
public SearchView provideView() { | |
return view; | |
} | |
@Provides | |
@Search | |
public SearchInteractor provideInteractor(SearchInteractorImpl interactor) { | |
return interactor; | |
} | |
@Provides | |
@Search | |
public SearchPresenter providePresenter(SearchPresenterImpl presenter) { | |
presenter.bind(view); | |
return presenter; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment