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