fix directory sorting
This commit is contained in:
parent
9ebdb40d30
commit
a2f1512588
3 changed files with 10 additions and 8 deletions
|
@ -48,6 +48,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
private var mIsGettingDirs = false
|
||||
private var mStoredAnimateGifs = true
|
||||
private var mStoredCropThumbnails = true
|
||||
private var mLoadedInitialPhotos = false
|
||||
|
||||
private var mCurrAsyncTask: GetDirectoriesAsynctask? = null
|
||||
|
||||
|
@ -165,11 +166,13 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
val dirs = Gson().fromJson<ArrayList<Directory>>(config.directories, token) ?: ArrayList<Directory>(1)
|
||||
if (dirs.size == 0) {
|
||||
directories_refresh_layout.isRefreshing = true
|
||||
} else {
|
||||
} else if (!mLoadedInitialPhotos) {
|
||||
mLoadedInitialPhotos = true
|
||||
gotDirectories(dirs)
|
||||
return
|
||||
}
|
||||
|
||||
mLoadedInitialPhotos = true
|
||||
mCurrAsyncTask = GetDirectoriesAsynctask(applicationContext, mIsPickVideoIntent || mIsGetVideoContentIntent, mIsPickImageIntent || mIsGetImageContentIntent) {
|
||||
gotDirectories(it)
|
||||
}
|
||||
|
|
|
@ -217,18 +217,17 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
return
|
||||
|
||||
mIsGettingMedia = true
|
||||
mLoadedInitialPhotos = true
|
||||
val token = object : TypeToken<List<Medium>>() {}.type
|
||||
val media = Gson().fromJson<ArrayList<Medium>>(config.loadFolderMedia(mPath), token) ?: ArrayList<Medium>(1)
|
||||
if (media.size == 0) {
|
||||
media_refresh_layout.isRefreshing = true
|
||||
} else {
|
||||
if (!mLoadedInitialPhotos) {
|
||||
gotMedia(media)
|
||||
return
|
||||
}
|
||||
} else if (!mLoadedInitialPhotos) {
|
||||
mLoadedInitialPhotos = true
|
||||
gotMedia(media)
|
||||
return
|
||||
}
|
||||
|
||||
mLoadedInitialPhotos = true
|
||||
mCurrAsyncTask = GetMediaAsynctask(applicationContext, mPath, mIsGetVideoIntent, mIsGetImageIntent, mShowAll) {
|
||||
gotMedia(it)
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.io.Serializable
|
|||
data class Directory(val path: String, val thumbnail: String, val name: String, var mediaCnt: Int, val date_modified: Long, val date_taken: Long,
|
||||
var size: Long) : Serializable, Comparable<Directory> {
|
||||
companion object {
|
||||
private val serialVersionUID = -6553649863575455L
|
||||
private val serialVersionUID = -6553345863575455L
|
||||
var sorting: Int = 0
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue