Skip to content

Instantly share code, notes, and snippets.

View mdesoto's full-sized avatar

Michael De Soto mdesoto

View GitHub Profile
@mdesoto
mdesoto / gist:4070b9db2bf8a94abdba
Created February 18, 2016 22:33 — forked from konmik/gist:6ac725fa7134402539c4
Dagger 2 injection with inheritance
/**
* This class allows to inject into objects through a base class,
* so we don't have to repeat injection code everywhere.
*
* The performance drawback is about 0.013 ms per injection on a very slow device,
* which is negligible in most cases.
*
* Example:
* <pre>{@code
...
android {
...
defaultConfig { ... }
signingConfigs {
release {
storeFile file("myreleasekey.keystore")
storePassword "password"
keyAlias "MyReleaseKey"
keyPassword "password"
android.signingConfigs {
release {
keyAlias 'com.example.app'
keyPassword 'key password'
storeFile rootProject.file('release.keystore')
storePassword 'store password'
}
}
apply from: rootProject.file('release.gradle')
...
android {
...
buildTypes {
release {
...
signingConfig signingConfigs.release
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
...
compile 'com.google.android.gms:play-services-ads:8.3.0'
compile 'com.google.android.gms:play-services-appindexing:8.3.0'
compile 'com.google.android.gms:play-services-base:8.3.0'
...
}
ext {
playServices = '8.3.0'
supportVersion = '23.1.1'
}
dependencies {
compile "com.android.support:appcompat-v7:${supportVersion}"
compile "com.android.support:recyclerview-v7:${supportVersion}"
compile "com.android.support:cardview-v7:${supportVersion}"
compile "com.android.support:design:${supportVersion}"