X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/ad8dbb31af7e8fcdc1281ba4f0091913b17adc6a..5ae7704ef1a9e40ca0193c303b9185de28f04b2d:/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 e2cebcfc..9566a193 100644 --- a/src/eu/alefzero/owncloud/datamodel/OCFile.java +++ b/src/eu/alefzero/owncloud/datamodel/OCFile.java @@ -46,6 +46,7 @@ public class OCFile implements Parcelable { private String mLocalPath; private String mMimeType; private boolean mNeedsUpdating; + private long mLastSyncDate; /** * Create new {@link OCFile} with given path @@ -85,11 +86,11 @@ public class OCFile implements Parcelable { } /** - * Returns the path of the file + * Returns the remote path of the file on ownCloud * - * @return The path + * @return The remote path to the file */ - public String getPath() { + public String getRemotePath() { return mRemotePath; } @@ -118,7 +119,7 @@ public class OCFile implements Parcelable { * @return true if it is */ public boolean isDownloaded() { - return mLocalPath != null || mLocalPath.equals(""); + return mLocalPath != null && !mLocalPath.equals(""); } /** @@ -227,6 +228,7 @@ public class OCFile implements Parcelable { mLength = 0; mCreationTimestamp = 0; mModifiedTimestamp = 0; + mLastSyncDate = 0; } /** @@ -291,6 +293,14 @@ public class OCFile implements Parcelable { public boolean needsUpdatingWhileSaving() { return mNeedsUpdating; } + + public long getLastSyncDate() { + return mLastSyncDate; + } + + public void setLastSyncDate(long lastSyncDate) { + mLastSyncDate = lastSyncDate; + } @Override public int describeContents() { @@ -307,8 +317,23 @@ public class OCFile implements Parcelable { 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 boolean equals(Object o) { + OCFile that = (OCFile) o; + return this.mId == that.mId; + } + + @Override + public String toString() { + String asString = "[id=%s, name=%s, mime=%s, downloaded=%s, local=%s, remote=%s]"; + asString = String.format(asString, new Long(mId), getFileName(), mMimeType, isDownloaded(), mLocalPath, mRemotePath); + return asString; } + + }