|
@@ -331,39 +331,11 @@ public class FileStorageUtils {
|
|
|
return files.toArray(returnArray);
|
|
|
}
|
|
|
|
|
|
-// /**
|
|
|
-// * Sorts list by Size
|
|
|
-// * @param sortAscending true: ascending, false: descending
|
|
|
-// */
|
|
|
-// public static Vector<OCFile> sortBySize(Vector<OCFile> files){
|
|
|
-// final Integer val;
|
|
|
-// if (mSortAscending){
|
|
|
-// val = 1;
|
|
|
-// } else {
|
|
|
-// val = -1;
|
|
|
-// }
|
|
|
-//
|
|
|
-// Collections.sort(files, new Comparator<OCFile>() {
|
|
|
-// public int compare(OCFile o1, OCFile o2) {
|
|
|
-// if (o1.isFolder() && o2.isFolder()) {
|
|
|
-// Long obj1 = getFolderSize(new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, o1)));
|
|
|
-// return val * obj1.compareTo(getFolderSize(new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, o2))));
|
|
|
-// }
|
|
|
-// else if (o1.isFolder()) {
|
|
|
-// return -1;
|
|
|
-// } else if (o2.isFolder()) {
|
|
|
-// return 1;
|
|
|
-// } else if (o1.getFileLength() == 0 || o2.getFileLength() == 0){
|
|
|
-// return 0;
|
|
|
-// } else {
|
|
|
-// Long obj1 = o1.getFileLength();
|
|
|
-// return val * obj1.compareTo(o2.getFileLength());
|
|
|
-// }
|
|
|
-// }
|
|
|
-// });
|
|
|
-//
|
|
|
-// return files;
|
|
|
-// }
|
|
|
+ /**
|
|
|
+ * Sorts list by Size
|
|
|
+ */
|
|
|
+ public static Vector<OCFile> sortBySize(Vector<OCFile> files){
|
|
|
+ final int multiplier = mSortAscending ? 1 : -1;
|
|
|
|
|
|
Collections.sort(files, new Comparator<OCFile>() {
|
|
|
public int compare(OCFile o1, OCFile o2) {
|