-/* ownCloud Android client application
+/**
+ * ownCloud Android client application
+ *
* Copyright (C) 2012 Bartek Przybylski
- * Copyright (C) 2012-2013 ownCloud Inc.
+ * Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
import android.os.Parcel;
import android.os.Parcelable;
-import android.webkit.MimeTypeMap;
import com.owncloud.android.lib.common.utils.Log_OC;
+import com.owncloud.android.utils.FileStorageUtils;
import java.io.File;
import third_parties.daveKoeller.AlphanumComparator;
-
public class OCFile implements Parcelable, Comparable<OCFile> {
public static final Parcelable.Creator<OCFile> CREATOR = new Parcelable.Creator<OCFile>() {
private boolean mShareByLink;
private String mPublicLink;
+ private boolean mFavorite;
+
private String mPermissions;
private String mRemoteId;
private boolean mNeedsUpdateThumbnail;
+ private boolean mIsDownloading;
+
/**
* Create new {@link OCFile} with given path.
mLastSyncDateForData = source.readLong();
mEtag = source.readString();
mShareByLink = source.readInt() == 1;
+ mFavorite = source.readInt() == 1;
mPublicLink = source.readString();
mPermissions = source.readString();
mRemoteId = source.readString();
mNeedsUpdateThumbnail = source.readInt() == 0;
+ mIsDownloading = source.readInt() == 0;
}
dest.writeLong(mLastSyncDateForData);
dest.writeString(mEtag);
dest.writeInt(mShareByLink ? 1 : 0);
+ dest.writeInt(mFavorite ? 1 : 0);
dest.writeString(mPublicLink);
dest.writeString(mPermissions);
dest.writeString(mRemoteId);
dest.writeInt(mNeedsUpdateThumbnail ? 1 : 0);
+ dest.writeInt(mIsDownloading ? 1 : 0);
}
/**
mNeedsUpdating = false;
mEtag = null;
mShareByLink = false;
+ mFavorite = false;
mPublicLink = null;
mPermissions = null;
mRemoteId = null;
mNeedsUpdateThumbnail = false;
+ mIsDownloading = false;
}
/**
this.mShareByLink = shareByLink;
}
+ public boolean isFavorite() {
+ return mFavorite;
+ }
+
+ public void setFavorite(boolean mFavorite) {
+ this.mFavorite = mFavorite;
+ }
+
public String getPublicLink() {
return mPublicLink;
}
*/
public boolean isImage() {
return ((mMimeType != null && mMimeType.startsWith("image/")) ||
- getMimeTypeFromName().startsWith("image/"));
- }
-
- public String getMimeTypeFromName() {
- String extension = "";
- int pos = mRemotePath.lastIndexOf('.');
- if (pos >= 0) {
- extension = mRemotePath.substring(pos + 1);
- }
- String result = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.toLowerCase());
- return (result != null) ? result : "";
+ FileStorageUtils.getMimeTypeFromName(mRemotePath).startsWith("image/"));
}
public String getPermissions() {
this.mRemoteId = remoteId;
}
+ public boolean isDownloading() {
+ return mIsDownloading;
+ }
+
+ public void setDownloading(boolean isDownloading) {
+ this.mIsDownloading = isDownloading;
+ }
+
+ public boolean isSynchronizing() {
+ // TODO real implementation
+ return false;
+ }
}