28 lines
710 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 androidx.fragment.app.Fragment
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 {
2020-08-19 04:40:35 -07:00
operator fun invoke(activity: BaseUIActivity<*, *>)
2020-08-18 06:03:12 -07:00
}
interface FragmentExecutor {
operator fun invoke(fragment: Fragment)
}