}
};
- private long id;
- private long parentId;
- private long length;
- private long creationTimestamp;
- private long modifiedTimestamp;
- private String remotePath;
- private String localPath;
- private String mimeType;
- private boolean needsUpdating;
+ private long mId;
+ private long mParentId;
+ private long mLength;
+ private long mCreationTimestamp;
+ private long mModifiedTimestamp;
+ private String mRemotePath;
+ private String mLocalPath;
+ private String mMimeType;
+ private boolean mNeedsUpdating;
/**
* Create new {@link OCFile} with given path
*/
public OCFile(String path) {
resetData();
- needsUpdating = false;
- remotePath = path;
+ mNeedsUpdating = false;
+ mRemotePath = path;
}
/**
* @param source The source parcel
*/
private OCFile(Parcel source){
- id = source.readLong();
- parentId = source.readLong();
- length = source.readLong();
- creationTimestamp = source.readLong();
- modifiedTimestamp = source.readLong();
- remotePath = source.readString();
- localPath = source.readString();
- mimeType = source.readString();
- needsUpdating = source.readInt() == 0;
+ mId = source.readLong();
+ mParentId = source.readLong();
+ mLength = source.readLong();
+ mCreationTimestamp = source.readLong();
+ mModifiedTimestamp = source.readLong();
+ mRemotePath = source.readString();
+ mLocalPath = source.readString();
+ mMimeType = source.readString();
+ mNeedsUpdating = source.readInt() == 0;
}
/**
* @return the file ID
*/
public long getFileId() {
- return id;
+ return mId;
}
/**
* @return The path
*/
public String getPath() {
- return remotePath;
+ return mRemotePath;
}
/**
* @return true, if the file exists in the database
*/
public boolean fileExists() {
- return id != -1;
+ return mId != -1;
}
/**
* @return true if it is a directory
*/
public boolean isDirectory() {
- return mimeType != null && mimeType.equals("DIR");
+ return mMimeType != null && mMimeType.equals("DIR");
}
/**
* @return true if it is
*/
public boolean isDownloaded() {
- return localPath != null || localPath.equals("");
+ return mLocalPath != null || mLocalPath.equals("");
}
/**
* @return The local path to the file
*/
public String getStoragePath() {
- return localPath;
+ return mLocalPath;
}
/**
* to set
*/
public void setStoragePath(String storage_path) {
- localPath = storage_path;
+ mLocalPath = storage_path;
}
/**
* @return A UNIX timestamp of the time that file was created
*/
public long getCreationTimestamp() {
- return creationTimestamp;
+ return mCreationTimestamp;
}
/**
* to set
*/
public void setCreationTimestamp(long creation_timestamp) {
- creationTimestamp = creation_timestamp;
+ mCreationTimestamp = creation_timestamp;
}
/**
* @return A UNIX timestamp of the modification time
*/
public long getModificationTimestamp() {
- return modifiedTimestamp;
+ return mModifiedTimestamp;
}
/**
* to set
*/
public void setModificationTimestamp(long modification_timestamp) {
- modifiedTimestamp = modification_timestamp;
+ mModifiedTimestamp = modification_timestamp;
}
/**
* @return The name of the file
*/
public String getFileName() {
- if (remotePath != null) {
- File f = new File(remotePath);
+ if (mRemotePath != null) {
+ File f = new File(mRemotePath);
return f.getName().equals("") ? "/" : f.getName();
}
return null;
* @return the Mimetype as a String
*/
public String getMimetype() {
- return mimeType;
+ return mMimeType;
}
/**
*/
public void addFile(OCFile file) throws IllegalStateException {
if (isDirectory()) {
- file.parentId = id;
- needsUpdating = true;
+ file.mParentId = mId;
+ mNeedsUpdating = true;
return;
}
throw new IllegalStateException(
* Used internally. Reset all file properties
*/
private void resetData() {
- id = -1;
- remotePath = null;
- parentId = 0;
- localPath = null;
- mimeType = null;
- length = 0;
- creationTimestamp = 0;
- modifiedTimestamp = 0;
+ mId = -1;
+ mRemotePath = null;
+ mParentId = 0;
+ mLocalPath = null;
+ mMimeType = null;
+ mLength = 0;
+ mCreationTimestamp = 0;
+ mModifiedTimestamp = 0;
}
/**
* to set
*/
public void setFileId(long file_id) {
- id = file_id;
+ mId = file_id;
}
/**
* to set
*/
public void setMimetype(String mimetype) {
- mimeType = mimetype;
+ mMimeType = mimetype;
}
/**
* to set
*/
public void setParentId(long parent_id) {
- parentId = parent_id;
+ mParentId = parent_id;
}
/**
* to set
*/
public void setFileLength(long file_len) {
- length = file_len;
+ mLength = file_len;
}
/**
* @return The filesize in bytes
*/
public long getFileLength() {
- return length;
+ return mLength;
}
/**
* @return The ID
*/
public long getParentId() {
- return parentId;
+ return mParentId;
}
/**
* @return
*/
public boolean needsUpdatingWhileSaving() {
- return needsUpdating;
+ return mNeedsUpdating;
}
@Override
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeLong(id);
- dest.writeLong(parentId);
- dest.writeLong(length);
- dest.writeLong(creationTimestamp);
- dest.writeLong(modifiedTimestamp);
- dest.writeString(remotePath);
- dest.writeString(localPath);
- dest.writeString(mimeType);
- dest.writeInt(needsUpdating ? 0 : 1 ); // No writeBoolean method exists - yay :D
+ dest.writeLong(mId);
+ dest.writeLong(mParentId);
+ dest.writeLong(mLength);
+ dest.writeLong(mCreationTimestamp);
+ dest.writeLong(mModifiedTimestamp);
+ dest.writeString(mRemotePath);
+ dest.writeString(mLocalPath);
+ dest.writeString(mMimeType);
+ dest.writeInt(mNeedsUpdating ? 0 : 1 ); // No writeBoolean method exists - yay :D
}
}