package cn.flightfeather.thirdapp.module.common
|
|
import cn.flightfeather.thirdapp.common.net.ResultCallBack
|
import cn.flightfeather.thirdapp.module.base.BaseViewModel
|
import cn.flightfeather.thirdapp.repository.MediaFileRepository
|
import cn.flightfeather.thirdapp.util.file.FileItem
|
|
/**
|
* @author riku
|
* Date: 2019/11/22
|
*/
|
class FileBrowseViewModel : BaseViewModel() {
|
|
private val mediaFileRepository = MediaFileRepository()
|
|
val selectedFilePathList = ArrayList<String>()
|
|
//所有文件,按照文件类型分类
|
val totalFiles = mutableMapOf<String, MutableList<FileItem>>()
|
|
//类型文件展示状态,记录该类型文件的部分是否已经展示在界面上
|
private val fileShowState = mutableMapOf<String, Boolean>()
|
|
//同一类型文件查询到多少个后需要刷新展示到界面上
|
private val needShowNum = 10
|
|
fun getFileCache(url: String, resultCallBack: ResultCallBack<String>) {
|
mediaFileRepository.getFileCache(url, resultCallBack)
|
}
|
|
fun saveFileCache(url: String, localPath: String) {
|
mediaFileRepository.saveFileCache(url, localPath)
|
}
|
}
|