replace some toList calls with toMutableList, for proper casting if empty

This commit is contained in:
tibbi 2018-07-04 11:39:19 +02:00
parent 7d44532320
commit a6cc35fc97
4 changed files with 6 additions and 6 deletions

View File

@ -47,7 +47,7 @@ ext {
}
dependencies {
implementation 'com.simplemobiletools:commons:4.3.25'
implementation 'com.simplemobiletools:commons:4.3.26'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'it.sephiroth.android.exif:library:1.0.1'

View File

@ -158,7 +158,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
PropertiesDialog(activity, dirs[selectedPositions.first()].path, config.shouldShowHidden)
}
} else {
PropertiesDialog(activity, getSelectedPaths().filter { it != FAVORITES && it != RECYCLE_BIN }.toList(), config.shouldShowHidden)
PropertiesDialog(activity, getSelectedPaths().filter { it != FAVORITES && it != RECYCLE_BIN }.toMutableList(), config.shouldShowHidden)
}
}
@ -236,7 +236,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
dirs.forEach {
it.name = activity.checkAppendingHidden(it.path, hidden, includedFolders)
}
listener?.updateDirectories(dirs.toList() as ArrayList)
listener?.updateDirectories(dirs.toMutableList() as ArrayList)
activity.runOnUiThread {
updateDirs(dirs)
}
@ -287,7 +287,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
private fun tryExcludeFolder() {
val paths = getSelectedPaths().filter { it != PATH }.toSet()
if (paths.size == 1) {
ExcludeFolderDialog(activity, paths.toList()) {
ExcludeFolderDialog(activity, paths.toMutableList()) {
listener?.refreshItems()
finishActMode()
}

View File

@ -395,7 +395,7 @@ fun Context.updateDBDirectory(directory: Directory) {
fun Context.getOTGFolderChildren(path: String) = getDocumentFile(path)?.listFiles()
fun Context.getOTGFolderChildrenNames(path: String) = getOTGFolderChildren(path)?.map { it.name }?.toList()
fun Context.getOTGFolderChildrenNames(path: String) = getOTGFolderChildren(path)?.map { it.name }?.toMutableList()
fun Context.getFavoritePaths() = galleryDB.MediumDao().getFavoritePaths() as ArrayList<String>

View File

@ -114,7 +114,7 @@ class MediaFetcher(val context: Context) {
val foldersToIgnore = arrayListOf("/storage/emulated/legacy")
val config = context.config
val includedFolders = config.includedFolders
var foldersToScan = config.everShownFolders.toList() as ArrayList
var foldersToScan = config.everShownFolders.toMutableList() as ArrayList
cursor.use {
if (cursor.moveToFirst()) {