mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
fetch latest media ID at creating the app to avoid duplicate refreshing
This commit is contained in:
parent
6f84478bfa
commit
93ba5d67de
2 changed files with 10 additions and 4 deletions
|
@ -96,6 +96,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
mIsPasswordProtectionPending = config.appPasswordProtectionOn
|
mIsPasswordProtectionPending = config.appPasswordProtectionOn
|
||||||
|
setupLatestMediaId()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
|
@ -553,9 +554,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
|
|
||||||
private fun gotDirectories(newDirs: ArrayList<Directory>, isFromCache: Boolean) {
|
private fun gotDirectories(newDirs: ArrayList<Directory>, isFromCache: Boolean) {
|
||||||
if (!isFromCache) {
|
if (!isFromCache) {
|
||||||
Thread {
|
setupLatestMediaId()
|
||||||
mLatestMediaId = getLatestMediaId()
|
|
||||||
}.start()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val dirs = getSortedDirectories(newDirs)
|
val dirs = getSortedDirectories(newDirs)
|
||||||
|
@ -633,6 +632,12 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
|
|
||||||
private fun getBubbleTextItem(index: Int) = getRecyclerAdapter().dirs.getOrNull(index)?.getBubbleText() ?: ""
|
private fun getBubbleTextItem(index: Int) = getRecyclerAdapter().dirs.getOrNull(index)?.getBubbleText() ?: ""
|
||||||
|
|
||||||
|
private fun setupLatestMediaId() {
|
||||||
|
Thread {
|
||||||
|
mLatestMediaId = getLatestMediaId()
|
||||||
|
}.start()
|
||||||
|
}
|
||||||
|
|
||||||
private fun checkLastMediaChanged() {
|
private fun checkLastMediaChanged() {
|
||||||
if (isActivityDestroyed())
|
if (isActivityDestroyed())
|
||||||
return
|
return
|
||||||
|
|
|
@ -113,8 +113,9 @@ class MediaFetcher(val context: Context) {
|
||||||
|
|
||||||
private fun getSelectionArgsQuery(path: String): Array<String>? {
|
private fun getSelectionArgsQuery(path: String): Array<String>? {
|
||||||
return if (path.isEmpty()) {
|
return if (path.isEmpty()) {
|
||||||
if (context.isAndroidFour())
|
if (context.isAndroidFour()) {
|
||||||
return null
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
if (context.hasExternalSDCard()) {
|
if (context.hasExternalSDCard()) {
|
||||||
arrayOf("${context.internalStoragePath}/%", "${context.sdCardPath}/%")
|
arrayOf("${context.internalStoragePath}/%", "${context.sdCardPath}/%")
|
||||||
|
|
Loading…
Reference in a new issue