import android.os.Parcel;
import android.os.Parcelable;
-public class OCFile implements Parcelable {
+public class OCFile implements Parcelable, Comparable<OCFile> {
public static final Parcelable.Creator<OCFile> CREATOR = new Parcelable.Creator<OCFile>() {
@Override
}
@Override
+ public int compareTo(OCFile another) {
+ if (isDirectory() && another.isDirectory()) {
+ return getFileName().toLowerCase().compareTo(another.getFileName().toLowerCase());
+ } else if (isDirectory()) {
+ return -1;
+ } else if (another.isDirectory()) {
+ return 1;
+ }
+ return getFileName().toLowerCase().compareTo(another.getFileName().toLowerCase());
+ }
+
public boolean equals(Object o) {
OCFile that = (OCFile) o;
return this.mId == that.mId;
asString = String.format(asString, new Long(mId), getFileName(), mMimeType, isDownloaded(), mLocalPath, mRemotePath);
return asString;
}
-
-
}