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()) {
mIgnoredPaths.add(fileDirItem.path)
val media = mMediaFiles.filter { !mIgnoredPaths.contains(it.path) } as ArrayList<ThumbnailItem>
runOnUiThread {
gotMedia(media)
}
movePathsInRecycleBin(arrayListOf(path)) { movePathsInRecycleBin(arrayListOf(path)) {
if (it) { if (it) {
handleDeletion(fileDirItem, false) tryDeleteFileDirItem(fileDirItem, false, false) {
mIgnoredPaths.remove(fileDirItem.path)
}
} else { } else {
toast(R.string.unknown_error_occurred) toast(R.string.unknown_error_occurred)
} }
} }
} else { } else {
handleDeletion(fileDirItem, true) handleDeletion(fileDirItem)
} }
} }
private fun handleDeletion(fileDirItem: FileDirItem, deleteFromDatabase: Boolean) { private fun handleDeletion(fileDirItem: FileDirItem) {
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) {
tryDeleteFileDirItem(fileDirItem, false, true) {
mIgnoredPaths.remove(fileDirItem.path) mIgnoredPaths.remove(fileDirItem.path)
} }
} }