fix Directory and media sorting

This commit is contained in:
tibbi 2016-11-17 17:05:43 +01:00
parent fa4cadebb4
commit e5f9ea9627
4 changed files with 4 additions and 4 deletions

View file

@ -385,7 +385,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
scanFiles(invalidFiles) {} scanFiles(invalidFiles) {}
Medium.sorting = mConfig.sorting Medium.sorting = mConfig.sorting
Collections.sort(media) media.sort()
var j = 0 var j = 0
for (medium in media) { for (medium in media) {
if (medium.path == mPath) { if (medium.path == mPath) {

View file

@ -76,7 +76,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
val dirs = ArrayList(directories.values) val dirs = ArrayList(directories.values)
filterDirectories(dirs) filterDirectories(dirs)
Directory.sorting = mConfig.directorySorting Directory.sorting = mConfig.directorySorting
Collections.sort<Directory>(dirs) dirs.sort()
context.scanFiles(invalidFiles) {} context.scanFiles(invalidFiles) {}
return dirs return dirs

View file

@ -12,7 +12,7 @@ class Directory(val path: String, val thumbnail: String, val name: String, var m
override fun compareTo(other: Directory): Int { override fun compareTo(other: Directory): Int {
var res: Int var res: Int
if (sorting and SORT_BY_NAME != 0) { if (sorting and SORT_BY_NAME != 0) {
res = path.compareTo(other.path) res = name.toLowerCase().compareTo(other.name.toLowerCase())
} else if (sorting and SORT_BY_DATE != 0) { } else if (sorting and SORT_BY_DATE != 0) {
res = if (timestamp > other.timestamp) 1 else -1 res = if (timestamp > other.timestamp) 1 else -1
} else { } else {

View file

@ -17,7 +17,7 @@ class Medium(val name: String, var path: String, val isVideo: Boolean, val times
override fun compareTo(other: Medium): Int { override fun compareTo(other: Medium): Int {
var res: Int var res: Int
if (sorting and SORT_BY_NAME != 0) { if (sorting and SORT_BY_NAME != 0) {
res = path.compareTo(other.path) res = name.toLowerCase().compareTo(other.name.toLowerCase())
} else if (sorting and SORT_BY_DATE != 0) { } else if (sorting and SORT_BY_DATE != 0) {
res = if (timestamp > other.timestamp) 1 else -1 res = if (timestamp > other.timestamp) 1 else -1
} else { } else {