Skip to content

Instantly share code, notes, and snippets.

@alaershov
Last active January 8, 2020 12:03
Show Gist options
  • Save alaershov/fd4e8868ac3217b526967b4c8150f7c7 to your computer and use it in GitHub Desktop.
Save alaershov/fd4e8868ac3217b526967b4c8150f7c7 to your computer and use it in GitHub Desktop.
Toothpick: sample Module
public final class RepositoryModule extends Module {
public RepositoryModule(Context context) {
SharedPreferences sharedPreferences = context.getSharedPreferences("app.prefs", MODE_PRIVATE);
bind(SharedPreferences.class).toInstance(sharedPreferences);
bind(UserRepository.class)
.to(PrefUserRepository.class)
.singleton();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment