This file contains 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
implementation "com.google.dagger:dagger-android:${DAGGER_VERSION}" | |
implementation "com.google.dagger:dagger-android-support:${DAGGER_VERSION}" | |
annotationProcessor "com.google.dagger:dagger-android-processor:${DAGGER_VERSION}" |
This file contains 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
@Subcomponent | |
public interface MainActivitySubcomponent extends AndroidInjector<MainActivity>{ | |
@Subcomponent.Builder | |
abstract class Builder extends AndroidInjector.Builder<MainActivity>{} | |
} |
This file contains 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
@Module(subcomponents = MainActivitySubcomponent.class) | |
public abstract class MainActivityInjectorModule { | |
@Binds | |
@IntoMap | |
@ActivityKey(MainActivity.class) | |
abstract AndroidInjector.Factory<? extends Activity> bindInjectorFactory(MainActivityComponent.Builder builder); | |
} |
This file contains 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
@Singleton | |
@Component(modules = { | |
AndroidInjectionModule.class, | |
MainActivityModule.class}) | |
public interface ApplicationComponent { | |
} |
This file contains 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
@Override | |
protected void onCreate(Bundle savedInstanceState){ | |
AndroidInjection.inject(this); | |
super.onCreate(savedInstanceState); | |
} |
This file contains 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
public class MyApp extends Application implements HasActivityInjector { | |
@Inject | |
DispatchingAndroidInjector<Activity> dispatchingAndroidInjector; | |
ApplicationComponent appComponent; | |
@Override | |
public void onCreate(){ | |
super.onCreate(); |
This file contains 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
@Subcomponent(modules = SomeActivityModule) | |
public interface SomeActivitySubcomponent extends AndroidInjector<SomeActivity> { | |
@Subcomponent.Builder | |
abstract class Builder extends AndroidInjector.Builder<SomeActivity>{ | |
Builder someActivityModule(SomeActivityModule moduleInstance); | |
@Override | |
public void seedInstance(SomeActivity instance){ |
This file contains 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
node { | |
stage 'Checkout' | |
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/abnormallydriven/android-ci-example.git']]]) | |
sh "./gradlew clean" | |
stage 'Unit Test' | |
sh "./gradlew test" |
This file contains 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
init { | |
val pagedListConfig = PagedList.Config.Builder() | |
.setPageSize(30) | |
.setPrefetchDistance(30) | |
.build() | |
userListLiveData = teamDao.getTeamsAsLivePagedListProvider().create(0, pagedListConfig) | |
} |
This file contains 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
@Singleton | |
class TeamsViewModel @Inject | |
constructor(private val teamDao: TeamDao) : ViewModel(){ | |
val userListLiveData : LiveData<PagedList<Team>> | |
val tiledDataSource : TiledDataSource<Team> | |
init{ | |
val pagedListConfig = PagedList.Config.Builder() |
OlderNewer