[Libreoffice-commits] core.git: android/source
Mert Tümer
merttumer7 at gmail.com
Wed Apr 18 23:32:16 UTC 2018
android/source/src/java/org/libreoffice/ui/FileUtilities.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit fc5d185bdb0f27bc6014d47338740f741ac05d21
Author: Mert Tümer <merttumer7 at gmail.com>
Date: Fri Apr 6 13:58:02 2018 +0300
tdf#96795: Use locale-sensitive sorting in Android viewer
Change-Id: I98edec9f57f1bf0576e16a1ba3c0e023d6d0b6ed
Signed-off-by: Mert Tümer <merttumer7 at gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/52494
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/android/source/src/java/org/libreoffice/ui/FileUtilities.java b/android/source/src/java/org/libreoffice/ui/FileUtilities.java
index 422b1e9971cd..44a9ac0b4c2c 100644
--- a/android/source/src/java/org/libreoffice/ui/FileUtilities.java
+++ b/android/source/src/java/org/libreoffice/ui/FileUtilities.java
@@ -13,6 +13,7 @@ import org.libreoffice.storage.IFile;
import java.io.File;
import java.io.FileFilter;
import java.io.FilenameFilter;
+import java.text.Collator;
import java.util.Map;
import java.util.Collections;
import java.util.List;
@@ -204,18 +205,20 @@ public class FileUtilities {
static void sortFiles(List<IFile> files, int sortMode) {
if (files == null)
return;
+ // Compare filenames in the default locale
+ final Collator mCollator = Collator.getInstance();
switch (sortMode) {
case SORT_AZ:
Collections.sort(files , new Comparator<IFile>() {
public int compare(IFile lhs, IFile rhs) {
- return lhs.getName().compareTo(rhs.getName());
+ return mCollator.compare(lhs.getName(), rhs.getName());
}
});
break;
case SORT_ZA:
Collections.sort(files , new Comparator<IFile>() {
public int compare(IFile lhs, IFile rhs) {
- return rhs.getName().compareTo(lhs.getName());
+ return mCollator.compare(rhs.getName(), lhs.getName());
}
});
break;
More information about the Libreoffice-commits
mailing list