Skip to content

Instantly share code, notes, and snippets.

@frogermcs
Created June 12, 2016 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frogermcs/dee5923bb9facedacb738ff503a44c4c to your computer and use it in GitHub Desktop.
Save frogermcs/dee5923bb9facedacb738ff503a44c4c to your computer and use it in GitHub Desktop.
ViewHolder and Dagger 2 example
@Module
public class RepositoriesListActivityModule {
//...
@Provides
@IntoMap
@IntKey(Repository.TYPE_NORMAL)
RepositoriesListViewHolderFactory provideViewHolderNormal() {
return new RepositoryViewHolderNormalFactory();
}
@Provides
@IntoMap
@IntKey(Repository.TYPE_BIG)
RepositoriesListViewHolderFactory provideViewHolderBig() {
return new RepositoryViewHolderBigFactory();
}
@Provides
@IntoMap
@IntKey(Repository.TYPE_FEATURED)
RepositoriesListViewHolderFactory provideViewHolderFeatured() {
return new RepositoryViewHolderFeaturedFactory();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment