check latest media date id too at fetching new files
This commit is contained in:
parent
64b4fdece3
commit
e6b11a80b1
3 changed files with 11 additions and 3 deletions
|
@ -46,7 +46,7 @@ ext {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:3.16.1'
|
||||
implementation 'com.simplemobiletools:commons:3.16.2'
|
||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
|
||||
implementation 'com.android.support:multidex:1.0.3'
|
||||
implementation 'com.google.code.gson:gson:2.8.2'
|
||||
|
|
|
@ -61,6 +61,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
private var mLoadedInitialPhotos = false
|
||||
private var mIsPasswordProtectionPending = false
|
||||
private var mLatestMediaId = 0L
|
||||
private var mLatestMediaDateId = 0L
|
||||
private var mLastMediaHandler = Handler()
|
||||
private var mTempShowHiddenHandler = Handler()
|
||||
private var mCurrAsyncTask: GetDirectoriesAsynctask? = null
|
||||
|
@ -653,6 +654,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
Thread {
|
||||
if (hasPermission(PERMISSION_READ_STORAGE)) {
|
||||
mLatestMediaId = getLatestMediaId()
|
||||
mLatestMediaDateId = getLatestMediaByDateId()
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
@ -666,8 +668,10 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
mLastMediaHandler.postDelayed({
|
||||
Thread {
|
||||
val mediaId = getLatestMediaId()
|
||||
if (mLatestMediaId != mediaId) {
|
||||
val mediaDateId = getLatestMediaByDateId()
|
||||
if (mLatestMediaId != mediaId || mLatestMediaDateId != mediaDateId) {
|
||||
mLatestMediaId = mediaId
|
||||
mLatestMediaDateId = mediaDateId
|
||||
runOnUiThread {
|
||||
getDirectories()
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
private var mLoadedInitialPhotos = false
|
||||
private var mIsSearchOpen = false
|
||||
private var mLatestMediaId = 0L
|
||||
private var mLatestMediaDateId = 0L
|
||||
private var mLastMediaHandler = Handler()
|
||||
private var mTempShowHiddenHandler = Handler()
|
||||
private var mCurrAsyncTask: GetMediaAsynctask? = null
|
||||
|
@ -359,8 +360,10 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
mLastMediaHandler.postDelayed({
|
||||
Thread {
|
||||
val mediaId = getLatestMediaId()
|
||||
if (mLatestMediaId != mediaId) {
|
||||
val mediaDateId = getLatestMediaByDateId()
|
||||
if (mLatestMediaId != mediaId || mLatestMediaDateId != mediaDateId) {
|
||||
mLatestMediaId = mediaId
|
||||
mLatestMediaDateId = mediaDateId
|
||||
runOnUiThread {
|
||||
getMedia()
|
||||
}
|
||||
|
@ -632,6 +635,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
private fun gotMedia(media: ArrayList<Medium>, isFromCache: Boolean = false) {
|
||||
Thread {
|
||||
mLatestMediaId = getLatestMediaId()
|
||||
mLatestMediaDateId = getLatestMediaByDateId()
|
||||
}.start()
|
||||
|
||||
mIsGettingMedia = false
|
||||
|
|
Loading…
Reference in a new issue