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
private String mLocalPath;
private String mMimeType;
private boolean mNeedsUpdating;
+ private long mLastSyncDate;
/**
* Create new {@link OCFile} with given path
mLength = 0;
mCreationTimestamp = 0;
mModifiedTimestamp = 0;
+ mLastSyncDate = 0;
}
/**
public boolean needsUpdatingWhileSaving() {
return mNeedsUpdating;
}
+
+ public long getLastSyncDate() {
+ return mLastSyncDate;
+ }
+
+ public void setLastSyncDate(long lastSyncDate) {
+ mLastSyncDate = lastSyncDate;
+ }
@Override
public int describeContents() {
dest.writeString(mRemotePath);
dest.writeString(mLocalPath);
dest.writeString(mMimeType);
- dest.writeInt(mNeedsUpdating ? 0 : 1); // No writeBoolean method exists
- // - yay :D
+ dest.writeInt(mNeedsUpdating ? 1 : 0);
+ dest.writeLong(mLastSyncDate);
+ }
+
+ @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());
}
}