@@ -18,8 +18,48 @@ import com.stericson.RootTools.RootTools
1818import me.grantland.widget.AutofitHelper
1919import org.fossify.commons.dialogs.ConfirmationAdvancedDialog
2020import org.fossify.commons.dialogs.RadioGroupDialog
21- import org.fossify.commons.extensions.*
22- import org.fossify.commons.helpers.*
21+ import org.fossify.commons.extensions.appLaunched
22+ import org.fossify.commons.extensions.appLockManager
23+ import org.fossify.commons.extensions.beGoneIf
24+ import org.fossify.commons.extensions.checkWhatsNew
25+ import org.fossify.commons.extensions.getBottomNavigationBackgroundColor
26+ import org.fossify.commons.extensions.getColoredDrawableWithColor
27+ import org.fossify.commons.extensions.getFilePublicUri
28+ import org.fossify.commons.extensions.getMimeType
29+ import org.fossify.commons.extensions.getProperBackgroundColor
30+ import org.fossify.commons.extensions.getProperTextColor
31+ import org.fossify.commons.extensions.getRealPathFromURI
32+ import org.fossify.commons.extensions.getStorageDirectories
33+ import org.fossify.commons.extensions.getTimeFormat
34+ import org.fossify.commons.extensions.handleHiddenFolderPasswordProtection
35+ import org.fossify.commons.extensions.hasOTGConnected
36+ import org.fossify.commons.extensions.hasPermission
37+ import org.fossify.commons.extensions.hideKeyboard
38+ import org.fossify.commons.extensions.humanizePath
39+ import org.fossify.commons.extensions.internalStoragePath
40+ import org.fossify.commons.extensions.isPathOnOTG
41+ import org.fossify.commons.extensions.isPathOnSD
42+ import org.fossify.commons.extensions.launchMoreAppsFromUsIntent
43+ import org.fossify.commons.extensions.onGlobalLayout
44+ import org.fossify.commons.extensions.onTabSelectionChanged
45+ import org.fossify.commons.extensions.sdCardPath
46+ import org.fossify.commons.extensions.showErrorToast
47+ import org.fossify.commons.extensions.toast
48+ import org.fossify.commons.extensions.updateBottomTabItemColors
49+ import org.fossify.commons.extensions.viewBinding
50+ import org.fossify.commons.helpers.LICENSE_AUTOFITTEXTVIEW
51+ import org.fossify.commons.helpers.LICENSE_GESTURE_VIEWS
52+ import org.fossify.commons.helpers.LICENSE_GLIDE
53+ import org.fossify.commons.helpers.LICENSE_PATTERN
54+ import org.fossify.commons.helpers.LICENSE_REPRINT
55+ import org.fossify.commons.helpers.LICENSE_ZIP4J
56+ import org.fossify.commons.helpers.PERMISSION_WRITE_STORAGE
57+ import org.fossify.commons.helpers.TAB_FILES
58+ import org.fossify.commons.helpers.TAB_RECENT_FILES
59+ import org.fossify.commons.helpers.TAB_STORAGE_ANALYSIS
60+ import org.fossify.commons.helpers.VIEW_TYPE_GRID
61+ import org.fossify.commons.helpers.ensureBackgroundThread
62+ import org.fossify.commons.helpers.isRPlus
2363import org.fossify.commons.models.FAQItem
2464import org.fossify.commons.models.RadioItem
2565import org.fossify.commons.models.Release
@@ -51,8 +91,6 @@ class MainActivity : SimpleActivity() {
5191 private val binding by viewBinding(ActivityMainBinding ::inflate)
5292
5393 private var wasBackJustPressed = false
54- private var mIsPasswordProtectionPending = false
55- private var mWasProtectionHandled = false
5694 private var mTabsToShow = ArrayList <Int >()
5795
5896 private var mStoredFontSize = 0
@@ -69,7 +107,7 @@ class MainActivity : SimpleActivity() {
69107 refreshMenuItems()
70108 mTabsToShow = getTabsList()
71109
72- if (! config.wasStorageAnalysisTabAdded && isOreoPlus() ) {
110+ if (! config.wasStorageAnalysisTabAdded) {
73111 config.wasStorageAnalysisTabAdded = true
74112 if (config.showTabs and TAB_STORAGE_ANALYSIS == 0 ) {
75113 config.showTabs + = TAB_STORAGE_ANALYSIS
@@ -81,22 +119,12 @@ class MainActivity : SimpleActivity() {
81119
82120 updateMaterialActivityViews(binding.mainCoordinator, null , useTransparentNavigation = false , useTopSearchMenu = true )
83121
84- mIsPasswordProtectionPending = config.isAppPasswordProtectionOn
85-
86122 if (savedInstanceState == null ) {
87- handleAppPasswordProtection {
88- mWasProtectionHandled = it
89- if (it) {
90- initFragments()
91- mIsPasswordProtectionPending = false
92- tryInitFileManager()
93- checkWhatsNewDialog()
94- checkIfRootAvailable()
95- checkInvalidFavorites()
96- } else {
97- finish()
98- }
99- }
123+ initFragments()
124+ tryInitFileManager()
125+ checkWhatsNewDialog()
126+ checkIfRootAvailable()
127+ checkInvalidFavorites()
100128 }
101129 }
102130
@@ -128,7 +156,7 @@ class MainActivity : SimpleActivity() {
128156 }
129157 }
130158
131- if (binding.mainViewPager.adapter == null && mWasProtectionHandled ) {
159+ if (binding.mainViewPager.adapter == null ) {
132160 initFragments()
133161 }
134162 }
@@ -158,6 +186,7 @@ class MainActivity : SimpleActivity() {
158186 wasBackJustPressed = false
159187 }, BACK_PRESS_TIMEOUT .toLong())
160188 } else {
189+ appLockManager.lock()
161190 finish()
162191 }
163192 } else {
@@ -241,20 +270,18 @@ class MainActivity : SimpleActivity() {
241270 override fun onSaveInstanceState (outState : Bundle ) {
242271 super .onSaveInstanceState(outState)
243272 outState.putString(PICKED_PATH , getItemsFragment()?.currentPath ? : " " )
244- outState.putBoolean(WAS_PROTECTION_HANDLED , mWasProtectionHandled)
245273 }
246274
247275 override fun onRestoreInstanceState (savedInstanceState : Bundle ) {
248276 super .onRestoreInstanceState(savedInstanceState)
249- mWasProtectionHandled = savedInstanceState.getBoolean(WAS_PROTECTION_HANDLED , false )
250277 val path = savedInstanceState.getString(PICKED_PATH ) ? : internalStoragePath
251278
252279 if (binding.mainViewPager.adapter == null ) {
253280 binding.mainViewPager.onGlobalLayout {
254- restorePath (path)
281+ openPath (path, true )
255282 }
256283 } else {
257- restorePath (path)
284+ openPath (path, true )
258285 }
259286 }
260287
@@ -267,22 +294,6 @@ class MainActivity : SimpleActivity() {
267294 }
268295 }
269296
270- private fun restorePath (path : String ) {
271- if (! mWasProtectionHandled) {
272- handleAppPasswordProtection {
273- mWasProtectionHandled = it
274- if (it) {
275- mIsPasswordProtectionPending = false
276- openPath(path, true )
277- } else {
278- finish()
279- }
280- }
281- } else {
282- openPath(path, true )
283- }
284- }
285-
286297 private fun updateMenuColors () {
287298 updateStatusbarColor(getProperBackgroundColor())
288299 binding.mainMenu.updateColors()
@@ -494,10 +505,6 @@ class MainActivity : SimpleActivity() {
494505 }
495506
496507 private fun openPath (path : String , forceRefresh : Boolean = false) {
497- if (mIsPasswordProtectionPending && ! mWasProtectionHandled) {
498- return
499- }
500-
501508 var newPath = path
502509 val file = File (path)
503510 if (config.OTGPath .isNotEmpty() && config.OTGPath == path.trimEnd(' /' )) {
0 commit comments