mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-03-25 05:10:52 +00:00
27 lines
672 B
Kotlin
27 lines
672 B
Kotlin
package com.topjohnwu.magisk.arch
|
|
|
|
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 {
|
|
operator fun invoke(activity: UIActivity<*>)
|
|
}
|
|
|
|
interface FragmentExecutor {
|
|
operator fun invoke(fragment: BaseFragment<*>)
|
|
}
|