You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
979 B
34 lines
979 B
package com.gyf.lib
|
|
|
|
import android.app.Application
|
|
import androidx.lifecycle.AndroidViewModel
|
|
import androidx.lifecycle.LiveData
|
|
import androidx.lifecycle.MutableLiveData
|
|
import androidx.lifecycle.ViewModel
|
|
|
|
@Deprecated(message = "", replaceWith = ReplaceWith(""))
|
|
abstract class ScrollList<T> : ViewModel() {
|
|
protected val _data = MutableLiveData<MutableList<T>>(mutableListOf())
|
|
val data: LiveData<MutableList<T>> = _data
|
|
|
|
abstract val initSize: Int
|
|
|
|
//加载列表
|
|
abstract fun load()
|
|
|
|
//加载更多数据
|
|
abstract fun loadMore(callback: (message: String) -> Unit)
|
|
}
|
|
|
|
abstract class ScrollListW<T>(application: Application) : AndroidViewModel(application) {
|
|
protected val _data = MutableLiveData<MutableList<T>>(mutableListOf())
|
|
val data: LiveData<MutableList<T>> = _data
|
|
|
|
abstract val initSize: Int
|
|
|
|
//加载列表
|
|
abstract fun load()
|
|
|
|
//加载更多数据
|
|
abstract fun loadMore(callback: (message: String) -> Unit)
|
|
} |