diff options
author | Mert Tümer <merttumer7@gmail.com> | 2018-04-06 13:58:02 +0300 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-04-19 01:31:20 +0200 |
commit | fc5d185bdb0f27bc6014d47338740f741ac05d21 (patch) | |
tree | 39f6faf0b5d87c390c43c19d50fb2b81ee40030b /android | |
parent | 726f856147a33e2231e104501bdc7bbbb87b97e9 (diff) |
tdf#96795: Use locale-sensitive sorting in Android viewer
Change-Id: I98edec9f57f1bf0576e16a1ba3c0e023d6d0b6ed
Signed-off-by: Mert Tümer <merttumer7@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/52494
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'android')
-rw-r--r-- | android/source/src/java/org/libreoffice/ui/FileUtilities.java | 7 |
1 files changed, 5 insertions, 2 deletions
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; |