From 8ece25d033d0c894da5b7417ed8d3ea5e78dbfa7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 18 Apr 2020 13:09:46 +0200 Subject: [PATCH] properly handle folder locking at shortcuts and widgets --- .../gallery/pro/activities/MediaActivity.kt | 8 +++++++- .../gallery/pro/activities/ViewPagerActivity.kt | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) 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 03db71e21..ca21c8bca 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,7 +160,13 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { media_empty_text_placeholder_2.setTextColor(getAdjustedPrimaryColor()) if (mMedia.isEmpty() || config.getFolderSorting(mPath) and SORT_BY_RANDOM == 0) { - tryLoadGallery() + handleLockedFolderOpening(mPath) { + if (it) { + tryLoadGallery() + } else { + finish() + } + } } } 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 55fc8f6b1..351e4fa71 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 @@ -306,6 +306,18 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View return } + showSystemUI(true) + + handleLockedFolderOpening(mPath.getParentPath()) { + if (it) { + initContinue() + } else { + finish() + } + } + } + + private fun initContinue() { if (intent.extras?.containsKey(IS_VIEW_INTENT) == true) { if (isShowHiddenFlagNeeded()) { if (!config.isHiddenPasswordProtectionOn) { @@ -316,8 +328,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View config.isThirdPartyIntent = true } - showSystemUI(true) - val isShowingFavorites = intent.getBooleanExtra(SHOW_FAVORITES, false) val isShowingRecycleBin = intent.getBooleanExtra(SHOW_RECYCLE_BIN, false) mDirectory = when {