properly fix Open Recycle Bin and Show all folders content

This commit is contained in:
tibbi 2023-02-05 16:27:56 +01:00
parent e28cb54a58
commit 2a94e9b811
4 changed files with 8 additions and 9 deletions

View file

@ -78,7 +78,7 @@ android {
} }
dependencies { 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 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'it.sephiroth.android.exif:library:1.0.1'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24'

View file

@ -335,7 +335,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
mStoredMarkFavoriteItems = markFavoriteItems mStoredMarkFavoriteItems = markFavoriteItems
mStoredThumbnailSpacing = thumbnailSpacing mStoredThumbnailSpacing = thumbnailSpacing
mStoredRoundedCorners = fileRoundedCorners mStoredRoundedCorners = fileRoundedCorners
mShowAll = showAll mShowAll = showAll && mPath != RECYCLE_BIN
} }
} }
@ -373,16 +373,14 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
else -> getHumanizedFilename(mPath) else -> getHumanizedFilename(mPath)
} }
val searchHint = if (mPath == RECYCLE_BIN) { val searchHint = if (mShowAll) {
getString(R.string.search_in_placeholder, dirName)
} else if (mShowAll) {
getString(R.string.search_files) getString(R.string.search_files)
} else { } else {
getString(R.string.search_in_placeholder, dirName) getString(R.string.search_in_placeholder, dirName)
} }
media_menu.updateHintText(searchHint) media_menu.updateHintText(searchHint)
if (!mShowAll || mPath == RECYCLE_BIN) { if (!mShowAll) {
media_menu.toggleForceArrowBackIcon(true) media_menu.toggleForceArrowBackIcon(true)
media_menu.onNavigateBackClickListener = { media_menu.onNavigateBackClickListener = {
onBackPressed() onBackPressed()

View file

@ -304,7 +304,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
} else { } else {
try { try {
mPath = intent.getStringExtra(PATH) ?: "" 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) { } catch (e: Exception) {
showErrorToast(e) showErrorToast(e)
finish() finish()

View file

@ -33,8 +33,7 @@ class GetMediaAsynctask(val context: Context, val mPath: String, val isPickImage
val lastModifieds = if (getProperLastModified) mediaFetcher.getLastModifieds() else HashMap() val lastModifieds = if (getProperLastModified) mediaFetcher.getLastModifieds() else HashMap()
val dateTakens = if (getProperDateTaken) mediaFetcher.getDateTakens() 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) {
val media = if (showAll && mPath != RECYCLE_BIN) {
val foldersToScan = mediaFetcher.getFoldersToScan().filter { it != RECYCLE_BIN && it != FAVORITES && !context.config.isFolderProtected(it) } val foldersToScan = mediaFetcher.getFoldersToScan().filter { it != RECYCLE_BIN && it != FAVORITES && !context.config.isFolderProtected(it) }
val media = ArrayList<Medium>() val media = ArrayList<Medium>()
foldersToScan.forEach { foldersToScan.forEach {