speed up video moving in the recycle bin from fullscreen view

This commit is contained in:
tibbi 2019-05-15 09:12:47 +02:00
parent e7e1c561d8
commit 7e73d979a1

View file

@ -909,25 +909,34 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
val fileDirItem = FileDirItem(path, path.getFilenameFromPath()) val fileDirItem = FileDirItem(path, path.getFilenameFromPath())
if (config.useRecycleBin && !getCurrentMedium()!!.getIsInRecycleBin()) { if (config.useRecycleBin && !getCurrentMedium()!!.getIsInRecycleBin()) {
movePathsInRecycleBin(arrayListOf(path)) {
if (it) {
handleDeletion(fileDirItem, false)
} else {
toast(R.string.unknown_error_occurred)
}
}
} else {
handleDeletion(fileDirItem, true)
}
}
private fun handleDeletion(fileDirItem: FileDirItem, deleteFromDatabase: Boolean) {
mIgnoredPaths.add(fileDirItem.path) mIgnoredPaths.add(fileDirItem.path)
val media = mMediaFiles.filter { !mIgnoredPaths.contains(it.path) } as ArrayList<ThumbnailItem> val media = mMediaFiles.filter { !mIgnoredPaths.contains(it.path) } as ArrayList<ThumbnailItem>
runOnUiThread { runOnUiThread {
gotMedia(media) gotMedia(media)
} }
tryDeleteFileDirItem(fileDirItem, false, deleteFromDatabase) {
movePathsInRecycleBin(arrayListOf(path)) {
if (it) {
tryDeleteFileDirItem(fileDirItem, false, false) {
mIgnoredPaths.remove(fileDirItem.path)
}
} else {
toast(R.string.unknown_error_occurred)
}
}
} else {
handleDeletion(fileDirItem)
}
}
private fun handleDeletion(fileDirItem: FileDirItem) {
mIgnoredPaths.add(fileDirItem.path)
val media = mMediaFiles.filter { !mIgnoredPaths.contains(it.path) } as ArrayList<ThumbnailItem>
runOnUiThread {
gotMedia(media)
}
tryDeleteFileDirItem(fileDirItem, false, true) {
mIgnoredPaths.remove(fileDirItem.path) mIgnoredPaths.remove(fileDirItem.path)
} }
} }