mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
avoid loading the gallery twice at first launch, caused by permission
This commit is contained in:
parent
a2037bef9f
commit
963fd57113
1 changed files with 23 additions and 20 deletions
|
@ -153,6 +153,14 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
directories_switch_searching.setOnClickListener {
|
||||
launchSearchActivity()
|
||||
}
|
||||
|
||||
// just request the permission, tryLoadGallery will then trigger in onResume
|
||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||
if (!it) {
|
||||
toast(R.string.no_storage_permissions)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
|
@ -431,8 +439,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
}
|
||||
|
||||
private fun tryLoadGallery() {
|
||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||
if (it) {
|
||||
if (hasPermission(PERMISSION_WRITE_STORAGE)) {
|
||||
if (!config.wasUpgradedFromFreeShown && isPackageInstalled("com.simplemobiletools.gallery")) {
|
||||
ConfirmationDialog(this, "", R.string.upgraded_from_free, R.string.ok, 0) {}
|
||||
config.wasUpgradedFromFreeShown = true
|
||||
|
@ -448,10 +455,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
}
|
||||
|
||||
setupLayoutManager()
|
||||
} else {
|
||||
toast(R.string.no_storage_permissions)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue