All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.isyscore.kotlin.android.LoaderUtil.kt Maven / Gradle / Ivy

The newest version!
@file:Suppress("DEPRECATION", "unused")

package com.isyscore.kotlin.android

import android.content.AsyncTaskLoader
import android.content.Context
import android.database.Cursor

abstract class BaseClassLoader(context: Context) : AsyncTaskLoader(context) {
    abstract override fun loadInBackground(): T
    override fun onStartLoading() = forceLoad()
    override fun onStopLoading() {
        cancelLoad()
    }

    override fun onReset() = stopLoading()
}

abstract class BaseListLoader(context: Context) : BaseClassLoader>(context) {
    abstract override fun loadInBackground(): List
}

abstract class BaseMutableListLoader(context: Context) : BaseClassLoader>(context) {
    abstract override fun loadInBackground(): MutableList
}

abstract class BaseCursorLoader(context: Context) : BaseClassLoader(context) {
    abstract override fun loadInBackground(): Cursor
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy