diff --git a/app/src/main/kotlin/org/fossify/gallery/App.kt b/app/src/main/kotlin/org/fossify/gallery/App.kt index 2f61925ff..c7dcb0572 100644 --- a/app/src/main/kotlin/org/fossify/gallery/App.kt +++ b/app/src/main/kotlin/org/fossify/gallery/App.kt @@ -1,17 +1,15 @@ package org.fossify.gallery -import android.app.Application import com.github.ajalt.reprint.core.Reprint import com.squareup.picasso.Downloader import com.squareup.picasso.Picasso import okhttp3.Request import okhttp3.Response -import org.fossify.commons.extensions.checkUseEnglish +import org.fossify.commons.FossifyApp -class App : Application() { +class App : FossifyApp() { override fun onCreate() { super.onCreate() - checkUseEnglish() Reprint.initialize(this) Picasso.setSingletonInstance(Picasso.Builder(this).downloader(object : Downloader { override fun load(request: Request) = Response.Builder().build() diff --git a/app/src/main/kotlin/org/fossify/gallery/activities/MainActivity.kt b/app/src/main/kotlin/org/fossify/gallery/activities/MainActivity.kt index b4f5b1777..cce6e5d80 100644 --- a/app/src/main/kotlin/org/fossify/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/org/fossify/gallery/activities/MainActivity.kt @@ -57,12 +57,9 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { private var mIsThirdPartyIntent = false private var mIsGettingDirs = false private var mLoadedInitialPhotos = false - private var mIsPasswordProtectionPending = false - private var mWasProtectionHandled = false private var mShouldStopFetching = false private var mWasDefaultFolderChecked = false private var mWasMediaManagementPromptShown = false - private var mWasUpgradedFromFreeShown = false private var mLatestMediaId = 0L private var mLatestMediaDateId = 0L private var mCurrentPathPrefix = "" // used at "Group direct subfolders" for navigation @@ -123,8 +120,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { binding.directoriesRefreshLayout.setOnRefreshListener { getDirectories() } storeStateVariables() checkWhatsNewDialog() - - mIsPasswordProtectionPending = config.isAppPasswordProtectionOn setupLatestMediaId() if (!config.wereFavoritesPinned) { @@ -228,19 +223,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { if (!binding.mainMenu.isSearchOpen) { refreshMenuItems() - if (mIsPasswordProtectionPending && !mWasProtectionHandled) { - handleAppPasswordProtection { - mWasProtectionHandled = it - if (it) { - mIsPasswordProtectionPending = false - tryLoadGallery() - } else { - finish() - } - } - } else { - tryLoadGallery() - } + tryLoadGallery() } if (config.searchAllFilesByDefault) { @@ -303,6 +286,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { setupAdapter(mDirs) } } else { + appLockManager.lock() super.onBackPressed() } } @@ -404,16 +388,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { } } - override fun onSaveInstanceState(outState: Bundle) { - super.onSaveInstanceState(outState) - outState.putBoolean(WAS_PROTECTION_HANDLED, mWasProtectionHandled) - } - - override fun onRestoreInstanceState(savedInstanceState: Bundle) { - super.onRestoreInstanceState(savedInstanceState) - mWasProtectionHandled = savedInstanceState.getBoolean(WAS_PROTECTION_HANDLED, false) - } - private fun updateMenuColors() { updateStatusbarColor(getProperBackgroundColor()) binding.mainMenu.updateColors() diff --git a/app/src/main/kotlin/org/fossify/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/org/fossify/gallery/activities/MediaActivity.kt index 3edfb3692..2298d314b 100644 --- a/app/src/main/kotlin/org/fossify/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/org/fossify/gallery/activities/MediaActivity.kt @@ -50,7 +50,6 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { private var mShowAll = false private var mLoadedInitialPhotos = false private var mWasFullscreenViewOpen = false - private var mWasUpgradedFromFreeShown = false private var mLastSearchedText = "" private var mLatestMediaId = 0L private var mLatestMediaDateId = 0L @@ -229,6 +228,10 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { if (binding.mediaMenu.isSearchOpen) { binding.mediaMenu.closeSearch() } else { + if (config.showAll) { + appLockManager.lock() + } + super.onBackPressed() } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c34496f76..0a47f23b7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,7 +11,7 @@ exif = "1.0.1" #Room room = "2.6.1" #Fossify -commons = "e40963a843" +commons = "45f8e23a33" #Gradle4 gradlePlugins-agp = "8.5.0" #Other