diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-07-28 11:11:23 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-07-28 11:11:23 +0200 |
commit | 3d6edd11903898b8dc95a52d26b8dc3716d85e49 (patch) | |
tree | 07897fbfddc9e6498f3a663489305aa92e456c19 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain | |
parent | a3045c710e44a189f3166c5d56b94117a1318731 (diff) | |
download | open-keychain-3d6edd11903898b8dc95a52d26b8dc3716d85e49.tar.gz open-keychain-3d6edd11903898b8dc95a52d26b8dc3716d85e49.tar.bz2 open-keychain-3d6edd11903898b8dc95a52d26b8dc3716d85e49.zip |
Use icons in key view
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java | 6 | ||||
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java | 55 |
2 files changed, 39 insertions, 22 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java index ef3c0a1c1..ee05a5fe4 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java @@ -494,19 +494,19 @@ public class KeyListFragment extends LoaderFragment if (isRevoked) { h.mStatus.setVisibility(View.VISIBLE); h.mStatus.setImageDrawable( - getResources().getDrawable(R.drawable.status_signature_revoked_cutout)); + getResources().getDrawable(R.drawable.status_signature_revoked)); h.mStatus.setColorFilter(getResources().getColor(R.color.result_red), PorterDuff.Mode.SRC_ATOP); } else if (isExpired) { h.mStatus.setVisibility(View.VISIBLE); h.mStatus.setImageDrawable( - getResources().getDrawable(R.drawable.status_signature_expired_cutout)); + getResources().getDrawable(R.drawable.status_signature_expired)); h.mStatus.setColorFilter(getResources().getColor(R.color.result_orange), PorterDuff.Mode.SRC_ATOP); } else if (isVerified) { h.mStatus.setVisibility(View.VISIBLE); h.mStatus.setImageDrawable( - getResources().getDrawable(R.drawable.status_signature_verified_cutout)); + getResources().getDrawable(R.drawable.status_signature_verified)); h.mStatus.setColorFilter(getResources().getColor(R.color.result_green), PorterDuff.Mode.SRC_ATOP); } else { 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 a9cd0976b..8407ab66d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java @@ -22,6 +22,7 @@ import android.annotation.TargetApi; import android.app.Activity; import android.content.Intent; import android.database.Cursor; +import android.graphics.PorterDuff; import android.net.Uri; import android.nfc.NdefMessage; import android.nfc.NdefRecord; @@ -43,6 +44,9 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.Window; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; import com.devspark.appmsg.AppMsg; @@ -81,9 +85,11 @@ public class ViewKeyActivity extends ActionBarActivity implements private ViewPager mViewPager; private SlidingTabLayout mSlidingTabLayout; private PagerTabStripAdapter mTabsAdapter; + + private LinearLayout mStatusLayout; + private TextView mStatusText; + private ImageView mStatusImage; private View mStatusDivider; - private View mStatusRevoked; - private View mStatusExpired; public static final int REQUEST_CODE_LOOKUP_KEY = 0x00007006; @@ -115,9 +121,10 @@ public class ViewKeyActivity extends ActionBarActivity implements setContentView(R.layout.view_key_activity); - mStatusDivider = findViewById(R.id.status_divider); - mStatusRevoked = findViewById(R.id.view_key_revoked); - mStatusExpired = findViewById(R.id.view_key_expired); + mStatusLayout = (LinearLayout) findViewById(R.id.view_key_status_layout); + mStatusText = (TextView) findViewById(R.id.view_key_status_text); + mStatusImage = (ImageView) findViewById(R.id.view_key_status_image); + mStatusDivider = findViewById(R.id.view_key_status_divider); mViewPager = (ViewPager) findViewById(R.id.view_key_pager); mSlidingTabLayout = (SlidingTabLayout) findViewById(R.id.view_key_sliding_tab_layout); @@ -515,22 +522,32 @@ 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) { + boolean isRevoked = data.getInt(INDEX_UNIFIED_IS_REVOKED) > 0; + boolean isExpired = !data.isNull(INDEX_UNIFIED_EXPIRY) + && new Date(data.getLong(INDEX_UNIFIED_EXPIRY) * 1000).before(new Date()); + + // Note: order is important + if (isRevoked) { + mStatusDivider.setVisibility(View.VISIBLE); + mStatusLayout.setVisibility(View.VISIBLE); + mStatusText.setText(R.string.view_key_revoked); + mStatusText.setTextColor(getResources().getColor(R.color.result_red)); + mStatusImage.setImageDrawable( + getResources().getDrawable(R.drawable.status_signature_revoked)); + mStatusImage.setColorFilter(getResources().getColor(R.color.result_red), + PorterDuff.Mode.SRC_ATOP); + } else if (isExpired) { mStatusDivider.setVisibility(View.VISIBLE); - mStatusRevoked.setVisibility(View.VISIBLE); - mStatusExpired.setVisibility(View.GONE); + mStatusLayout.setVisibility(View.VISIBLE); + mStatusText.setText(R.string.view_key_expired); + mStatusText.setTextColor(getResources().getColor(R.color.result_orange)); + mStatusImage.setImageDrawable( + getResources().getDrawable(R.drawable.status_signature_expired_cutout)); + mStatusImage.setColorFilter(getResources().getColor(R.color.result_orange), + PorterDuff.Mode.SRC_ATOP); } 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())) { - mStatusDivider.setVisibility(View.VISIBLE); - mStatusExpired.setVisibility(View.VISIBLE); - } else { - mStatusDivider.setVisibility(View.GONE); - mStatusExpired.setVisibility(View.GONE); - } + mStatusDivider.setVisibility(View.GONE); + mStatusLayout.setVisibility(View.GONE); } break; |