diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-09-07 19:01:28 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-09-07 19:01:28 +0200 |
commit | 6c3f6dc74a04e70e776711d97f5e729153f64a31 (patch) | |
tree | 408aaa076d7d700a4d3da676e2cfefe71f72b59e /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SignKeySpinner.java | |
parent | ef30d842d885e9fc4eed74456b1feaedb01389eb (diff) | |
parent | 0b091aa642f6b33f70628d112fa5d2b2afb23e2d (diff) | |
download | open-keychain-6c3f6dc74a04e70e776711d97f5e729153f64a31.tar.gz open-keychain-6c3f6dc74a04e70e776711d97f5e729153f64a31.tar.bz2 open-keychain-6c3f6dc74a04e70e776711d97f5e729153f64a31.zip |
Merge branch 'master' of github.com:open-keychain/open-keychain
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SignKeySpinner.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SignKeySpinner.java | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SignKeySpinner.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SignKeySpinner.java index d0517d464..648fcd4eb 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SignKeySpinner.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SignKeySpinner.java @@ -24,6 +24,8 @@ import android.os.Bundle; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.util.AttributeSet; + +import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.provider.KeychainContract; public class SignKeySpinner extends KeySpinner { @@ -51,16 +53,41 @@ public class SignKeySpinner extends KeySpinner { KeychainContract.KeyRings.MASTER_KEY_ID, KeychainContract.KeyRings.KEY_ID, KeychainContract.KeyRings.USER_ID, + KeychainContract.KeyRings.IS_REVOKED, KeychainContract.KeyRings.IS_EXPIRED, KeychainContract.KeyRings.HAS_SIGN, KeychainContract.KeyRings.HAS_ANY_SECRET }; - String where = KeychainContract.KeyRings.HAS_ANY_SECRET + " = 1 AND " + KeychainContract.KeyRings.HAS_SIGN + " NOT NULL AND " - + KeychainContract.KeyRings.IS_REVOKED + " = 0 AND " + KeychainContract.KeyRings.IS_EXPIRED + " = 0"; + String where = KeychainContract.KeyRings.HAS_ANY_SECRET + " = 1"; // Now create and return a CursorLoader that will take care of // creating a Cursor for the data being displayed. return new CursorLoader(getContext(), baseUri, projection, where, null, null); } + + private int mIndexHasSign, mIndexIsRevoked, mIndexIsExpired; + + @Override + public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { + super.onLoadFinished(loader, cursor); + mIndexHasSign = cursor.getColumnIndex(KeychainContract.KeyRings.HAS_SIGN); + mIndexIsRevoked = cursor.getColumnIndex(KeychainContract.KeyRings.IS_REVOKED); + mIndexIsExpired = cursor.getColumnIndex(KeychainContract.KeyRings.IS_EXPIRED); + } + + @Override + String getStatus(Context context, Cursor cursor) { + if (cursor.getInt(mIndexIsRevoked) != 0) { + return context.getString(R.string.revoked); + } + if (cursor.getInt(mIndexHasSign) == 0) { + return context.getString(R.string.key_unavailable); + } + if (cursor.getInt(mIndexIsExpired) != 0) { + return context.getString(R.string.expired); + } + return null; + } + } |