mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 20:48:00 +01:00
SDK 30 changes
- handle SAF dialog on ViewPagerActivity before refreshing screen
This commit is contained in:
parent
4a3e502484
commit
399c8e241d
1 changed files with 32 additions and 20 deletions
|
@ -1109,20 +1109,26 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
|
||||
val fileDirItem = FileDirItem(path, path.getFilenameFromPath())
|
||||
if (config.useRecycleBin && !getCurrentMedium()!!.getIsInRecycleBin()) {
|
||||
mIgnoredPaths.add(fileDirItem.path)
|
||||
val media = mMediaFiles.filter { !mIgnoredPaths.contains(it.path) } as ArrayList<ThumbnailItem>
|
||||
runOnUiThread {
|
||||
gotMedia(media, true, false)
|
||||
}
|
||||
handleSAFDialogSdk30(fileDirItem.path) {
|
||||
if (!it) {
|
||||
return@handleSAFDialogSdk30
|
||||
}
|
||||
|
||||
movePathsInRecycleBin(arrayListOf(path)) {
|
||||
if (it) {
|
||||
tryDeleteFileDirItem(fileDirItem, false, false) {
|
||||
mIgnoredPaths.remove(fileDirItem.path)
|
||||
deleteDirectoryIfEmpty()
|
||||
mIgnoredPaths.add(fileDirItem.path)
|
||||
val media = mMediaFiles.filter { !mIgnoredPaths.contains(it.path) } as ArrayList<ThumbnailItem>
|
||||
runOnUiThread {
|
||||
gotMedia(media, true, false)
|
||||
}
|
||||
|
||||
movePathsInRecycleBin(arrayListOf(path)) {
|
||||
if (it) {
|
||||
tryDeleteFileDirItem(fileDirItem, false, false) {
|
||||
mIgnoredPaths.remove(fileDirItem.path)
|
||||
deleteDirectoryIfEmpty()
|
||||
}
|
||||
} else {
|
||||
toast(R.string.unknown_error_occurred)
|
||||
}
|
||||
} else {
|
||||
toast(R.string.unknown_error_occurred)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1131,15 +1137,21 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
}
|
||||
|
||||
private fun handleDeletion(fileDirItem: FileDirItem) {
|
||||
mIgnoredPaths.add(fileDirItem.path)
|
||||
val media = mMediaFiles.filter { !mIgnoredPaths.contains(it.path) } as ArrayList<ThumbnailItem>
|
||||
runOnUiThread {
|
||||
gotMedia(media, true, false)
|
||||
}
|
||||
handleSAFDialogSdk30(fileDirItem.path) {
|
||||
if (!it) {
|
||||
return@handleSAFDialogSdk30
|
||||
}
|
||||
|
||||
tryDeleteFileDirItem(fileDirItem, false, true) {
|
||||
mIgnoredPaths.remove(fileDirItem.path)
|
||||
deleteDirectoryIfEmpty()
|
||||
mIgnoredPaths.add(fileDirItem.path)
|
||||
val media = mMediaFiles.filter { !mIgnoredPaths.contains(it.path) } as ArrayList<ThumbnailItem>
|
||||
runOnUiThread {
|
||||
gotMedia(media, true, false)
|
||||
}
|
||||
|
||||
tryDeleteFileDirItem(fileDirItem, false, true) {
|
||||
mIgnoredPaths.remove(fileDirItem.path)
|
||||
deleteDirectoryIfEmpty()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue