Search in sources :

Example 1 with MainViewModel

use of uk.ivanc.archimvvm.viewmodel.MainViewModel in project archi by ivacf.

the class MainViewModelTest method setUp.

@Before
public void setUp() {
    githubService = mock(GithubService.class);
    dataListener = mock(MainViewModel.DataListener.class);
    application = (ArchiApplication) RuntimeEnvironment.application;
    // Mock the retrofit service so we don't call the API directly
    application.setGithubService(githubService);
    // Change the default subscribe schedulers so all observables
    // will now run on the same thread
    application.setDefaultSubscribeScheduler(Schedulers.immediate());
    mainViewModel = new MainViewModel(application, dataListener);
}
Also used : GithubService(uk.ivanc.archimvvm.model.GithubService) MainViewModel(uk.ivanc.archimvvm.viewmodel.MainViewModel) Before(org.junit.Before)

Example 2 with MainViewModel

use of uk.ivanc.archimvvm.viewmodel.MainViewModel in project archi by ivacf.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    binding = DataBindingUtil.setContentView(this, R.layout.main_activity);
    mainViewModel = new MainViewModel(this, this);
    binding.setViewModel(mainViewModel);
    setSupportActionBar(binding.toolbar);
    setupRecyclerView(binding.reposRecyclerView);
}
Also used : MainViewModel(uk.ivanc.archimvvm.viewmodel.MainViewModel)

Aggregations

MainViewModel (uk.ivanc.archimvvm.viewmodel.MainViewModel)2 Before (org.junit.Before)1 GithubService (uk.ivanc.archimvvm.model.GithubService)1