mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-02-01 12:06:43 +01:00
avoid loading the gallery twice at first launch, caused by permission
This commit is contained in:
parent
a2037bef9f
commit
963fd57113
@ -153,6 +153,14 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||||||
directories_switch_searching.setOnClickListener {
|
directories_switch_searching.setOnClickListener {
|
||||||
launchSearchActivity()
|
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() {
|
override fun onStart() {
|
||||||
@ -431,27 +439,22 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun tryLoadGallery() {
|
private fun tryLoadGallery() {
|
||||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
if (hasPermission(PERMISSION_WRITE_STORAGE)) {
|
||||||
if (it) {
|
if (!config.wasUpgradedFromFreeShown && isPackageInstalled("com.simplemobiletools.gallery")) {
|
||||||
if (!config.wasUpgradedFromFreeShown && isPackageInstalled("com.simplemobiletools.gallery")) {
|
ConfirmationDialog(this, "", R.string.upgraded_from_free, R.string.ok, 0) {}
|
||||||
ConfirmationDialog(this, "", R.string.upgraded_from_free, R.string.ok, 0) {}
|
config.wasUpgradedFromFreeShown = true
|
||||||
config.wasUpgradedFromFreeShown = true
|
|
||||||
}
|
|
||||||
|
|
||||||
checkOTGPath()
|
|
||||||
checkDefaultSpamFolders()
|
|
||||||
|
|
||||||
if (config.showAll) {
|
|
||||||
showAllMedia()
|
|
||||||
} else {
|
|
||||||
getDirectories()
|
|
||||||
}
|
|
||||||
|
|
||||||
setupLayoutManager()
|
|
||||||
} else {
|
|
||||||
toast(R.string.no_storage_permissions)
|
|
||||||
finish()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkOTGPath()
|
||||||
|
checkDefaultSpamFolders()
|
||||||
|
|
||||||
|
if (config.showAll) {
|
||||||
|
showAllMedia()
|
||||||
|
} else {
|
||||||
|
getDirectories()
|
||||||
|
}
|
||||||
|
|
||||||
|
setupLayoutManager()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user