X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/9bfacf23cbcdbcdd79157bef18006487e7b59c0c..00482b6dcb1e98da39df54374f7098b51d66bee5:/src/com/owncloud/android/datamodel/OCFile.java diff --git a/src/com/owncloud/android/datamodel/OCFile.java b/src/com/owncloud/android/datamodel/OCFile.java index 853b01c5..2c9c53be 100644 --- a/src/com/owncloud/android/datamodel/OCFile.java +++ b/src/com/owncloud/android/datamodel/OCFile.java @@ -1,6 +1,8 @@ -/* 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, @@ -20,14 +22,13 @@ package com.owncloud.android.datamodel; 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 { public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { @@ -71,6 +72,8 @@ public class OCFile implements Parcelable, Comparable { private boolean mNeedsUpdateThumbnail; + private boolean mIsDownloading; + /** * Create new {@link OCFile} with given path. @@ -113,6 +116,7 @@ public class OCFile implements Parcelable, Comparable { mPermissions = source.readString(); mRemoteId = source.readString(); mNeedsUpdateThumbnail = source.readInt() == 0; + mIsDownloading = source.readInt() == 0; } @@ -137,6 +141,7 @@ public class OCFile implements Parcelable, Comparable { dest.writeString(mPermissions); dest.writeString(mRemoteId); dest.writeInt(mNeedsUpdateThumbnail ? 1 : 0); + dest.writeInt(mIsDownloading ? 1 : 0); } /** @@ -349,6 +354,7 @@ public class OCFile implements Parcelable, Comparable { mPermissions = null; mRemoteId = null; mNeedsUpdateThumbnail = false; + mIsDownloading = false; } /** @@ -534,17 +540,7 @@ public class OCFile implements Parcelable, Comparable { */ 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() { @@ -563,4 +559,16 @@ public class OCFile implements Parcelable, Comparable { this.mRemoteId = remoteId; } + public boolean isDownloading() { + return mIsDownloading; + } + + public void setDownloading(boolean isDownloading) { + this.mIsDownloading = isDownloading; + } + + public boolean isSynchronizing() { + // TODO real implementation + return false; + } }