diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index 113de1281..8da857d18 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -835,6 +835,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { handleLockedFolderOpening(path) { success -> if (success) { Intent(this, MediaActivity::class.java).apply { + putExtra(SKIP_AUTHENTICATION, true) putExtra(DIRECTORY, path) handleMediaIntent(this) } 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 5f16757b6..766f4b99f 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 @@ -160,11 +160,15 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { media_empty_text_placeholder_2.setTextColor(getAdjustedPrimaryColor()) if (mMedia.isEmpty() || config.getFolderSorting(mPath) and SORT_BY_RANDOM == 0) { - handleLockedFolderOpening(mPath) { success -> - if (success) { - tryLoadGallery() - } else { - finish() + if (shouldSkipAuthentication()) { + tryLoadGallery() + } else { + handleLockedFolderOpening(mPath) { success -> + if (success) { + tryLoadGallery() + } else { + finish() + } } } } @@ -274,8 +278,8 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { private fun startSlideshow() { if (mMedia.isNotEmpty()) { Intent(this, ViewPagerActivity::class.java).apply { - val item = mMedia.firstOrNull { it is Medium } as? Medium - ?: return + val item = mMedia.firstOrNull { it is Medium } as? Medium ?: return + putExtra(SKIP_AUTHENTICATION, shouldSkipAuthentication()) putExtra(PATH, item.path) putExtra(SHOW_ALL, mShowAll) putExtra(SLIDESHOW_START_ON_ENTER, true) @@ -865,6 +869,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { openPath(path, false, extras) } else { Intent(this, ViewPagerActivity::class.java).apply { + putExtra(SKIP_AUTHENTICATION, shouldSkipAuthentication()) putExtra(PATH, path) putExtra(SHOW_ALL, mShowAll) putExtra(SHOW_FAVORITES, mPath == FAVORITES) @@ -932,6 +937,8 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { } } + private fun shouldSkipAuthentication() = intent.getBooleanExtra(SKIP_AUTHENTICATION, false) + private fun deleteFilteredFiles(filtered: ArrayList) { deleteFiles(filtered) { if (!it) { 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 a492c4e9f..710a6caf9 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 @@ -308,11 +308,15 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View showSystemUI(true) - handleLockedFolderOpening(mPath.getParentPath()) { success -> - if (success) { - initContinue() - } else { - finish() + if (intent.getBooleanExtra(SKIP_AUTHENTICATION, false)) { + initContinue() + } else { + handleLockedFolderOpening(mPath.getParentPath()) { success -> + if (success) { + initContinue() + } else { + finish() + } } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index d6d6abef0..683fbf25e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -132,6 +132,7 @@ const val IS_VIEW_INTENT = "is_view_intent" const val PICKED_PATHS = "picked_paths" const val SHOULD_INIT_FRAGMENT = "should_init_fragment" const val PORTRAIT_PATH = "portrait_path" +const val SKIP_AUTHENTICATION = "skip_authentication" // rotations const val ROTATE_BY_SYSTEM_SETTING = 0