mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 14:37:59 +01:00
use MediaStore request way of deleting files on SDK 31
- on SDK 31+, if the app can manange media, we want to use the MediaStore request way of deleting files - we use the new method added BaseSimpleActivity.checkManageMediaOrHandleSAFDialogSdk30 that performs the check and determines if we should show the SAF dialog or not
This commit is contained in:
parent
aca71be5d8
commit
b4262111d7
2 changed files with 6 additions and 6 deletions
|
@ -1122,9 +1122,9 @@ 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()) {
|
||||||
handleSAFDialogSdk30(fileDirItem.path) {
|
checkManageMediaOrHandleSAFDialogSdk30(fileDirItem.path) {
|
||||||
if (!it) {
|
if (!it) {
|
||||||
return@handleSAFDialogSdk30
|
return@checkManageMediaOrHandleSAFDialogSdk30
|
||||||
}
|
}
|
||||||
|
|
||||||
mIgnoredPaths.add(fileDirItem.path)
|
mIgnoredPaths.add(fileDirItem.path)
|
||||||
|
@ -1150,9 +1150,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleDeletion(fileDirItem: FileDirItem) {
|
private fun handleDeletion(fileDirItem: FileDirItem) {
|
||||||
handleSAFDialogSdk30(fileDirItem.path) {
|
checkManageMediaOrHandleSAFDialogSdk30(fileDirItem.path) {
|
||||||
if (!it) {
|
if (!it) {
|
||||||
return@handleSAFDialogSdk30
|
return@checkManageMediaOrHandleSAFDialogSdk30
|
||||||
}
|
}
|
||||||
|
|
||||||
mIgnoredPaths.add(fileDirItem.path)
|
mIgnoredPaths.add(fileDirItem.path)
|
||||||
|
|
|
@ -491,9 +491,9 @@ class MediaAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
val sdk30SafPath = selectedPaths.firstOrNull { activity.isAccessibleWithSAFSdk30(it) } ?: getFirstSelectedItemPath() ?: return@handleSAFDialog
|
val sdk30SafPath = selectedPaths.firstOrNull { activity.isAccessibleWithSAFSdk30(it) } ?: getFirstSelectedItemPath() ?: return@handleSAFDialog
|
||||||
activity.handleSAFDialogSdk30(sdk30SafPath) {
|
activity.checkManageMediaOrHandleSAFDialogSdk30(sdk30SafPath) {
|
||||||
if (!it) {
|
if (!it) {
|
||||||
return@handleSAFDialogSdk30
|
return@checkManageMediaOrHandleSAFDialogSdk30
|
||||||
}
|
}
|
||||||
|
|
||||||
val fileDirItems = ArrayList<FileDirItem>(selectedKeys.size)
|
val fileDirItems = ArrayList<FileDirItem>(selectedKeys.size)
|
||||||
|
|
Loading…
Reference in a new issue