diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-10-23 23:33:50 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-10-23 23:33:50 +0200 |
commit | efa5a80eb618f401bfe14480400acfc39acd5b7e (patch) | |
tree | cc739bce253f959608622db4727a7bda06fb0a6c /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ParcelableKeyRing.java | |
parent | 1624cd8349876f267e2cb4d37341b5cc52b25f98 (diff) | |
parent | 76a1e99d7e30679722ffe2cb0c8c12b048adc369 (diff) | |
download | open-keychain-efa5a80eb618f401bfe14480400acfc39acd5b7e.tar.gz open-keychain-efa5a80eb618f401bfe14480400acfc39acd5b7e.tar.bz2 open-keychain-efa5a80eb618f401bfe14480400acfc39acd5b7e.zip |
Merge branch 'development' of github.com:open-keychain/open-keychain into development
Conflicts:
OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListActivity.java
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ParcelableKeyRing.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ParcelableKeyRing.java | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ParcelableKeyRing.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ParcelableKeyRing.java index 55e6be9b9..6f6c816ea 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ParcelableKeyRing.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ParcelableKeyRing.java @@ -21,33 +21,55 @@ package org.sufficientlysecure.keychain.keyimport; import android.os.Parcel; import android.os.Parcelable; -/** This is a trivial wrapper around keyring bytes which implements Parcelable. It exists - * for the sole purpose of keeping spongycastle and android imports in separate packages. +/** This class is a parcelable representation of either a keyring as raw data, + * or a (unique) reference to one as a fingerprint, keyid, or keybase name. */ public class ParcelableKeyRing implements Parcelable { - final byte[] mBytes; - final String mExpectedFingerprint; + public final byte[] mBytes; + + // dual role! + public final String mExpectedFingerprint; + public final String mKeyIdHex; + public final String mKeybaseName; public ParcelableKeyRing(byte[] bytes) { mBytes = bytes; mExpectedFingerprint = null; + mKeyIdHex = null; + mKeybaseName = null; } - public ParcelableKeyRing(byte[] bytes, String expectedFingerprint) { + public ParcelableKeyRing(String expectedFingerprint, byte[] bytes) { mBytes = bytes; mExpectedFingerprint = expectedFingerprint; + mKeyIdHex = null; + mKeybaseName = null; + } + public ParcelableKeyRing(String expectedFingerprint, String keyIdHex, String keybaseName) { + mBytes = null; + mExpectedFingerprint = expectedFingerprint; + mKeyIdHex = keyIdHex; + mKeybaseName = keybaseName; + } + + private ParcelableKeyRing(Parcel source) { + mBytes = source.createByteArray(); + + mExpectedFingerprint = source.readString(); + mKeyIdHex = source.readString(); + mKeybaseName = source.readString(); } public void writeToParcel(Parcel dest, int flags) { dest.writeByteArray(mBytes); dest.writeString(mExpectedFingerprint); + dest.writeString(mKeyIdHex); + dest.writeString(mKeybaseName); } public static final Creator<ParcelableKeyRing> CREATOR = new Creator<ParcelableKeyRing>() { public ParcelableKeyRing createFromParcel(final Parcel source) { - byte[] bytes = source.createByteArray(); - String expectedFingerprint = source.readString(); - return new ParcelableKeyRing(bytes, expectedFingerprint); + return new ParcelableKeyRing(source); } public ParcelableKeyRing[] newArray(final int size) { @@ -59,11 +81,4 @@ public class ParcelableKeyRing implements Parcelable { return 0; } - public byte[] getBytes() { - return mBytes; - } - - public String getExpectedFingerprint() { - return mExpectedFingerprint; - } } |