avoid showing the All Files access popup at file operations

This commit is contained in:
tibbi 2022-10-16 20:37:55 +02:00
parent a93da8fdad
commit 54fb75f5a7
5 changed files with 10 additions and 10 deletions

View file

@ -169,7 +169,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
if (!mWasMediaManagementPromptShown) { if (!mWasMediaManagementPromptShown) {
mWasMediaManagementPromptShown = true mWasMediaManagementPromptShown = true
handleMediaManagementPrompt { } handleMediaManagementPrompt(false) { }
} }
} }
} }

View file

@ -485,7 +485,7 @@ class SettingsActivity : SimpleActivity() {
private fun setupKeepLastModified() { private fun setupKeepLastModified() {
settings_keep_last_modified.isChecked = config.keepLastModified settings_keep_last_modified.isChecked = config.keepLastModified
settings_keep_last_modified_holder.setOnClickListener { settings_keep_last_modified_holder.setOnClickListener {
handleMediaManagementPrompt { handleMediaManagementPrompt(false) {
settings_keep_last_modified.toggle() settings_keep_last_modified.toggle()
config.keepLastModified = settings_keep_last_modified.isChecked config.keepLastModified = settings_keep_last_modified.isChecked
} }

View file

@ -662,7 +662,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
} }
private fun checkMediaManagementAndCopy(isCopyOperation: Boolean) { private fun checkMediaManagementAndCopy(isCopyOperation: Boolean) {
handleMediaManagementPrompt { handleMediaManagementPrompt(true) {
copyMoveTo(isCopyOperation) copyMoveTo(isCopyOperation)
} }
} }
@ -1109,7 +1109,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
return return
} }
handleMediaManagementPrompt { handleMediaManagementPrompt(true) {
if (config.isDeletePasswordProtectionOn) { if (config.isDeletePasswordProtectionOn) {
handleDeletePasswordProtection { handleDeletePasswordProtection {
deleteConfirmed() deleteConfirmed()
@ -1225,7 +1225,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
} }
private fun checkMediaManagementAndRename() { private fun checkMediaManagementAndRename() {
handleMediaManagementPrompt { handleMediaManagementPrompt(true) {
renameFile() renameFile()
} }
} }

View file

@ -235,7 +235,7 @@ class MediaAdapter(
} }
private fun checkMediaManagementAndRename() { private fun checkMediaManagementAndRename() {
activity.handleMediaManagementPrompt { activity.handleMediaManagementPrompt(true) {
renameFile() renameFile()
} }
} }
@ -367,7 +367,7 @@ class MediaAdapter(
} }
private fun checkMediaManagementAndCopy(isCopyOperation: Boolean) { private fun checkMediaManagementAndCopy(isCopyOperation: Boolean) {
activity.handleMediaManagementPrompt { activity.handleMediaManagementPrompt(true) {
copyMoveTo(isCopyOperation) copyMoveTo(isCopyOperation)
} }
} }
@ -446,7 +446,7 @@ class MediaAdapter(
} }
private fun checkDeleteConfirmation() { private fun checkDeleteConfirmation() {
activity.handleMediaManagementPrompt { activity.handleMediaManagementPrompt(true) {
if (config.isDeletePasswordProtectionOn) { if (config.isDeletePasswordProtectionOn) {
activity.handleDeletePasswordProtection { activity.handleDeletePasswordProtection {
deleteFiles() deleteFiles()

View file

@ -127,10 +127,10 @@ fun SimpleActivity.launchAbout() {
startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true) startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true)
} }
fun BaseSimpleActivity.handleMediaManagementPrompt(callback: () -> Unit) { fun BaseSimpleActivity.handleMediaManagementPrompt(avoidShowingAllFiles: Boolean, callback: () -> Unit) {
if (canManageMedia() || isExternalStorageManager()) { if (canManageMedia() || isExternalStorageManager()) {
callback() callback()
} else if (isRPlus() && resources.getBoolean(R.bool.require_all_files_access)) { } else if (isRPlus() && resources.getBoolean(R.bool.require_all_files_access) && !avoidShowingAllFiles) {
if (Environment.isExternalStorageManager()) { if (Environment.isExternalStorageManager()) {
callback() callback()
} else { } else {