komikku/app/src/main/java/exh/ui/base/BaseExhController.kt
arkon 8d5b2f40b3 Use Kolinter Gradle plugin for linting instead of ktlint directly
(cherry picked from commit 76f6fe46010b235ee59962c94c790428870fc23e)
2020-09-13 23:08:52 -04:00

31 lines
954 B
Kotlin

package exh.ui.base
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.LayoutRes
import androidx.viewbinding.ViewBinding
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
abstract class BaseExhController<VB : ViewBinding>(bundle: Bundle? = null) : BaseController<VB>(bundle), CoroutineScope {
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()
}
}