X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/5ae7704ef1a9e40ca0193c303b9185de28f04b2d..e11de332ca2283d15ad313f8cb8ef8a8822aa762:/src/eu/alefzero/owncloud/datamodel/OCFile.java diff --git a/src/eu/alefzero/owncloud/datamodel/OCFile.java b/src/eu/alefzero/owncloud/datamodel/OCFile.java index 9566a193..336f95c3 100644 --- a/src/eu/alefzero/owncloud/datamodel/OCFile.java +++ b/src/eu/alefzero/owncloud/datamodel/OCFile.java @@ -23,7 +23,7 @@ import java.io.File; import android.os.Parcel; import android.os.Parcelable; -public class OCFile implements Parcelable { +public class OCFile implements Parcelable, Comparable { public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { @Override @@ -322,6 +322,17 @@ public class OCFile implements Parcelable { } @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; @@ -333,7 +344,5 @@ public class OCFile implements Parcelable { asString = String.format(asString, new Long(mId), getFileName(), mMimeType, isDownloaded(), mLocalPath, mRemotePath); return asString; } - - }