27 lines
672 B
Kotlin
Raw Normal View History

2020-08-18 06:31:15 -07:00
package com.topjohnwu.magisk.arch
2020-08-18 06:03:12 -07:00
import android.content.Context
import kotlinx.coroutines.CoroutineScope
/**
* Class for passing events from ViewModels to Activities/Fragments
* (see https://medium.com/google-developers/livedata-with-snackbar-navigation-and-other-events-the-singleliveevent-case-ac2622673150)
*/
abstract class ViewEvent
abstract class ViewEventWithScope: ViewEvent() {
lateinit var scope: CoroutineScope
}
interface ContextExecutor {
operator fun invoke(context: Context)
}
interface ActivityExecutor {
2022-01-22 14:42:34 -08:00
operator fun invoke(activity: UIActivity<*>)
2020-08-18 06:03:12 -07:00
}
interface FragmentExecutor {
2022-01-22 14:42:34 -08:00
operator fun invoke(fragment: BaseFragment<*>)
2020-08-18 06:03:12 -07:00
}