Skip to content

Instantly share code, notes, and snippets.

View vincent-paing's full-sized avatar
🎯
Focusing

Aung Kyaw Paing vincent-paing

🎯
Focusing
View GitHub Profile
fakeMovieList.forEachIndexed { index, movie ->
//Scroll to Position
onView(withId(R.id.rvMovie)).perform(
RecyclerViewActions.scrollToPosition<RecyclerView.ViewHolder>(
index
)
)
if (imageLoader is FakeImageLoader) {
abstract class BaseFragment : Fragment() {
override fun onDestroy() {
releaseContext(this::class.toString())
super.onDestroy()
}
}
val myModule = applicationContext {
context("A"){
context("B"){
}
}
context("C"){
}
internal fun stubNews(single: Single<List<NewsModel>> = Single.just(mock())) {
whenever(TestApplication.getMockedDataManager().getNews(any())).thenReturn(single)
}
val viewModel = viewModelProviders.of(this, newsListingViewModel).get(NewsListingViewModel::class.java)
class NewsListingViewModel constructor(
val getNews: GetNews
) : BaseViewModel() {
//Implementations
}
val errorMessageFactory: ErrorMessageFactory by inject()
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
startKoin(this, listOf(appModule, persistenceModule, networkModule))
}
}
class MyApplication : Application(), HasActivityInjector, HasSupportFragmentInjector {
@Inject
lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector<Activity>
@Inject
lateinit var dispatchingAndroidFragmentInjector: DispatchingAndroidInjector<Fragment>
override fun onCreate() {
super.onCreate()
DaggerApplicationComponent.builder().application(this).build().inject(this)
@Singleton
@Component(
modules = arrayOf(
AndroidSupportInjectionModule::class, ApplicationModule::class, NetworkModule::class,
BindingModule::class
)
)
interface ApplicationComponent {
@Component.Builder