From 2a94e9b811fe90786e5f3bae4e41275424c537d9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 5 Feb 2023 16:27:56 +0100 Subject: [PATCH] properly fix Open Recycle Bin and Show all folders content --- app/build.gradle | 2 +- .../gallery/pro/activities/MediaActivity.kt | 8 +++----- .../gallery/pro/activities/ViewPagerActivity.kt | 4 +++- .../gallery/pro/asynctasks/GetMediaAsynctask.kt | 3 +-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f355040d6..70793e94d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -78,7 +78,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:095dd08ba9' + implementation 'com.github.SimpleMobileTools:Simple-Commons:50eeb2e717' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt index 6350822a0..66d29d101 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt @@ -335,7 +335,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { mStoredMarkFavoriteItems = markFavoriteItems mStoredThumbnailSpacing = thumbnailSpacing mStoredRoundedCorners = fileRoundedCorners - mShowAll = showAll + mShowAll = showAll && mPath != RECYCLE_BIN } } @@ -373,16 +373,14 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { else -> getHumanizedFilename(mPath) } - val searchHint = if (mPath == RECYCLE_BIN) { - getString(R.string.search_in_placeholder, dirName) - } else if (mShowAll) { + val searchHint = if (mShowAll) { getString(R.string.search_files) } else { getString(R.string.search_in_placeholder, dirName) } media_menu.updateHintText(searchHint) - if (!mShowAll || mPath == RECYCLE_BIN) { + if (!mShowAll) { media_menu.toggleForceArrowBackIcon(true) media_menu.onNavigateBackClickListener = { onBackPressed() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index e4d41556c..d00343110 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -304,7 +304,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } else { try { mPath = intent.getStringExtra(PATH) ?: "" - mShowAll = config.showAll + + // make sure "Open Recycle Bin" works well with "Show all folders content" + mShowAll = config.showAll && (mPath.isNotEmpty() && !mPath.startsWith(recycleBinPath)) } catch (e: Exception) { showErrorToast(e) finish() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/asynctasks/GetMediaAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/asynctasks/GetMediaAsynctask.kt index b61fa4adf..0067953da 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/asynctasks/GetMediaAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/asynctasks/GetMediaAsynctask.kt @@ -33,8 +33,7 @@ class GetMediaAsynctask(val context: Context, val mPath: String, val isPickImage val lastModifieds = if (getProperLastModified) mediaFetcher.getLastModifieds() else HashMap() val dateTakens = if (getProperDateTaken) mediaFetcher.getDateTakens() else HashMap() - // make sure "Open Recycle Bin" works even from Show All Folders Content view - val media = if (showAll && mPath != RECYCLE_BIN) { + val media = if (showAll) { val foldersToScan = mediaFetcher.getFoldersToScan().filter { it != RECYCLE_BIN && it != FAVORITES && !context.config.isFolderProtected(it) } val media = ArrayList() foldersToScan.forEach {