aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2015-02-25 02:35:09 +0100
committerDominik Schürmann <dominik@dominikschuermann.de>2015-02-25 02:35:09 +0100
commit56d38dd68b7248dff54d56affce0af14e8e2e161 (patch)
tree5b2f5b8b3350a83423fc6af06c7a6c858d29a28a /OpenKeychain
parent2b609b8144c093b1034c2845a8110ac84eecc414 (diff)
downloadopen-keychain-56d38dd68b7248dff54d56affce0af14e8e2e161.tar.gz
open-keychain-56d38dd68b7248dff54d56affce0af14e8e2e161.tar.bz2
open-keychain-56d38dd68b7248dff54d56affce0af14e8e2e161.zip
First work on new key view toolbar
Diffstat (limited to 'OpenKeychain')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java4
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java151
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java4
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java4
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java8
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/KeyFormattingUtils.java48
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/AspectRatioImageView.java138
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertifyKeySpinner.java7
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SignKeySpinner.java7
-rw-r--r--OpenKeychain/src/main/res/drawable-hdpi/ic_action_encrypt_file.pngbin0 -> 623 bytes
-rw-r--r--OpenKeychain/src/main/res/drawable-hdpi/ic_action_encrypt_text.pngbin0 -> 787 bytes
-rw-r--r--OpenKeychain/src/main/res/drawable-hdpi/ic_action_verified_cutout.pngbin0 -> 1080 bytes
-rw-r--r--OpenKeychain/src/main/res/drawable-mdpi/ic_action_encrypt_file.pngbin0 -> 480 bytes
-rw-r--r--OpenKeychain/src/main/res/drawable-mdpi/ic_action_encrypt_text.pngbin0 -> 572 bytes
-rw-r--r--OpenKeychain/src/main/res/drawable-mdpi/ic_action_verified_cutout.pngbin0 -> 751 bytes
-rw-r--r--OpenKeychain/src/main/res/drawable-xhdpi/ic_action_encrypt_file.pngbin0 -> 836 bytes
-rw-r--r--OpenKeychain/src/main/res/drawable-xhdpi/ic_action_encrypt_text.pngbin0 -> 976 bytes
-rw-r--r--OpenKeychain/src/main/res/drawable-xhdpi/ic_action_verified_cutout.pngbin0 -> 1455 bytes
-rw-r--r--OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_encrypt_file.pngbin0 -> 1095 bytes
-rw-r--r--OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_encrypt_text.pngbin0 -> 1331 bytes
-rw-r--r--OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_verified_cutout.pngbin0 -> 2168 bytes
-rw-r--r--OpenKeychain/src/main/res/layout/view_key_activity.xml106
-rw-r--r--OpenKeychain/src/main/res/menu/key_view2.xml11
-rw-r--r--OpenKeychain/src/main/res/values-v21/dimens.xml1
-rw-r--r--OpenKeychain/src/main/res/values/attr.xml9
-rw-r--r--OpenKeychain/src/main/res/values/dimens.xml1
-rw-r--r--OpenKeychain/src/main/res/values/strings.xml7
27 files changed, 403 insertions, 103 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 55efd9bb0..f60ddcef6 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
@@ -778,13 +778,13 @@ public class KeyListFragment extends LoaderFragment
// Note: order is important!
if (isRevoked) {
- KeyFormattingUtils.setStatusImage(getActivity(), h.mStatus, null, KeyFormattingUtils.STATE_REVOKED, true);
+ KeyFormattingUtils.setStatusImage(getActivity(), h.mStatus, null, KeyFormattingUtils.STATE_REVOKED, R.color.bg_gray);
h.mStatus.setVisibility(View.VISIBLE);
h.mSlinger.setVisibility(View.GONE);
h.mMainUserId.setTextColor(context.getResources().getColor(R.color.bg_gray));
h.mMainUserIdRest.setTextColor(context.getResources().getColor(R.color.bg_gray));
} else if (isExpired) {
- KeyFormattingUtils.setStatusImage(getActivity(), h.mStatus, null, KeyFormattingUtils.STATE_EXPIRED, true);
+ KeyFormattingUtils.setStatusImage(getActivity(), h.mStatus, null, KeyFormattingUtils.STATE_EXPIRED, R.color.bg_gray);
h.mStatus.setVisibility(View.VISIBLE);
h.mSlinger.setVisibility(View.GONE);
h.mMainUserId.setTextColor(context.getResources().getColor(R.color.bg_gray));
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 18a63f5ad..8ef5d01aa 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
@@ -21,6 +21,7 @@ package org.sufficientlysecure.keychain.ui;
import android.annotation.TargetApi;
import android.content.Intent;
import android.database.Cursor;
+import android.graphics.Bitmap;
import android.net.Uri;
import android.nfc.NdefMessage;
import android.nfc.NdefRecord;
@@ -35,17 +36,20 @@ import android.provider.ContactsContract;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
-import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBar;
+import android.support.v7.widget.Toolbar;
+import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageButton;
import android.widget.ImageView;
-import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
-import com.astuetz.PagerSlidingTabStrip;
+import com.getbase.floatingactionbutton.FloatingActionButton;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
@@ -54,9 +58,9 @@ import org.sufficientlysecure.keychain.pgp.KeyRing;
import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
-import org.sufficientlysecure.keychain.ui.adapter.PagerTabStripAdapter;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.ui.util.Notify;
+import org.sufficientlysecure.keychain.ui.widget.AspectRatioImageView;
import org.sufficientlysecure.keychain.util.ContactHelper;
import org.sufficientlysecure.keychain.util.ExportHelper;
import org.sufficientlysecure.keychain.util.Log;
@@ -72,10 +76,16 @@ public class ViewKeyActivity extends BaseActivity implements
protected Uri mDataUri;
- private LinearLayout mStatusLayout;
+ private TextView mName;
private TextView mStatusText;
private ImageView mStatusImage;
- private View mStatusDivider;
+ private RelativeLayout mBigToolbar;
+
+ private ImageButton mActionEncryptFile;
+ private ImageButton mActionEncryptText;
+ private ImageButton mActionVerify;
+ private FloatingActionButton mFab;
+ private AspectRatioImageView mPhoto;
// NFC
private NfcAdapter mNfcAdapter;
@@ -93,19 +103,18 @@ public class ViewKeyActivity extends BaseActivity implements
mExportHelper = new ExportHelper(this);
mProviderHelper = new ProviderHelper(this);
- // let the actionbar look like Android's contact app
- ActionBar actionBar = getSupportActionBar();
- actionBar.setDisplayHomeAsUpEnabled(true);
- actionBar.setIcon(android.R.color.transparent);
- actionBar.setHomeButtonEnabled(true);
+ setTitle(null);
- mStatusLayout = (LinearLayout) findViewById(R.id.view_key_status_layout);
- mStatusText = (TextView) findViewById(R.id.view_key_status_text);
+ mName = (TextView) findViewById(R.id.view_key_name);
+ mStatusText = (TextView) findViewById(R.id.view_key_status);
mStatusImage = (ImageView) findViewById(R.id.view_key_status_image);
- mStatusDivider = findViewById(R.id.view_key_status_divider);
-
+ mBigToolbar = (RelativeLayout) findViewById(R.id.toolbar_big);
- Intent intent = getIntent();
+ mActionEncryptFile = (ImageButton) findViewById(R.id.view_key_action_encrypt_files);
+ mActionEncryptText = (ImageButton) findViewById(R.id.view_key_action_encrypt_text);
+ mActionVerify = (ImageButton) findViewById(R.id.view_key_action_verify);
+ mFab = (FloatingActionButton) findViewById(R.id.fab);
+ mPhoto = (AspectRatioImageView) findViewById(R.id.view_key_photo);
mDataUri = getIntent().getData();
if (mDataUri == null) {
@@ -329,25 +338,32 @@ public class ViewKeyActivity extends BaseActivity implements
}
};
- static final String[] UNIFIED_PROJECTION = new String[]{
+ // These are the rows that we will retrieve.
+ static final String[] PROJECTION = new String[]{
KeychainContract.KeyRings._ID,
KeychainContract.KeyRings.MASTER_KEY_ID,
KeychainContract.KeyRings.USER_ID,
KeychainContract.KeyRings.IS_REVOKED,
KeychainContract.KeyRings.EXPIRY,
-
+ KeychainContract.KeyRings.VERIFIED,
+ KeychainContract.KeyRings.HAS_ANY_SECRET,
+ KeychainContract.KeyRings.FINGERPRINT
};
- 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;
+
+ static final int INDEX_MASTER_KEY_ID = 1;
+ static final int INDEX_USER_ID = 2;
+ static final int INDEX_IS_REVOKED = 3;
+ static final int INDEX_EXPIRY = 4;
+ static final int INDEX_VERIFIED = 5;
+ static final int INDEX_HAS_ANY_SECRET = 6;
+ static final int INDEX_FINGERPRINT = 7;
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
switch (id) {
case LOADER_ID_UNIFIED: {
Uri baseUri = KeychainContract.KeyRings.buildUnifiedKeyRingUri(mDataUri);
- return new CursorLoader(this, baseUri, UNIFIED_PROJECTION, null, null, null);
+ return new CursorLoader(this, baseUri, PROJECTION, null, null, null);
}
default:
@@ -370,36 +386,91 @@ public class ViewKeyActivity extends BaseActivity implements
case LOADER_ID_UNIFIED: {
if (data.moveToFirst()) {
// get name, email, and comment from USER_ID
- String[] mainUserId = KeyRing.splitUserId(data.getString(INDEX_UNIFIED_USER_ID));
+ String[] mainUserId = KeyRing.splitUserId(data.getString(INDEX_USER_ID));
if (mainUserId[0] != null) {
- setTitle(mainUserId[0]);
+ mName.setText(mainUserId[0]);
} else {
- setTitle(R.string.user_id_no_name);
+ mName.setText(R.string.user_id_no_name);
}
- // get key id from MASTER_KEY_ID
- long masterKeyId = data.getLong(INDEX_UNIFIED_MASTER_KEY_ID);
- getSupportActionBar().setSubtitle(KeyFormattingUtils.beautifyKeyIdWithPrefix(this, masterKeyId));
+ String fingerprint = KeyFormattingUtils.convertFingerprintToHex(data.getBlob(INDEX_FINGERPRINT));
- 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());
+ boolean isSecret = data.getInt(INDEX_HAS_ANY_SECRET) != 0;
+ boolean isRevoked = data.getInt(INDEX_IS_REVOKED) > 0;
+ boolean isExpired = !data.isNull(INDEX_EXPIRY)
+ && new Date(data.getLong(INDEX_EXPIRY) * 1000).before(new Date());
+ boolean isVerified = data.getInt(INDEX_VERIFIED) > 0;
// Note: order is important
+ int color;
if (isRevoked) {
mStatusText.setText(R.string.view_key_revoked);
- KeyFormattingUtils.setStatusImage(this, mStatusImage, mStatusText, KeyFormattingUtils.STATE_REVOKED);
- mStatusDivider.setVisibility(View.VISIBLE);
- mStatusLayout.setVisibility(View.VISIBLE);
+ mStatusImage.setVisibility(View.VISIBLE);
+ KeyFormattingUtils.setStatusImage(this, mStatusImage, mStatusText, KeyFormattingUtils.STATE_REVOKED, R.color.icons);
+ color = getResources().getColor(R.color.android_red_light);
+
+ mActionEncryptFile.setVisibility(View.INVISIBLE);
+ mActionEncryptText.setVisibility(View.INVISIBLE);
+ mActionVerify.setVisibility(View.INVISIBLE);
+ mFab.setVisibility(View.INVISIBLE);
} else if (isExpired) {
mStatusText.setText(R.string.view_key_expired);
- KeyFormattingUtils.setStatusImage(this, mStatusImage, mStatusText, KeyFormattingUtils.STATE_EXPIRED);
- mStatusDivider.setVisibility(View.VISIBLE);
- mStatusLayout.setVisibility(View.VISIBLE);
+ mStatusImage.setVisibility(View.VISIBLE);
+ KeyFormattingUtils.setStatusImage(this, mStatusImage, mStatusText, KeyFormattingUtils.STATE_EXPIRED, R.color.icons);
+ color = getResources().getColor(R.color.android_red_light);
+
+ mActionEncryptFile.setVisibility(View.INVISIBLE);
+ mActionEncryptText.setVisibility(View.INVISIBLE);
+ mActionVerify.setVisibility(View.INVISIBLE);
+ mFab.setVisibility(View.INVISIBLE);
+ } else if (isSecret) {
+ mStatusText.setText(R.string.view_key_my_key);
+ mStatusImage.setVisibility(View.INVISIBLE);
+ color = getResources().getColor(R.color.primary);
+
+ mActionEncryptFile.setVisibility(View.VISIBLE);
+ mActionEncryptText.setVisibility(View.VISIBLE);
+ mActionVerify.setVisibility(View.INVISIBLE);
+ mFab.setVisibility(View.INVISIBLE); // TODO
} else {
- mStatusDivider.setVisibility(View.GONE);
- mStatusLayout.setVisibility(View.GONE);
+ mActionEncryptFile.setVisibility(View.VISIBLE);
+ mActionEncryptText.setVisibility(View.VISIBLE);
+
+ if (isVerified) {
+ mStatusText.setText(R.string.view_key_verified);
+ mStatusImage.setVisibility(View.VISIBLE);
+ KeyFormattingUtils.setStatusImage(this, mStatusImage, mStatusText, KeyFormattingUtils.STATE_VERIFIED, R.color.icons);
+ color = getResources().getColor(R.color.primary);
+
+ AsyncTask<String, Void, Bitmap> photoTask =
+ new AsyncTask<String, Void, Bitmap>() {
+ protected Bitmap doInBackground(String... fingerprint) {
+ return ContactHelper.photoFromFingerprint(getContentResolver(), fingerprint[0]);
+ }
+
+ protected void onPostExecute(Bitmap photo) {
+ mPhoto.setImageBitmap(photo);
+ mPhoto.setVisibility(View.VISIBLE);
+ }
+ };
+
+ photoTask.execute(fingerprint);
+
+ mActionVerify.setVisibility(View.INVISIBLE);
+ mFab.setVisibility(View.INVISIBLE);
+ } else {
+ mStatusText.setText(R.string.view_key_unverified);
+ mStatusImage.setVisibility(View.VISIBLE);
+ KeyFormattingUtils.setStatusImage(this, mStatusImage, mStatusText, KeyFormattingUtils.STATE_UNVERIFIED, R.color.icons);
+ color = getResources().getColor(R.color.android_orange_light);
+
+ mActionVerify.setVisibility(View.VISIBLE);
+ mFab.setVisibility(View.VISIBLE);
+ }
}
+ mToolbar.setBackgroundColor(color);
+ mStatusBar.setBackgroundColor(color);
+ mBigToolbar.setBackgroundColor(color);
break;
}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java
index 8e82dd7d0..598793233 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java
@@ -175,9 +175,9 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
}
if (entry.isRevoked()) {
- KeyFormattingUtils.setStatusImage(getContext(), holder.status, null, KeyFormattingUtils.STATE_REVOKED, true);
+ KeyFormattingUtils.setStatusImage(getContext(), holder.status, null, KeyFormattingUtils.STATE_REVOKED, R.color.bg_gray);
} else if (entry.isExpired()) {
- KeyFormattingUtils.setStatusImage(getContext(), holder.status, null, KeyFormattingUtils.STATE_EXPIRED, true);
+ KeyFormattingUtils.setStatusImage(getContext(), holder.status, null, KeyFormattingUtils.STATE_EXPIRED, R.color.bg_gray);
}
if (entry.isRevoked() || entry.isExpired()) {
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java
index e90b57c1c..a836b35df 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java
@@ -133,11 +133,11 @@ abstract public class SelectKeyCursorAdapter extends CursorAdapter {
boolean enabled;
if (cursor.getInt(mIndexIsRevoked) != 0) {
h.statusIcon.setVisibility(View.VISIBLE);
- KeyFormattingUtils.setStatusImage(mContext, h.statusIcon, null, KeyFormattingUtils.STATE_REVOKED, true);
+ KeyFormattingUtils.setStatusImage(mContext, h.statusIcon, null, KeyFormattingUtils.STATE_REVOKED, R.color.bg_gray);
enabled = false;
} else if (cursor.getInt(mIndexIsExpiry) != 0) {
h.statusIcon.setVisibility(View.VISIBLE);
- KeyFormattingUtils.setStatusImage(mContext, h.statusIcon, null, KeyFormattingUtils.STATE_EXPIRED, true);
+ KeyFormattingUtils.setStatusImage(mContext, h.statusIcon, null, KeyFormattingUtils.STATE_EXPIRED, R.color.bg_gray);
enabled = false;
} else {
h.statusIcon.setVisibility(View.GONE);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java
index 6281bb8b3..8e86efebe 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java
@@ -162,7 +162,7 @@ public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemC
if (isRevoked) {
// set revocation icon (can this even be primary?)
- KeyFormattingUtils.setStatusImage(mContext, vVerified, null, KeyFormattingUtils.STATE_REVOKED, true);
+ KeyFormattingUtils.setStatusImage(mContext, vVerified, null, KeyFormattingUtils.STATE_REVOKED, R.color.bg_gray);
// disable revoked user ids
vName.setEnabled(false);
@@ -184,13 +184,13 @@ public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemC
int isVerified = cursor.getInt(INDEX_VERIFIED);
switch (isVerified) {
case Certs.VERIFIED_SECRET:
- KeyFormattingUtils.setStatusImage(mContext, vVerified, null, KeyFormattingUtils.STATE_VERIFIED, false);
+ KeyFormattingUtils.setStatusImage(mContext, vVerified, null, KeyFormattingUtils.STATE_VERIFIED, KeyFormattingUtils.DEFAULT_COLOR);
break;
case Certs.VERIFIED_SELF:
- KeyFormattingUtils.setStatusImage(mContext, vVerified, null, KeyFormattingUtils.STATE_UNVERIFIED, false);
+ KeyFormattingUtils.setStatusImage(mContext, vVerified, null, KeyFormattingUtils.STATE_UNVERIFIED, KeyFormattingUtils.DEFAULT_COLOR);
break;
default:
- KeyFormattingUtils.setStatusImage(mContext, vVerified, null, KeyFormattingUtils.STATE_INVALID, false);
+ KeyFormattingUtils.setStatusImage(mContext, vVerified, null, KeyFormattingUtils.STATE_INVALID, KeyFormattingUtils.DEFAULT_COLOR);
break;
}
}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/KeyFormattingUtils.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/KeyFormattingUtils.java
index bff7d6b27..1c3dec629 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/KeyFormattingUtils.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/KeyFormattingUtils.java
@@ -377,6 +377,8 @@ public class KeyFormattingUtils {
((int) digest[2] + 256) % 256};
}
+ public static final int DEFAULT_COLOR = -1;
+
public static final int STATE_REVOKED = 1;
public static final int STATE_EXPIRED = 2;
public static final int STATE_VERIFIED = 3;
@@ -393,20 +395,22 @@ public class KeyFormattingUtils {
}
public static void setStatusImage(Context context, ImageView statusIcon, TextView statusText, int state) {
- setStatusImage(context, statusIcon, statusText, state, false);
+ setStatusImage(context, statusIcon, statusText, state, KeyFormattingUtils.DEFAULT_COLOR);
}
/**
* Sets status image based on constant
*/
public static void setStatusImage(Context context, ImageView statusIcon, TextView statusText,
- int state, boolean unobtrusive) {
+ int state, int color) {
switch (state) {
/** GREEN: everything is good **/
case STATE_VERIFIED: {
statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_signature_verified_cutout));
- int color = R.color.android_green_light;
+ if (color == KeyFormattingUtils.DEFAULT_COLOR) {
+ color = R.color.android_green_light;
+ }
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
if (statusText != null) {
@@ -417,7 +421,9 @@ public class KeyFormattingUtils {
case STATE_ENCRYPTED: {
statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_lock_closed));
- int color = R.color.android_green_light;
+ if (color == KeyFormattingUtils.DEFAULT_COLOR) {
+ color = R.color.android_green_light;
+ }
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
if (statusText != null) {
@@ -429,7 +435,9 @@ public class KeyFormattingUtils {
case STATE_UNVERIFIED: {
statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_signature_unverified_cutout));
- int color = R.color.android_orange_light;
+ if (color == KeyFormattingUtils.DEFAULT_COLOR) {
+ color = R.color.android_orange_light;
+ }
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
if (statusText != null) {
@@ -440,7 +448,9 @@ public class KeyFormattingUtils {
case STATE_UNKNOWN_KEY: {
statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_signature_unknown_cutout));
- int color = R.color.android_orange_light;
+ if (color == KeyFormattingUtils.DEFAULT_COLOR) {
+ color = R.color.android_orange_light;
+ }
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
if (statusText != null) {
@@ -452,9 +462,8 @@ public class KeyFormattingUtils {
case STATE_REVOKED: {
statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_signature_revoked_cutout));
- int color = R.color.android_red_light;
- if (unobtrusive) {
- color = R.color.bg_gray;
+ if (color == KeyFormattingUtils.DEFAULT_COLOR) {
+ color = R.color.android_red_light;
}
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
@@ -466,9 +475,8 @@ public class KeyFormattingUtils {
case STATE_EXPIRED: {
statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_signature_expired_cutout));
- int color = R.color.android_red_light;
- if (unobtrusive) {
- color = R.color.bg_gray;
+ if (color == KeyFormattingUtils.DEFAULT_COLOR) {
+ color = R.color.android_red_light;
}
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
@@ -480,7 +488,9 @@ public class KeyFormattingUtils {
case STATE_NOT_ENCRYPTED: {
statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_lock_open));
- int color = R.color.android_red_light;
+ if (color == KeyFormattingUtils.DEFAULT_COLOR) {
+ color = R.color.android_red_light;
+ }
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
if (statusText != null) {
@@ -491,7 +501,9 @@ public class KeyFormattingUtils {
case STATE_NOT_SIGNED: {
statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_signature_unknown_cutout));
- int color = R.color.android_red_light;
+ if (color == KeyFormattingUtils.DEFAULT_COLOR) {
+ color = R.color.android_red_light;
+ }
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
if (statusText != null) {
@@ -502,7 +514,9 @@ public class KeyFormattingUtils {
case STATE_INVALID: {
statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_signature_invalid_cutout));
- int color = R.color.android_red_light;
+ if (color == KeyFormattingUtils.DEFAULT_COLOR) {
+ color = R.color.android_red_light;
+ }
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
if (statusText != null) {
@@ -514,7 +528,9 @@ public class KeyFormattingUtils {
case STATE_UNAVAILABLE: {
statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_signature_invalid_cutout));
- int color = R.color.bg_gray;
+ if (color == KeyFormattingUtils.DEFAULT_COLOR) {
+ color = R.color.bg_gray;
+ }
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
if (statusText != null) {
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/AspectRatioImageView.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/AspectRatioImageView.java
new file mode 100644
index 000000000..0df5ba5e8
--- /dev/null
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/AspectRatioImageView.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2015 Dominik Schürmann <dominik@dominikschuermann.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package org.sufficientlysecure.keychain.ui.widget;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.util.AttributeSet;
+import android.widget.ImageView;
+
+import org.sufficientlysecure.keychain.R;
+
+/**
+ * Maintains an aspect ratio based on either width or height. Disabled by default.
+ *
+ * from https://gist.github.com/JakeWharton/2856179
+ */
+public class AspectRatioImageView extends ImageView {
+ // NOTE: These must be kept in sync with the AspectRatioImageView attributes in attrs.xml.
+ public static final int MEASUREMENT_WIDTH = 0;
+ public static final int MEASUREMENT_HEIGHT = 1;
+
+ private static final float DEFAULT_ASPECT_RATIO = 1f;
+ private static final boolean DEFAULT_ASPECT_RATIO_ENABLED = false;
+ private static final int DEFAULT_DOMINANT_MEASUREMENT = MEASUREMENT_WIDTH;
+
+ private float aspectRatio;
+ private boolean aspectRatioEnabled;
+ private int dominantMeasurement;
+
+ public AspectRatioImageView(Context context) {
+ this(context, null);
+ }
+
+ public AspectRatioImageView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AspectRatioImageView);
+ aspectRatio = a.getFloat(R.styleable.AspectRatioImageView_aspectRatio, DEFAULT_ASPECT_RATIO);
+ aspectRatioEnabled = a.getBoolean(R.styleable.AspectRatioImageView_aspectRatioEnabled,
+ DEFAULT_ASPECT_RATIO_ENABLED);
+ dominantMeasurement = a.getInt(R.styleable.AspectRatioImageView_dominantMeasurement,
+ DEFAULT_DOMINANT_MEASUREMENT);
+ a.recycle();
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ if (!aspectRatioEnabled) return;
+
+ int newWidth;
+ int newHeight;
+ switch (dominantMeasurement) {
+ case MEASUREMENT_WIDTH:
+ newWidth = getMeasuredWidth();
+ newHeight = (int) (newWidth * aspectRatio);
+ break;
+
+ case MEASUREMENT_HEIGHT:
+ newHeight = getMeasuredHeight();
+ newWidth = (int) (newHeight * aspectRatio);
+ break;
+
+ default:
+ throw new IllegalStateException("Unknown measurement with ID " + dominantMeasurement);
+ }
+
+ setMeasuredDimension(newWidth, newHeight);
+ }
+
+ /**
+ * Get the aspect ratio for this image view.
+ */
+ public float getAspectRatio() {
+ return aspectRatio;
+ }
+
+ /**
+ * Set the aspect ratio for this image view. This will update the view instantly.
+ */
+ public void setAspectRatio(float aspectRatio) {
+ this.aspectRatio = aspectRatio;
+ if (aspectRatioEnabled) {
+ requestLayout();
+ }
+ }
+
+ /**
+ * Get whether or not forcing the aspect ratio is enabled.
+ */
+ public boolean getAspectRatioEnabled() {
+ return aspectRatioEnabled;
+ }
+
+ /**
+ * set whether or not forcing the aspect ratio is enabled. This will re-layout the view.
+ */
+ public void setAspectRatioEnabled(boolean aspectRatioEnabled) {
+ this.aspectRatioEnabled = aspectRatioEnabled;
+ requestLayout();
+ }
+
+ /**
+ * Get the dominant measurement for the aspect ratio.
+ */
+ public int getDominantMeasurement() {
+ return dominantMeasurement;
+ }
+
+ /**
+ * Set the dominant measurement for the aspect ratio.
+ *
+ * @see #MEASUREMENT_WIDTH
+ * @see #MEASUREMENT_HEIGHT
+ */
+ public void setDominantMeasurement(int dominantMeasurement) {
+ if (dominantMeasurement != MEASUREMENT_HEIGHT && dominantMeasurement != MEASUREMENT_WIDTH) {
+ throw new IllegalArgumentException("Invalid measurement type.");
+ }
+ this.dominantMeasurement = dominantMeasurement;
+ requestLayout();
+ }
+} \ No newline at end of file
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertifyKeySpinner.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertifyKeySpinner.java
index 904cde47e..25033658d 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertifyKeySpinner.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertifyKeySpinner.java
@@ -27,6 +27,7 @@ import android.util.AttributeSet;
import android.widget.ImageView;
import org.sufficientlysecure.keychain.Constants;
+import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.KeychainDatabase;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
@@ -101,16 +102,16 @@ public class CertifyKeySpinner extends KeySpinner {
@Override
boolean setStatus(Context context, Cursor cursor, ImageView statusView) {
if (cursor.getInt(mIndexIsRevoked) != 0) {
- KeyFormattingUtils.setStatusImage(getContext(), statusView, null, KeyFormattingUtils.STATE_REVOKED, true);
+ KeyFormattingUtils.setStatusImage(getContext(), statusView, null, KeyFormattingUtils.STATE_REVOKED, R.color.bg_gray);
return false;
}
if (cursor.getInt(mIndexIsExpired) != 0) {
- KeyFormattingUtils.setStatusImage(getContext(), statusView, null, KeyFormattingUtils.STATE_EXPIRED, true);
+ KeyFormattingUtils.setStatusImage(getContext(), statusView, null, KeyFormattingUtils.STATE_EXPIRED, R.color.bg_gray);
return false;
}
// don't invalidate the "None" entry, which is also null!
if (cursor.getPosition() != 0 && cursor.isNull(mIndexHasCertify)) {
- KeyFormattingUtils.setStatusImage(getContext(), statusView, null, KeyFormattingUtils.STATE_UNAVAILABLE, true);
+ KeyFormattingUtils.setStatusImage(getContext(), statusView, null, KeyFormattingUtils.STATE_UNAVAILABLE, R.color.bg_gray);
return false;
}
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 9c8e4aedb..fe91e306e 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
@@ -26,6 +26,7 @@ import android.support.v4.content.Loader;
import android.util.AttributeSet;
import android.widget.ImageView;
+import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
@@ -83,15 +84,15 @@ public class SignKeySpinner extends KeySpinner {
@Override
boolean setStatus(Context context, Cursor cursor, ImageView statusView) {
if (cursor.getInt(mIndexIsRevoked) != 0) {
- KeyFormattingUtils.setStatusImage(getContext(), statusView, null, KeyFormattingUtils.STATE_REVOKED, true);
+ KeyFormattingUtils.setStatusImage(getContext(), statusView, null, KeyFormattingUtils.STATE_REVOKED, R.color.bg_gray);
return false;
}
if (cursor.getInt(mIndexIsExpired) != 0) {
- KeyFormattingUtils.setStatusImage(getContext(), statusView, null, KeyFormattingUtils.STATE_EXPIRED, true);
+ KeyFormattingUtils.setStatusImage(getContext(), statusView, null, KeyFormattingUtils.STATE_EXPIRED, R.color.bg_gray);
return false;
}
if (cursor.getInt(mIndexHasSign) == 0) {
- KeyFormattingUtils.setStatusImage(getContext(), statusView, null, KeyFormattingUtils.STATE_UNAVAILABLE, true);
+ KeyFormattingUtils.setStatusImage(getContext(), statusView, null, KeyFormattingUtils.STATE_UNAVAILABLE, R.color.bg_gray);
return false;
}
diff --git a/OpenKeychain/src/main/res/drawable-hdpi/ic_action_encrypt_file.png b/OpenKeychain/src/main/res/drawable-hdpi/ic_action_encrypt_file.png
new file mode 100644
index 000000000..1e397ebed
--- /dev/null
+++ b/OpenKeychain/src/main/res/drawable-hdpi/ic_action_encrypt_file.png
Binary files differ
diff --git a/OpenKeychain/src/main/res/drawable-hdpi/ic_action_encrypt_text.png b/OpenKeychain/src/main/res/drawable-hdpi/ic_action_encrypt_text.png
new file mode 100644
index 000000000..1cbd993a7
--- /dev/null
+++ b/OpenKeychain/src/main/res/drawable-hdpi/ic_action_encrypt_text.png
Binary files differ
diff --git a/OpenKeychain/src/main/res/drawable-hdpi/ic_action_verified_cutout.png b/OpenKeychain/src/main/res/drawable-hdpi/ic_action_verified_cutout.png
new file mode 100644
index 000000000..896aca575
--- /dev/null
+++ b/OpenKeychain/src/main/res/drawable-hdpi/ic_action_verified_cutout.png
Binary files differ
diff --git a/OpenKeychain/src/main/res/drawable-mdpi/ic_action_encrypt_file.png b/OpenKeychain/src/main/res/drawable-mdpi/ic_action_encrypt_file.png
new file mode 100644
index 000000000..06a054160
--- /dev/null
+++ b/OpenKeychain/src/main/res/drawable-mdpi/ic_action_encrypt_file.png
Binary files differ
diff --git a/OpenKeychain/src/main/res/drawable-mdpi/ic_action_encrypt_text.png b/OpenKeychain/src/main/res/drawable-mdpi/ic_action_encrypt_text.png
new file mode 100644
index 000000000..97cb03def
--- /dev/null
+++ b/OpenKeychain/src/main/res/drawable-mdpi/ic_action_encrypt_text.png
Binary files differ
diff --git a/OpenKeychain/src/main/res/drawable-mdpi/ic_action_verified_cutout.png b/OpenKeychain/src/main/res/drawable-mdpi/ic_action_verified_cutout.png
new file mode 100644
index 000000000..0329b488f
--- /dev/null
+++ b/OpenKeychain/src/main/res/drawable-mdpi/ic_action_verified_cutout.png
Binary files differ
diff --git a/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_encrypt_file.png b/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_encrypt_file.png
new file mode 100644
index 000000000..5f528864d
--- /dev/null
+++ b/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_encrypt_file.png
Binary files differ
diff --git a/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_encrypt_text.png b/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_encrypt_text.png
new file mode 100644
index 000000000..f8867e922
--- /dev/null
+++ b/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_encrypt_text.png
Binary files differ
diff --git a/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_verified_cutout.png b/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_verified_cutout.png
new file mode 100644
index 000000000..116adf28d
--- /dev/null
+++ b/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_verified_cutout.png
Binary files differ
diff --git a/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_encrypt_file.png b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_encrypt_file.png
new file mode 100644
index 000000000..c77329563
--- /dev/null
+++ b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_encrypt_file.png
Binary files differ
diff --git a/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_encrypt_text.png b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_encrypt_text.png
new file mode 100644
index 000000000..15650500d
--- /dev/null
+++ b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_encrypt_text.png
Binary files differ
diff --git a/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_verified_cutout.png b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_verified_cutout.png
new file mode 100644
index 000000000..49b13017c
--- /dev/null
+++ b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_verified_cutout.png
Binary files differ
diff --git a/OpenKeychain/src/main/res/layout/view_key_activity.xml b/OpenKeychain/src/main/res/layout/view_key_activity.xml
index f9c23f065..ad46a8d62 100644
--- a/OpenKeychain/src/main/res/layout/view_key_activity.xml
+++ b/OpenKeychain/src/main/res/layout/view_key_activity.xml
@@ -9,11 +9,22 @@
<RelativeLayout
android:id="@+id/toolbar_big"
android:layout_width="match_parent"
- android:layout_height="@dimen/big_toolbar"
+ android:layout_height="@dimen/huge_toolbar"
android:elevation="4dp"
android:background="?attr/colorPrimary"
android:orientation="horizontal">
+ <org.sufficientlysecure.keychain.ui.widget.AspectRatioImageView
+ android:id="@+id/view_key_photo"
+ app:aspectRatioEnabled="true"
+ android:visibility="gone"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/status_bar"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
+ android:src="@drawable/first_time_1" />
+
<ImageView
android:id="@+id/status_bar"
android:layout_width="match_parent"
@@ -26,7 +37,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
- android:background="?attr/colorPrimary"
android:overScrollMode="always"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
@@ -35,46 +45,84 @@
android:touchscreenBlocksFocus="false" />
<LinearLayout
- android:layout_below="@+id/toolbar"
- android:layout_marginLeft="48dp"
- android:layout_marginRight="72dp"
+ android:id="@+id/name_layout"
+ android:orientation="horizontal"
+ android:layout_marginLeft="16dp"
+ android:layout_marginStart="16dp"
+ android:layout_above="@+id/toolbar2"
android:layout_width="match_parent"
android:layout_height="wrap_content">
- <LinearLayout
- android:id="@+id/view_key_status_layout"
- android:layout_width="wrap_content"
+ <ImageView
+ android:id="@+id/view_key_status_image"
+ android:layout_width="24dp"
+ android:visibility="invisible"
+ android:src="@drawable/status_signature_unverified_cutout"
android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:layout_marginTop="8dp"
- android:layout_marginBottom="8dp"
- android:orientation="horizontal">
+ android:layout_gravity="center_vertical"
+ android:layout_marginLeft="2dp" />
- <ImageView
- android:id="@+id/view_key_status_image"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_marginLeft="8dp"
+ android:layout_marginStart="8dp"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
<TextView
- android:id="@+id/view_key_status_text"
+ android:id="@+id/view_key_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:layout_gravity="center_vertical"
- android:layout_marginLeft="8dp" />
+ android:text=""
+ android:textColor="@color/icons"
+ android:textAppearance="?android:attr/textAppearanceLarge" />
+ <TextView
+ android:id="@+id/view_key_status"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text=""
+ android:textColor="@color/tab_text"
+ android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
- <TextView
- android:id="@+id/api_app_settings_app_name"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Name (set in-code)longlong"
- android:textColor="@color/icons"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:paddingLeft="8dp"
- android:layout_gravity="center_vertical" />
</LinearLayout>
+
+
+ <LinearLayout
+ android:id="@+id/toolbar2"
+ android:orientation="horizontal"
+ android:layout_alignParentBottom="true"
+ android:layout_width="match_parent"
+ android:minHeight="?attr/actionBarSize"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
+ android:layout_marginLeft="32dp">
+
+ <ImageButton
+ android:id="@+id/view_key_action_encrypt_files"
+ android:layout_width="64dp"
+ android:layout_height="64dp"
+ style="?android:attr/borderlessButtonStyle"
+ android:src="@drawable/ic_action_encrypt_file" />
+
+ <ImageButton
+ android:id="@+id/view_key_action_encrypt_text"
+ android:layout_width="64dp"
+ android:layout_height="64dp"
+ style="?android:attr/borderlessButtonStyle"
+ android:src="@drawable/ic_action_encrypt_text" />
+
+ <ImageButton
+ android:id="@+id/view_key_action_verify"
+ android:layout_width="64dp"
+ android:layout_height="64dp"
+ android:visibility="invisible"
+ style="?android:attr/borderlessButtonStyle"
+ android:src="@drawable/ic_action_verified_cutout" />
+ </LinearLayout>
+
</RelativeLayout>
<LinearLayout
diff --git a/OpenKeychain/src/main/res/menu/key_view2.xml b/OpenKeychain/src/main/res/menu/key_view2.xml
new file mode 100644
index 000000000..d928bee36
--- /dev/null
+++ b/OpenKeychain/src/main/res/menu/key_view2.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+
+ <item
+ android:id="@+id/menu_key_view_refresh"
+ android:icon="@drawable/ic_refresh_white_24dp"
+ app:showAsAction="always"
+ android:title="@string/key_view_action_update" />
+
+</menu> \ No newline at end of file
diff --git a/OpenKeychain/src/main/res/values-v21/dimens.xml b/OpenKeychain/src/main/res/values-v21/dimens.xml
index 3a85cca93..eee21b52e 100644
--- a/OpenKeychain/src/main/res/values-v21/dimens.xml
+++ b/OpenKeychain/src/main/res/values-v21/dimens.xml
@@ -7,4 +7,5 @@
<dimen name="statusbar_height">24dp</dimen>
<!-- 120dp + statusbar_height -->
<dimen name="big_toolbar">141dp</dimen>
+ <dimen name="huge_toolbar">233dp</dimen>
</resources> \ No newline at end of file
diff --git a/OpenKeychain/src/main/res/values/attr.xml b/OpenKeychain/src/main/res/values/attr.xml
index 5dfa03987..98ce1c364 100644
--- a/OpenKeychain/src/main/res/values/attr.xml
+++ b/OpenKeychain/src/main/res/values/attr.xml
@@ -6,4 +6,13 @@
<attr name="unFoldedLabel" format="string" />
</declare-styleable>
+ <declare-styleable name="AspectRatioImageView">
+ <attr name="aspectRatio" format="float" />
+ <attr name="aspectRatioEnabled" format="boolean" />
+ <attr name="dominantMeasurement">
+ <enum name="width" value="0" />
+ <enum name="height" value="1" />
+ </attr>
+ </declare-styleable>
+
</resources> \ No newline at end of file
diff --git a/OpenKeychain/src/main/res/values/dimens.xml b/OpenKeychain/src/main/res/values/dimens.xml
index 7e361a358..08b072202 100644
--- a/OpenKeychain/src/main/res/values/dimens.xml
+++ b/OpenKeychain/src/main/res/values/dimens.xml
@@ -3,4 +3,5 @@
<!-- on Android < 5, we do not color the status bar, thus 0dp! -->
<dimen name="statusbar_height">0dp</dimen>
<dimen name="big_toolbar">120dp</dimen>
+ <dimen name="huge_toolbar">212dp</dimen>
</resources> \ No newline at end of file
diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml
index 4a56274d7..730746787 100644
--- a/OpenKeychain/src/main/res/values/strings.xml
+++ b/OpenKeychain/src/main/res/values/strings.xml
@@ -582,8 +582,11 @@
<string name="create_key_edit">"Change key configuration"</string>
<!-- View key -->
- <string name="view_key_revoked">"This key has been revoked!"</string>
- <string name="view_key_expired">"This key is expired!"</string>
+ <string name="view_key_revoked">"Revoked: Key must not be used anymore!"</string>
+ <string name="view_key_expired">"Expired: The contact needs to extend the keys validity!"</string>
+ <string name="view_key_my_key">"My Key"</string>
+ <string name="view_key_verified">"Verified Key"</string>
+ <string name="view_key_unverified">"Unverified: Scan QR Code to verify key!"</string>
<!-- Navigation Drawer -->
<string name="nav_keys">"Keys"</string>