fetch latest media ID at creating the app to avoid duplicate refreshing
This commit is contained in:
parent
6f84478bfa
commit
93ba5d67de
|
@ -96,6 +96,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
}
|
||||
|
||||
mIsPasswordProtectionPending = config.appPasswordProtectionOn
|
||||
setupLatestMediaId()
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
|
@ -553,9 +554,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
|
||||
private fun gotDirectories(newDirs: ArrayList<Directory>, isFromCache: Boolean) {
|
||||
if (!isFromCache) {
|
||||
Thread {
|
||||
mLatestMediaId = getLatestMediaId()
|
||||
}.start()
|
||||
setupLatestMediaId()
|
||||
}
|
||||
|
||||
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 setupLatestMediaId() {
|
||||
Thread {
|
||||
mLatestMediaId = getLatestMediaId()
|
||||
}.start()
|
||||
}
|
||||
|
||||
private fun checkLastMediaChanged() {
|
||||
if (isActivityDestroyed())
|
||||
return
|
||||
|
|
|
@ -113,8 +113,9 @@ class MediaFetcher(val context: Context) {
|
|||
|
||||
private fun getSelectionArgsQuery(path: String): Array<String>? {
|
||||
return if (path.isEmpty()) {
|
||||
if (context.isAndroidFour())
|
||||
if (context.isAndroidFour()) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (context.hasExternalSDCard()) {
|
||||
arrayOf("${context.internalStoragePath}/%", "${context.sdCardPath}/%")
|
||||
|
|
Loading…
Reference in New Issue