mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
adding some null checks at deleting files/folders
This commit is contained in:
parent
902bdb0255
commit
bb8acad55e
2 changed files with 12 additions and 10 deletions
|
@ -380,17 +380,19 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
||||||
|
|
||||||
activity.handleSAFDialog(SAFPath) {
|
activity.handleSAFDialog(SAFPath) {
|
||||||
selectedPositions.sortedDescending().forEach {
|
selectedPositions.sortedDescending().forEach {
|
||||||
val directory = dirs[it]
|
val directory = dirs.getOrNull(it)
|
||||||
if (directory.areFavorites() || directory.isRecycleBin()) {
|
if (directory != null) {
|
||||||
if (selectedPositions.size == 1) {
|
if (directory.areFavorites() || directory.isRecycleBin()) {
|
||||||
finishActMode()
|
if (selectedPositions.size == 1) {
|
||||||
|
finishActMode()
|
||||||
|
} else {
|
||||||
|
selectedPositions.remove(it)
|
||||||
|
toggleItemSelection(false, it)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
selectedPositions.remove(it)
|
folders.add(File(directory.path))
|
||||||
toggleItemSelection(false, it)
|
removeFolders.add(directory)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
folders.add(File(directory.path))
|
|
||||||
removeFolders.add(directory)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -316,7 +316,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Thumbnai
|
||||||
val SAFPath = (media[selectedPositions.first()] as Medium).path
|
val SAFPath = (media[selectedPositions.first()] as Medium).path
|
||||||
activity.handleSAFDialog(SAFPath) {
|
activity.handleSAFDialog(SAFPath) {
|
||||||
selectedPositions.sortedDescending().forEach {
|
selectedPositions.sortedDescending().forEach {
|
||||||
val thumbnailItem = media[it]
|
val thumbnailItem = media.getOrNull(it)
|
||||||
if (thumbnailItem is Medium) {
|
if (thumbnailItem is Medium) {
|
||||||
fileDirItems.add(FileDirItem(thumbnailItem.path, thumbnailItem.name))
|
fileDirItems.add(FileDirItem(thumbnailItem.path, thumbnailItem.name))
|
||||||
removeMedia.add(thumbnailItem)
|
removeMedia.add(thumbnailItem)
|
||||||
|
|
Loading…
Reference in a new issue