aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-05-07 02:14:47 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-05-07 02:14:47 +0200
commit6aafb314125f016e2215f7d33baf600b5768d72c (patch)
tree274384e6d4c6cd9e86e5e9ae9b89c835aaa30361 /OpenKeychain/src/main/java/org/sufficientlysecure
parent96125b1976b1cddec946d1ef8e28c4868a63e354 (diff)
downloadopen-keychain-6aafb314125f016e2215f7d33baf600b5768d72c.tar.gz
open-keychain-6aafb314125f016e2215f7d33baf600b5768d72c.tar.bz2
open-keychain-6aafb314125f016e2215f7d33baf600b5768d72c.zip
ui: move revocation/expiry notes above tab slider
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java26
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java38
2 files changed, 32 insertions, 32 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
index 56aaba57b..a7ac2587a 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
@@ -40,6 +40,7 @@ import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
+import android.view.View;
import android.view.Window;
import com.devspark.appmsg.AppMsg;
@@ -55,6 +56,7 @@ import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.SlidingTabLayout;
import java.io.IOException;
+import java.util.Date;
import java.util.HashMap;
public class ViewKeyActivity extends ActionBarActivity implements
@@ -75,6 +77,8 @@ public class ViewKeyActivity extends ActionBarActivity implements
private ViewPager mViewPager;
private SlidingTabLayout mSlidingTabLayout;
private PagerTabStripAdapter mTabsAdapter;
+ private View mStatusRevoked;
+ private View mStatusExpired;
public static final int REQUEST_CODE_LOOKUP_KEY = 0x00007006;
@@ -104,6 +108,9 @@ public class ViewKeyActivity extends ActionBarActivity implements
setContentView(R.layout.view_key_activity);
+ mStatusRevoked = findViewById(R.id.view_key_revoked);
+ mStatusExpired = findViewById(R.id.view_key_expired);
+
mViewPager = (ViewPager) findViewById(R.id.view_key_pager);
mSlidingTabLayout = (SlidingTabLayout) findViewById(R.id.view_key_sliding_tab_layout);
@@ -363,10 +370,14 @@ public class ViewKeyActivity extends ActionBarActivity implements
KeychainContract.KeyRings._ID,
KeychainContract.KeyRings.MASTER_KEY_ID,
KeychainContract.KeyRings.USER_ID,
+ KeychainContract.KeyRings.IS_REVOKED,
+ KeychainContract.KeyRings.EXPIRY,
};
static final int INDEX_UNIFIED_MASTER_KEY_ID = 1;
static final int INDEX_UNIFIED_USER_ID = 2;
+ static final int INDEX_UNIFIED_IS_REVOKED = 3;
+ static final int INDEX_UNIFIED_EXPIRY = 4;
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
@@ -408,6 +419,21 @@ public class ViewKeyActivity extends ActionBarActivity implements
String keyIdStr = PgpKeyHelper.convertKeyIdToHex(masterKeyId);
getSupportActionBar().setSubtitle(keyIdStr);
+ // If this key is revoked, it cannot be used for anything!
+ if (data.getInt(INDEX_UNIFIED_IS_REVOKED) != 0) {
+ mStatusRevoked.setVisibility(View.VISIBLE);
+ mStatusExpired.setVisibility(View.GONE);
+ } else {
+ mStatusRevoked.setVisibility(View.GONE);
+
+ Date expiryDate = new Date(data.getLong(INDEX_UNIFIED_EXPIRY) * 1000);
+ if (!data.isNull(INDEX_UNIFIED_EXPIRY) && expiryDate.before(new Date())) {
+ mStatusExpired.setVisibility(View.VISIBLE);
+ } else {
+ mStatusExpired.setVisibility(View.GONE);
+ }
+ }
+
break;
}
}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java
index ded457eca..389455a9a 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java
@@ -49,8 +49,6 @@ public class ViewKeyMainFragment extends Fragment implements
public static final String ARG_DATA_URI = "uri";
private LinearLayout mContainer;
- private View mStatusRevoked;
- private View mStatusExpired;
private View mActionEdit;
private View mActionEditDivider;
private View mActionEncrypt;
@@ -72,8 +70,6 @@ public class ViewKeyMainFragment extends Fragment implements
mContainer = (LinearLayout) view.findViewById(R.id.container);
mUserIds = (ListView) view.findViewById(R.id.view_key_user_ids);
- mStatusRevoked = view.findViewById(R.id.view_key_revoked);
- mStatusExpired = view.findViewById(R.id.view_key_expired);
mActionEdit = view.findViewById(R.id.view_key_action_edit);
mActionEditDivider = view.findViewById(R.id.view_key_action_edit_divider);
mActionEncrypt = view.findViewById(R.id.view_key_action_encrypt);
@@ -132,30 +128,14 @@ public class ViewKeyMainFragment extends Fragment implements
}
static final String[] UNIFIED_PROJECTION = new String[]{
- KeyRings._ID, KeyRings.MASTER_KEY_ID, KeyRings.HAS_ANY_SECRET, KeyRings.IS_REVOKED,
- KeyRings.USER_ID, KeyRings.FINGERPRINT,
- KeyRings.ALGORITHM, KeyRings.KEY_SIZE, KeyRings.CREATION, KeyRings.EXPIRY,
- KeyRings.HAS_ENCRYPT
-
+ KeyRings._ID, KeyRings.MASTER_KEY_ID,
+ KeyRings.HAS_ANY_SECRET, KeyRings.IS_REVOKED, KeyRings.EXPIRY, KeyRings.HAS_ENCRYPT
};
static final int INDEX_UNIFIED_MASTER_KEY_ID = 1;
static final int INDEX_UNIFIED_HAS_ANY_SECRET = 2;
static final int INDEX_UNIFIED_IS_REVOKED = 3;
- static final int INDEX_UNIFIED_USER_ID = 4;
- static final int INDEX_UNIFIED_FINGERPRINT = 5;
- static final int INDEX_UNIFIED_ALGORITHM = 6;
- static final int INDEX_UNIFIED_KEY_SIZE = 7;
- static final int INDEX_UNIFIED_CREATION = 8;
- static final int INDEX_UNIFIED_EXPIRY = 9;
- static final int INDEX_UNIFIED_HAS_ENCRYPT = 10;
-
- static final String[] KEYS_PROJECTION = new String[]{
- Keys._ID,
- Keys.KEY_ID, Keys.RANK, Keys.ALGORITHM, Keys.KEY_SIZE, Keys.HAS_SECRET,
- Keys.CAN_CERTIFY, Keys.CAN_ENCRYPT, Keys.CAN_SIGN, Keys.IS_REVOKED,
- Keys.CREATION, Keys.EXPIRY, Keys.FINGERPRINT
- };
- static final int KEYS_INDEX_CAN_ENCRYPT = 7;
+ static final int INDEX_UNIFIED_EXPIRY = 4;
+ static final int INDEX_UNIFIED_HAS_ENCRYPT = 5;
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
switch (id) {
@@ -165,7 +145,8 @@ public class ViewKeyMainFragment extends Fragment implements
}
case LOADER_ID_USER_IDS: {
Uri baseUri = UserIds.buildUserIdsUri(mDataUri);
- return new CursorLoader(getActivity(), baseUri, ViewKeyUserIdsAdapter.USER_IDS_PROJECTION, null, null, null);
+ return new CursorLoader(getActivity(), baseUri,
+ ViewKeyUserIdsAdapter.USER_IDS_PROJECTION, null, null, null);
}
default:
@@ -206,9 +187,6 @@ public class ViewKeyMainFragment extends Fragment implements
// If this key is revoked, it cannot be used for anything!
if (data.getInt(INDEX_UNIFIED_IS_REVOKED) != 0) {
- mStatusRevoked.setVisibility(View.VISIBLE);
- mStatusExpired.setVisibility(View.GONE);
-
mActionEdit.setEnabled(false);
mActionCertify.setEnabled(false);
mActionEncrypt.setEnabled(false);
@@ -217,13 +195,9 @@ public class ViewKeyMainFragment extends Fragment implements
Date expiryDate = new Date(data.getLong(INDEX_UNIFIED_EXPIRY) * 1000);
if (!data.isNull(INDEX_UNIFIED_EXPIRY) && expiryDate.before(new Date())) {
- mStatusRevoked.setVisibility(View.GONE);
- mStatusExpired.setVisibility(View.VISIBLE);
mActionCertify.setEnabled(false);
mActionEncrypt.setEnabled(false);
} else {
- mStatusRevoked.setVisibility(View.GONE);
- mStatusExpired.setVisibility(View.GONE);
mActionCertify.setEnabled(true);
mActionEncrypt.setEnabled(true);
}