komikku/app/src/main/java/exh/ui/base/BaseExhController.kt

32 lines
954 B
Kotlin
Raw Normal View History

2019-07-31 01:29:12 +02:00
package exh.ui.base
2019-07-31 09:39:51 +02:00
import android.os.Bundle
2019-07-31 01:29:12 +02:00
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.LayoutRes
import androidx.viewbinding.ViewBinding
2019-07-31 01:29:12 +02:00
import eu.kanade.tachiyomi.ui.base.controller.BaseController
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.cancel
import kotlin.coroutines.CoroutineContext
2019-07-31 01:29:12 +02:00
abstract class BaseExhController<VB : ViewBinding>(bundle: Bundle? = null) : BaseController<VB>(bundle), CoroutineScope {
2019-07-31 01:29:12 +02:00
abstract val layoutId: Int
@LayoutRes get
override val coroutineContext: CoroutineContext = Job() + Dispatchers.Default
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
return inflater.inflate(layoutId, container, false)
}
override fun onDestroy() {
super.onDestroy()
cancel()
}
}