riku
2022-02-18 d59d55575d913646b7a90fca651904ab889c6723
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package cn.flightfeather.thirdappmodule.module.common
 
import cn.flightfeather.thirdappmodule.common.net.ResultCallBack
import cn.flightfeather.thirdappmodule.module.base.BaseViewModel
import cn.flightfeather.thirdappmodule.repository.MediaFileRepository
import cn.flightfeather.thirdappmodule.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)
    }
}