Support mime type in metadata

This commit is contained in:
Dominik Schürmann 2014-08-11 20:16:30 +02:00
parent 6bec5eedde
commit 9aa5f23788
1 changed files with 13 additions and 14 deletions

View File

@ -32,14 +32,18 @@ public class OpenPgpDecryptMetadata implements Parcelable {
public static final int PARCELABLE_VERSION = 1; public static final int PARCELABLE_VERSION = 1;
String filename; String filename;
String mimeType;
long modificationTime; long modificationTime;
int format;
long originalSize; long originalSize;
public String getFilename() { public String getFilename() {
return filename; return filename;
} }
public String getMimeType() {
return mimeType;
}
public long getModificationTime() { public long getModificationTime() {
return modificationTime; return modificationTime;
} }
@ -48,25 +52,21 @@ public class OpenPgpDecryptMetadata implements Parcelable {
return originalSize; return originalSize;
} }
public int getFormat() {
return format;
}
public OpenPgpDecryptMetadata() { public OpenPgpDecryptMetadata() {
} }
public OpenPgpDecryptMetadata(String filename, long modificationTime, public OpenPgpDecryptMetadata(String filename, String mimeType, long modificationTime,
int format, long originalSize) { long originalSize) {
this.filename = filename; this.filename = filename;
this.mimeType = mimeType;
this.modificationTime = modificationTime; this.modificationTime = modificationTime;
this.format = format;
this.originalSize = originalSize; this.originalSize = originalSize;
} }
public OpenPgpDecryptMetadata(OpenPgpDecryptMetadata b) { public OpenPgpDecryptMetadata(OpenPgpDecryptMetadata b) {
this.filename = b.filename; this.filename = b.filename;
this.mimeType = b.mimeType;
this.modificationTime = b.modificationTime; this.modificationTime = b.modificationTime;
this.format = b.format;
this.originalSize = b.originalSize; this.originalSize = b.originalSize;
} }
@ -87,8 +87,8 @@ public class OpenPgpDecryptMetadata implements Parcelable {
int startPosition = dest.dataPosition(); int startPosition = dest.dataPosition();
// version 1 // version 1
dest.writeString(filename); dest.writeString(filename);
dest.writeString(mimeType);
dest.writeLong(modificationTime); dest.writeLong(modificationTime);
dest.writeInt(format);
dest.writeLong(originalSize); dest.writeLong(originalSize);
// Go back and write the size // Go back and write the size
int parcelableSize = dest.dataPosition() - startPosition; int parcelableSize = dest.dataPosition() - startPosition;
@ -105,8 +105,8 @@ public class OpenPgpDecryptMetadata implements Parcelable {
OpenPgpDecryptMetadata vr = new OpenPgpDecryptMetadata(); OpenPgpDecryptMetadata vr = new OpenPgpDecryptMetadata();
vr.filename = source.readString(); vr.filename = source.readString();
vr.mimeType = source.readString();
vr.modificationTime = source.readLong(); vr.modificationTime = source.readLong();
vr.format = source.readInt();
vr.originalSize = source.readLong(); vr.originalSize = source.readLong();
// skip over all fields added in future versions of this parcel // skip over all fields added in future versions of this parcel
@ -122,10 +122,9 @@ public class OpenPgpDecryptMetadata implements Parcelable {
@Override @Override
public String toString() { public String toString() {
String out = new String(); String out = "\nfilename: " + filename;
out += "\nfilename: " + filename; out += "\nmimeType: " + mimeType;
out += "\nmodificationTime: " + modificationTime; out += "\nmodificationTime: " + modificationTime;
out += "\nformat: " + format;
out += "\noriginalSize: " + originalSize; out += "\noriginalSize: " + originalSize;
return out; return out;
} }