diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index fd2d434c3..0aad35229 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -385,7 +385,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View scanFiles(invalidFiles) {} Medium.sorting = mConfig.sorting - Collections.sort(media) + media.sort() var j = 0 for (medium in media) { if (medium.path == mPath) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index e6714318e..49f0e4930 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -76,7 +76,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va val dirs = ArrayList(directories.values) filterDirectories(dirs) Directory.sorting = mConfig.directorySorting - Collections.sort(dirs) + dirs.sort() context.scanFiles(invalidFiles) {} return dirs diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt index 041fbc432..e72d7cad2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt @@ -12,7 +12,7 @@ class Directory(val path: String, val thumbnail: String, val name: String, var m override fun compareTo(other: Directory): Int { var res: Int 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) { res = if (timestamp > other.timestamp) 1 else -1 } else { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt index e474a4ce8..65a195497 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt @@ -17,7 +17,7 @@ class Medium(val name: String, var path: String, val isVideo: Boolean, val times override fun compareTo(other: Medium): Int { var res: Int 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) { res = if (timestamp > other.timestamp) 1 else -1 } else {