mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-06-05 21:59:19 +02:00
avoid fetching the files multiple times at first launch
This commit is contained in:
@ -434,7 +434,13 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun tryLoadGallery() {
|
private fun tryLoadGallery() {
|
||||||
|
// avoid calling anything right after granting the permission, it will be called from onResume()
|
||||||
|
val wasMissingPermission = config.appRunCount == 1 && !hasPermission(PERMISSION_WRITE_STORAGE)
|
||||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||||
|
if (wasMissingPermission) {
|
||||||
|
return@handlePermission
|
||||||
|
}
|
||||||
|
|
||||||
if (it) {
|
if (it) {
|
||||||
if (!mWasDefaultFolderChecked) {
|
if (!mWasDefaultFolderChecked) {
|
||||||
openDefaultFolder()
|
openDefaultFolder()
|
||||||
@ -1068,7 +1074,9 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mLoadedInitialPhotos = true
|
mLoadedInitialPhotos = true
|
||||||
|
if (config.appRunCount > 1) {
|
||||||
checkLastMediaChanged()
|
checkLastMediaChanged()
|
||||||
|
}
|
||||||
|
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
directories_refresh_layout.isRefreshing = false
|
directories_refresh_layout.isRefreshing = false
|
||||||
|
Reference in New Issue
Block a user