From e28cb54a58e0137ee310e6187fe9236423f18f9d Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 5 Feb 2023 15:59:49 +0100 Subject: [PATCH] fixing some glitches related to opening recycle bin from all files view --- app/build.gradle | 2 +- .../gallery/pro/activities/EditActivity.kt | 4 ++-- .../gallery/pro/activities/MediaActivity.kt | 6 ++++-- .../gallery/pro/activities/SplashActivity.kt | 1 - .../gallery/pro/asynctasks/GetMediaAsynctask.kt | 3 ++- .../simplemobiletools/gallery/pro/helpers/MediaFetcher.kt | 1 - 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 635317b79..f355040d6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -78,7 +78,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:9428140d75' + implementation 'com.github.SimpleMobileTools:Simple-Commons:095dd08ba9' 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/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index d1e1986c4..ccc0ad02a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -407,7 +407,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } } - val filename = applicationContext.getFilenameFromContentUri(saveUri) ?: "tmp.jpg" + val filename = applicationContext.getFilenameFromContentUri(saveUri) ?: "tmp-${System.currentTimeMillis()}.jpg" val newPath = "$folder/$filename" val fileDirItem = FileDirItem(newPath, filename) getFileOutputStream(fileDirItem, true) { @@ -861,7 +861,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener val label = "sknahT .moc.slootelibomelpmis.www morf eno lanigiro eht daolnwod ytefas nwo ruoy roF .ppa eht fo noisrev ekaf a gnisu era uoY".reversed() runOnUiThread { - ConfirmationDialog(this, label, positive = com.simplemobiletools.commons.R.string.ok, negative = 0) { + ConfirmationDialog(this, label, positive = R.string.ok, negative = 0) { launchViewIntent("6629852208836920709=di?ved/sppa/erots/moc.elgoog.yalp//:sptth".reversed()) } } 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 531cb0ea6..6350822a0 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 @@ -373,14 +373,16 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { else -> getHumanizedFilename(mPath) } - val searchHint = if (mShowAll) { + val searchHint = if (mPath == RECYCLE_BIN) { + getString(R.string.search_in_placeholder, dirName) + } else if (mShowAll) { getString(R.string.search_files) } else { getString(R.string.search_in_placeholder, dirName) } media_menu.updateHintText(searchHint) - if (!mShowAll) { + if (!mShowAll || mPath == RECYCLE_BIN) { media_menu.toggleForceArrowBackIcon(true) media_menu.onNavigateBackClickListener = { onBackPressed() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SplashActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SplashActivity.kt index 9d0c0cc79..e09840bd4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SplashActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SplashActivity.kt @@ -11,7 +11,6 @@ import com.simplemobiletools.gallery.pro.models.Favorite class SplashActivity : BaseSplashActivity() { override fun initActivity() { - // check if previously selected favorite items have been properly migrated into the new Favorites table if (config.wereFavoritesMigrated) { launchActivity() 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 0067953da..b61fa4adf 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,7 +33,8 @@ 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() - val media = if (showAll) { + // make sure "Open Recycle Bin" works even from Show All Folders Content view + val media = if (showAll && mPath != RECYCLE_BIN) { val foldersToScan = mediaFetcher.getFoldersToScan().filter { it != RECYCLE_BIN && it != FAVORITES && !context.config.isFolderProtected(it) } val media = ArrayList() foldersToScan.forEach { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt index 9c248ae6b..73f63eafd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt @@ -77,7 +77,6 @@ class MediaFetcher(val context: Context) { } sortMedia(curMedia, context.config.getFolderSorting(curPath)) - return curMedia }