Loading res/values/arrays.xml +2 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ <item>@string/sort_by_date_desc</item> <item>@string/sort_by_size_asc</item> <item>@string/sort_by_size_desc</item> <item>@string/sort_by_type_asc</item> <item>@string/sort_by_type_desc</item> </string-array> <!-- The strings of the menu for navigation layout mode enumeration --> Loading res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -184,6 +184,10 @@ <string name="sort_by_size_asc">By size \u25B2</string> <!-- Navigation View - Sort - Sort by size (descending) --> <string name="sort_by_size_desc">By size \u25BC</string> <!-- Navigation View - Sort - Sort by type (ascending) --> <string name="sort_by_type_asc">By type \u25B2</string> <!-- Navigation View - Sort - Sort by type (descending) --> <string name="sort_by_type_desc">By type \u25BC</string> <!-- Navigation View - Layout - Icons --> <string name="layout_icons">Icons</string> Loading src/com/cyanogenmod/filemanager/preferences/NavigationSortMode.java +9 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,15 @@ public enum NavigationSortMode implements ObjectIdentifier { /** * That mode sorts objects by size (descending). */ SIZE_DESC(5); SIZE_DESC(5), /** * That mode sorts objects by type (ascending). */ TYPE_ASC(6), /** * That mode sorts objects by type (descending). */ TYPE_DESC(7); private int mId; Loading src/com/cyanogenmod/filemanager/util/FileHelper.java +11 −0 Original line number Diff line number Diff line Loading @@ -785,6 +785,17 @@ public final class FileHelper { return Long.compare(fso1.getSize(), fso2.getSize()) * -1; } //Type (ascending) if (mode.getId() == NavigationSortMode.TYPE_ASC.getId()) { // Shouldn't need context here, mimetypes should be loaded return MimeTypeHelper.compareFSO(null, fso1, fso2); } //Type (descending) if (mode.getId() == NavigationSortMode.TYPE_DESC.getId()) { // Shouldn't need context here, mimetypes should be loaded return MimeTypeHelper.compareFSO(null, fso1, fso2) * -1; } //Comparison between files directly return fso1.compareTo(fso2); } Loading src/com/cyanogenmod/filemanager/util/MimeTypeHelper.java +16 −0 Original line number Diff line number Diff line Loading @@ -336,6 +336,22 @@ public final class MimeTypeHelper { return getMimeTypeFromExtension(fso); } /** * Method that compares {@link FileSystemObject} by MimeTypeCategory * * @param context The current context * @param fso1 File system object 1 * @param fso2 File system object 2 * @return int Either -1, 0, 1 based on if fso1 appears before or after fso2 */ public static final int compareFSO(Context context, FileSystemObject fso1, FileSystemObject fso2) { MimeTypeCategory mtc1 = getCategory(context, fso1); MimeTypeCategory mtc2 = getCategory(context, fso2); return mtc1.compareTo(mtc2); } /** * Method that returns the mime/type description of the {@link FileSystemObject}. * Loading Loading
res/values/arrays.xml +2 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ <item>@string/sort_by_date_desc</item> <item>@string/sort_by_size_asc</item> <item>@string/sort_by_size_desc</item> <item>@string/sort_by_type_asc</item> <item>@string/sort_by_type_desc</item> </string-array> <!-- The strings of the menu for navigation layout mode enumeration --> Loading
res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -184,6 +184,10 @@ <string name="sort_by_size_asc">By size \u25B2</string> <!-- Navigation View - Sort - Sort by size (descending) --> <string name="sort_by_size_desc">By size \u25BC</string> <!-- Navigation View - Sort - Sort by type (ascending) --> <string name="sort_by_type_asc">By type \u25B2</string> <!-- Navigation View - Sort - Sort by type (descending) --> <string name="sort_by_type_desc">By type \u25BC</string> <!-- Navigation View - Layout - Icons --> <string name="layout_icons">Icons</string> Loading
src/com/cyanogenmod/filemanager/preferences/NavigationSortMode.java +9 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,15 @@ public enum NavigationSortMode implements ObjectIdentifier { /** * That mode sorts objects by size (descending). */ SIZE_DESC(5); SIZE_DESC(5), /** * That mode sorts objects by type (ascending). */ TYPE_ASC(6), /** * That mode sorts objects by type (descending). */ TYPE_DESC(7); private int mId; Loading
src/com/cyanogenmod/filemanager/util/FileHelper.java +11 −0 Original line number Diff line number Diff line Loading @@ -785,6 +785,17 @@ public final class FileHelper { return Long.compare(fso1.getSize(), fso2.getSize()) * -1; } //Type (ascending) if (mode.getId() == NavigationSortMode.TYPE_ASC.getId()) { // Shouldn't need context here, mimetypes should be loaded return MimeTypeHelper.compareFSO(null, fso1, fso2); } //Type (descending) if (mode.getId() == NavigationSortMode.TYPE_DESC.getId()) { // Shouldn't need context here, mimetypes should be loaded return MimeTypeHelper.compareFSO(null, fso1, fso2) * -1; } //Comparison between files directly return fso1.compareTo(fso2); } Loading
src/com/cyanogenmod/filemanager/util/MimeTypeHelper.java +16 −0 Original line number Diff line number Diff line Loading @@ -336,6 +336,22 @@ public final class MimeTypeHelper { return getMimeTypeFromExtension(fso); } /** * Method that compares {@link FileSystemObject} by MimeTypeCategory * * @param context The current context * @param fso1 File system object 1 * @param fso2 File system object 2 * @return int Either -1, 0, 1 based on if fso1 appears before or after fso2 */ public static final int compareFSO(Context context, FileSystemObject fso1, FileSystemObject fso2) { MimeTypeCategory mtc1 = getCategory(context, fso1); MimeTypeCategory mtc2 = getCategory(context, fso2); return mtc1.compareTo(mtc2); } /** * Method that returns the mime/type description of the {@link FileSystemObject}. * Loading