ImportKeys: Use the parsed key status and avoid deprecated method

This commit is contained in:
Andrea Torlaschi
2016-08-24 09:52:13 +02:00
parent 097b580d38
commit 48266fd8e0
2 changed files with 14 additions and 10 deletions

View File

@@ -29,18 +29,17 @@ import java.io.OutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.Set; import java.util.Set;
/** A generic wrapped PGPKeyRing object. /**
* * A generic wrapped PGPKeyRing object.
* <p>
* This class provides implementations for all basic getters which both * This class provides implementations for all basic getters which both
* PublicKeyRing and SecretKeyRing have in common. To make the wrapped keyring * PublicKeyRing and SecretKeyRing have in common. To make the wrapped keyring
* class typesafe in implementing subclasses, the field is stored in the * class typesafe in implementing subclasses, the field is stored in the
* implementing class, providing properly typed access through the getRing * implementing class, providing properly typed access through the getRing
* getter method. * getter method.
*
*/ */
public abstract class CanonicalizedKeyRing extends KeyRing { public abstract class CanonicalizedKeyRing extends KeyRing {
@@ -80,7 +79,7 @@ public abstract class CanonicalizedKeyRing extends KeyRing {
public boolean isRevoked() { public boolean isRevoked() {
// Is the master key revoked? // Is the master key revoked?
return getRing().getPublicKey().isRevoked(); return getRing().getPublicKey().hasRevocation();
} }
public Date getCreationDate() { public Date getCreationDate() {
@@ -136,8 +135,10 @@ public abstract class CanonicalizedKeyRing extends KeyRing {
getRing().encode(stream); getRing().encode(stream);
} }
/** Returns an UncachedKeyRing which wraps the same data as this ring. This method should /**
* only be used */ * Returns an UncachedKeyRing which wraps the same data as this ring. This method should
* only be used
*/
public UncachedKeyRing getUncachedKeyRing() { public UncachedKeyRing getUncachedKeyRing() {
return new UncachedKeyRing(getRing()); return new UncachedKeyRing(getRing());
} }

View File

@@ -208,6 +208,9 @@ public class ImportKeysAdapter extends RecyclerView.Adapter<ImportKeysAdapter.Vi
ImportKeysListEntry entry = mData.get(mCurrent); ImportKeysListEntry entry = mData.get(mCurrent);
entry.setRevoked(keyRing.isRevoked());
entry.setExpired(keyRing.isExpired());
entry.setDate(keyRing.getCreationDate()); entry.setDate(keyRing.getCreationDate());
entry.setKeyId(keyRing.getMasterKeyId()); entry.setKeyId(keyRing.getMasterKeyId());