mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
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 mIsGettingDirs = false
|
||||||
private var mStoredAnimateGifs = true
|
private var mStoredAnimateGifs = true
|
||||||
private var mStoredCropThumbnails = true
|
private var mStoredCropThumbnails = true
|
||||||
|
private var mLoadedInitialPhotos = false
|
||||||
|
|
||||||
private var mCurrAsyncTask: GetDirectoriesAsynctask? = null
|
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)
|
val dirs = Gson().fromJson<ArrayList<Directory>>(config.directories, token) ?: ArrayList<Directory>(1)
|
||||||
if (dirs.size == 0) {
|
if (dirs.size == 0) {
|
||||||
directories_refresh_layout.isRefreshing = true
|
directories_refresh_layout.isRefreshing = true
|
||||||
} else {
|
} else if (!mLoadedInitialPhotos) {
|
||||||
|
mLoadedInitialPhotos = true
|
||||||
gotDirectories(dirs)
|
gotDirectories(dirs)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mLoadedInitialPhotos = true
|
||||||
mCurrAsyncTask = GetDirectoriesAsynctask(applicationContext, mIsPickVideoIntent || mIsGetVideoContentIntent, mIsPickImageIntent || mIsGetImageContentIntent) {
|
mCurrAsyncTask = GetDirectoriesAsynctask(applicationContext, mIsPickVideoIntent || mIsGetVideoContentIntent, mIsPickImageIntent || mIsGetImageContentIntent) {
|
||||||
gotDirectories(it)
|
gotDirectories(it)
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,18 +217,17 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
return
|
return
|
||||||
|
|
||||||
mIsGettingMedia = true
|
mIsGettingMedia = true
|
||||||
mLoadedInitialPhotos = true
|
|
||||||
val token = object : TypeToken<List<Medium>>() {}.type
|
val token = object : TypeToken<List<Medium>>() {}.type
|
||||||
val media = Gson().fromJson<ArrayList<Medium>>(config.loadFolderMedia(mPath), token) ?: ArrayList<Medium>(1)
|
val media = Gson().fromJson<ArrayList<Medium>>(config.loadFolderMedia(mPath), token) ?: ArrayList<Medium>(1)
|
||||||
if (media.size == 0) {
|
if (media.size == 0) {
|
||||||
media_refresh_layout.isRefreshing = true
|
media_refresh_layout.isRefreshing = true
|
||||||
} else {
|
} else if (!mLoadedInitialPhotos) {
|
||||||
if (!mLoadedInitialPhotos) {
|
mLoadedInitialPhotos = true
|
||||||
gotMedia(media)
|
gotMedia(media)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
mLoadedInitialPhotos = true
|
||||||
mCurrAsyncTask = GetMediaAsynctask(applicationContext, mPath, mIsGetVideoIntent, mIsGetImageIntent, mShowAll) {
|
mCurrAsyncTask = GetMediaAsynctask(applicationContext, mPath, mIsGetVideoIntent, mIsGetImageIntent, mShowAll) {
|
||||||
gotMedia(it)
|
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,
|
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> {
|
var size: Long) : Serializable, Comparable<Directory> {
|
||||||
companion object {
|
companion object {
|
||||||
private val serialVersionUID = -6553649863575455L
|
private val serialVersionUID = -6553345863575455L
|
||||||
var sorting: Int = 0
|
var sorting: Int = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue