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 { 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.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'com.android.support:multidex:1.0.3' implementation 'com.android.support:multidex:1.0.3'
implementation 'it.sephiroth.android.exif:library:1.0.1' 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) PropertiesDialog(activity, dirs[selectedPositions.first()].path, config.shouldShowHidden)
} }
} else { } 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 { dirs.forEach {
it.name = activity.checkAppendingHidden(it.path, hidden, includedFolders) it.name = activity.checkAppendingHidden(it.path, hidden, includedFolders)
} }
listener?.updateDirectories(dirs.toList() as ArrayList) listener?.updateDirectories(dirs.toMutableList() as ArrayList)
activity.runOnUiThread { activity.runOnUiThread {
updateDirs(dirs) updateDirs(dirs)
} }
@ -287,7 +287,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
private fun tryExcludeFolder() { private fun tryExcludeFolder() {
val paths = getSelectedPaths().filter { it != PATH }.toSet() val paths = getSelectedPaths().filter { it != PATH }.toSet()
if (paths.size == 1) { if (paths.size == 1) {
ExcludeFolderDialog(activity, paths.toList()) { ExcludeFolderDialog(activity, paths.toMutableList()) {
listener?.refreshItems() listener?.refreshItems()
finishActMode() finishActMode()
} }

View file

@ -395,7 +395,7 @@ fun Context.updateDBDirectory(directory: Directory) {
fun Context.getOTGFolderChildren(path: String) = getDocumentFile(path)?.listFiles() 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> 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 foldersToIgnore = arrayListOf("/storage/emulated/legacy")
val config = context.config val config = context.config
val includedFolders = config.includedFolders val includedFolders = config.includedFolders
var foldersToScan = config.everShownFolders.toList() as ArrayList var foldersToScan = config.everShownFolders.toMutableList() as ArrayList
cursor.use { cursor.use {
if (cursor.moveToFirst()) { if (cursor.moveToFirst()) {