Skip to content

Instantly share code, notes, and snippets.

Rohan Kandwal rohankandwal

  • Bengaluru, Karnataka, India
Block or report user

Report or block rohankandwal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
rohankandwal /
Created May 20, 2018
RxSchedulersOverrideRule - subscriptions always subscribeOn and observeOn Schedulers.trampoline().
package com.itcse.beerrecepies;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import java.util.concurrent.Callable;
import io.reactivex.Scheduler;
rohankandwal /
Created May 10, 2018
AppModule - Used to inject fragments, service, activities with other modules
@Module(includes = {
AndroidInjectionModule.class, RepositoryModule.class,
ViewModelModule.class, LocalRepositoryModule.class, MQTTModule.class
abstract class AppModule {
* Singleton annotation isn't necessary since Application instance is unique but is here for
* convention. In general, providing Activity, Fragment, BroadcastReceiver, etc does not require
* them to be scoped since they are the components being injected and their instance is unique.
rohankandwal /
Created May 10, 2018
ViewModelModule - Module to bind your ViewModels. We also bind our custom ViewModelFactory here.
public abstract class ViewModelModule {
abstract ViewModel bindSplashScreenViewModel(final SplashScreenViewModel splashScreenViewModel);
rohankandwal /
Last active May 10, 2018
CustomViewModelFactory - Used to provide ViewModels with all injections available for that particular Activity/Fragment/Service
public class CustomViewModelFactory implements ViewModelProvider.Factory {
private final Map<Class<? extends ViewModel>, Provider<ViewModel>> creators;
CustomViewModelFactory(Map<Class<? extends ViewModel>, Provider<ViewModel>> creators) {
this.creators = creators;
You can’t perform that action at this time.