mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
avoid fetching the files multiple times at first launch
This commit is contained in:
parent
79f30475c6
commit
2634e09f7f
1 changed files with 9 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue