mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 00:17:58 +01:00
Merge pull request #2357 from KryptKode/ref/delete-animation
fix: show delete animation after file delete
This commit is contained in:
commit
fb58d0b9a5
3 changed files with 54 additions and 39 deletions
|
@ -626,6 +626,11 @@ class DirectoryAdapter(
|
|||
return@handleSAFDialog
|
||||
}
|
||||
|
||||
activity.handleSAFDeleteSdk30Dialog(SAFPath){
|
||||
if (!it) {
|
||||
return@handleSAFDeleteSdk30Dialog
|
||||
}
|
||||
|
||||
var foldersToDelete = ArrayList<File>(selectedKeys.size)
|
||||
selectedDirs.forEach {
|
||||
if (it.areFavorites() || it.isRecycleBin()) {
|
||||
|
@ -659,6 +664,7 @@ class DirectoryAdapter(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun tryChangeAlbumCover(useDefault: Boolean) {
|
||||
activity.handleLockedFolderOpening(getFirstSelectedItemPath() ?: "") { success ->
|
||||
|
|
|
@ -459,17 +459,25 @@ class MediaAdapter(
|
|||
return
|
||||
}
|
||||
|
||||
val SAFPath = getSelectedPaths().firstOrNull { activity.needsStupidWritePermissions(it) } ?: getFirstSelectedItemPath() ?: return
|
||||
val selectedItems = getSelectedItems()
|
||||
val selectedPaths = selectedItems.map { it.path } as ArrayList<String>
|
||||
val SAFPath = selectedPaths.firstOrNull { activity.needsStupidWritePermissions(it) } ?: getFirstSelectedItemPath() ?: return
|
||||
activity.handleSAFDialog(SAFPath) {
|
||||
if (!it) {
|
||||
return@handleSAFDialog
|
||||
}
|
||||
|
||||
val sdk30SafPath = selectedPaths.firstOrNull { activity.isAccessibleWithSAFSdk30(it) } ?: getFirstSelectedItemPath() ?: return@handleSAFDialog
|
||||
activity.handleSAFDeleteSdk30Dialog(sdk30SafPath){
|
||||
if (!it) {
|
||||
return@handleSAFDeleteSdk30Dialog
|
||||
}
|
||||
|
||||
val fileDirItems = ArrayList<FileDirItem>(selectedKeys.size)
|
||||
val removeMedia = ArrayList<Medium>(selectedKeys.size)
|
||||
val positions = getSelectedItemPositions()
|
||||
|
||||
getSelectedItems().forEach {
|
||||
selectedItems.forEach {
|
||||
fileDirItems.add(FileDirItem(it.path, it.name))
|
||||
removeMedia.add(it)
|
||||
}
|
||||
|
@ -481,6 +489,7 @@ class MediaAdapter(
|
|||
currentMediaHash = media.hashCode()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getSelectedItems() = selectedKeys.mapNotNull { getItemWithKey(it) } as ArrayList<Medium>
|
||||
|
||||
|
|
|
@ -259,7 +259,7 @@ fun BaseSimpleActivity.tryDeleteFileDirItem(
|
|||
fileDirItem: FileDirItem, allowDeleteFolder: Boolean = false, deleteFromDatabase: Boolean,
|
||||
callback: ((wasSuccess: Boolean) -> Unit)? = null
|
||||
) {
|
||||
deleteFile(fileDirItem, allowDeleteFolder) {
|
||||
deleteFile(fileDirItem, allowDeleteFolder, isDeletingMultipleFiles = false) {
|
||||
if (deleteFromDatabase) {
|
||||
ensureBackgroundThread {
|
||||
deleteDBPath(fileDirItem.path)
|
||||
|
|
Loading…
Reference in a new issue