aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2014-07-08 03:34:27 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2014-07-08 03:34:27 +0200
commit5adcb7885cf9629b1ef60b26e76a4c9a8b1f7845 (patch)
tree6aba250e3aeede17de6eb77a3eb070702a72542b
parent3363507be48e6ee77341fc8d637528610dc5136f (diff)
downloadopen-keychain-5adcb7885cf9629b1ef60b26e76a4c9a8b1f7845.tar.gz
open-keychain-5adcb7885cf9629b1ef60b26e76a4c9a8b1f7845.tar.bz2
open-keychain-5adcb7885cf9629b1ef60b26e76a4c9a8b1f7845.zip
Work on subkeys adapter
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java51
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SubkeysAdapter.java127
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java10
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/EditSubkeyDialogFragment.java110
-rw-r--r--OpenKeychain/src/main/res/layout/edit_key_fragment.xml30
-rw-r--r--OpenKeychain/src/main/res/layout/view_key_subkey_item.xml (renamed from OpenKeychain/src/main/res/layout/view_key_keys_item.xml)42
-rw-r--r--OpenKeychain/src/main/res/layout/view_key_user_id_item.xml (renamed from OpenKeychain/src/main/res/layout/view_key_userids_item.xml)1
-rw-r--r--OpenKeychain/src/main/res/values/strings.xml5
8 files changed, 310 insertions, 66 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java
index c76dc0164..78ccafcbc 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java
@@ -54,6 +54,7 @@ import org.sufficientlysecure.keychain.ui.adapter.SubkeysAdapter;
import org.sufficientlysecure.keychain.ui.adapter.SubkeysAddedAdapter;
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter;
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAddedAdapter;
+import org.sufficientlysecure.keychain.ui.dialog.EditSubkeyDialogFragment;
import org.sufficientlysecure.keychain.ui.dialog.EditUserIdDialogFragment;
import org.sufficientlysecure.keychain.ui.dialog.PassphraseDialogFragment;
import org.sufficientlysecure.keychain.ui.dialog.SetPassphraseDialogFragment;
@@ -214,9 +215,17 @@ public class EditKeyFragment extends LoaderFragment implements
mUserIdsAddedAdapter = new UserIdsAddedAdapter(getActivity(), mUserIdsAddedData);
mUserIdsAddedList.setAdapter(mUserIdsAddedAdapter);
- mSubkeysAdapter = new SubkeysAdapter(getActivity(), null, 0);
+ mSubkeysAdapter = new SubkeysAdapter(getActivity(), null, 0, mSaveKeyringParcel);
mSubkeysList.setAdapter(mSubkeysAdapter);
+ mSubkeysList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ long keyId = mSubkeysAdapter.getKeyId(position);
+ editSubkey(keyId);
+ }
+ });
+
mSubkeysAddedAdapter = new SubkeysAddedAdapter(getActivity(), mSaveKeyringParcel.addSubKeys);
mSubkeysAddedList.setAdapter(mSubkeysAddedAdapter);
@@ -342,6 +351,46 @@ public class EditKeyFragment extends LoaderFragment implements
});
}
+ private void editSubkey(final long keyId) {
+ Handler returnHandler = new Handler() {
+ @Override
+ public void handleMessage(Message message) {
+ switch (message.what) {
+ case EditSubkeyDialogFragment.MESSAGE_CHANGE_EXPIRY:
+ // toggle
+// if (mSaveKeyringParcel.changePrimaryUserId != null
+// && mSaveKeyringParcel.changePrimaryUserId.equals(userId)) {
+// mSaveKeyringParcel.changePrimaryUserId = null;
+// } else {
+// mSaveKeyringParcel.changePrimaryUserId = userId;
+// }
+ break;
+ case EditSubkeyDialogFragment.MESSAGE_REVOKE:
+ // toggle
+ if (mSaveKeyringParcel.revokeSubKeys.contains(keyId)) {
+ mSaveKeyringParcel.revokeSubKeys.remove(keyId);
+ } else {
+ mSaveKeyringParcel.revokeSubKeys.add(keyId);
+ }
+ break;
+ }
+ getLoaderManager().getLoader(LOADER_ID_SUBKEYS).forceLoad();
+ }
+ };
+
+ // Create a new Messenger for the communication back
+ final Messenger messenger = new Messenger(returnHandler);
+
+ DialogFragmentWorkaround.INTERFACE.runnableRunDelayed(new Runnable() {
+ public void run() {
+ EditSubkeyDialogFragment dialogFragment =
+ EditSubkeyDialogFragment.newInstance(messenger);
+
+ dialogFragment.show(getActivity().getSupportFragmentManager(), "editSubkeyDialog");
+ }
+ });
+ }
+
private void addUserId() {
mUserIdsAddedAdapter.add(new UserIdsAddedAdapter.UserIdModel());
}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SubkeysAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SubkeysAdapter.java
index 02b1f31e2..ccc5960c8 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SubkeysAdapter.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SubkeysAdapter.java
@@ -32,14 +32,15 @@ import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.helper.OtherHelper;
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
import org.sufficientlysecure.keychain.provider.KeychainContract.Keys;
+import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
import java.util.Date;
public class SubkeysAdapter extends CursorAdapter {
private LayoutInflater mInflater;
+ private SaveKeyringParcel mSaveKeyringParcel;
private boolean hasAnySecret;
-
private ColorStateList mDefaultTextColor;
public static final String[] SUBKEYS_PROJECTION = new String[]{
@@ -71,10 +72,21 @@ public class SubkeysAdapter extends CursorAdapter {
private static final int INDEX_EXPIRY = 11;
private static final int INDEX_FINGERPRINT = 12;
- public SubkeysAdapter(Context context, Cursor c, int flags) {
+ public SubkeysAdapter(Context context, Cursor c, int flags,
+ SaveKeyringParcel saveKeyringParcel) {
super(context, c, flags);
mInflater = LayoutInflater.from(context);
+ mSaveKeyringParcel = saveKeyringParcel;
+ }
+
+ public SubkeysAdapter(Context context, Cursor c, int flags) {
+ this(context, c, flags, null);
+ }
+
+ public long getKeyId(int position) {
+ mCursor.moveToPosition(position);
+ return mCursor.getLong(INDEX_KEY_ID);
}
@Override
@@ -94,79 +106,94 @@ public class SubkeysAdapter extends CursorAdapter {
@Override
public void bindView(View view, Context context, Cursor cursor) {
- TextView keyId = (TextView) view.findViewById(R.id.keyId);
- TextView keyDetails = (TextView) view.findViewById(R.id.keyDetails);
- TextView keyExpiry = (TextView) view.findViewById(R.id.keyExpiry);
- ImageView masterKeyIcon = (ImageView) view.findViewById(R.id.ic_masterKey);
- ImageView certifyIcon = (ImageView) view.findViewById(R.id.ic_certifyKey);
- ImageView encryptIcon = (ImageView) view.findViewById(R.id.ic_encryptKey);
- ImageView signIcon = (ImageView) view.findViewById(R.id.ic_signKey);
- ImageView revokedKeyIcon = (ImageView) view.findViewById(R.id.ic_revokedKey);
-
- String keyIdStr = PgpKeyHelper.convertKeyIdToHex(cursor.getLong(INDEX_KEY_ID));
+ TextView vKeyId = (TextView) view.findViewById(R.id.keyId);
+ TextView vKeyDetails = (TextView) view.findViewById(R.id.keyDetails);
+ TextView vKeyExpiry = (TextView) view.findViewById(R.id.keyExpiry);
+ ImageView vMasterKeyIcon = (ImageView) view.findViewById(R.id.ic_masterKey);
+ ImageView vCertifyIcon = (ImageView) view.findViewById(R.id.ic_certifyKey);
+ ImageView vEncryptIcon = (ImageView) view.findViewById(R.id.ic_encryptKey);
+ ImageView vSignIcon = (ImageView) view.findViewById(R.id.ic_signKey);
+ ImageView vRevokedKeyIcon = (ImageView) view.findViewById(R.id.ic_revokedKey);
+ ImageView vEditImage = (ImageView) view.findViewById(R.id.edit_image);
+
+ long keyId = cursor.getLong(INDEX_KEY_ID);
+ String keyIdStr = PgpKeyHelper.convertKeyIdToHex(keyId);
String algorithmStr = PgpKeyHelper.getAlgorithmInfo(
context,
cursor.getInt(INDEX_ALGORITHM),
cursor.getInt(INDEX_KEY_SIZE)
);
- keyId.setText(keyIdStr);
+ vKeyId.setText(keyIdStr);
// may be set with additional "stripped" later on
if (hasAnySecret && cursor.getInt(INDEX_HAS_SECRET) == 0) {
- keyDetails.setText(algorithmStr + ", " +
+ vKeyDetails.setText(algorithmStr + ", " +
context.getString(R.string.key_stripped));
} else {
- keyDetails.setText(algorithmStr);
+ vKeyDetails.setText(algorithmStr);
}
// Set icons according to properties
- masterKeyIcon.setVisibility(cursor.getInt(INDEX_RANK) == 0 ? View.VISIBLE : View.INVISIBLE);
- certifyIcon.setVisibility(cursor.getInt(INDEX_CAN_CERTIFY) != 0 ? View.VISIBLE : View.GONE);
- encryptIcon.setVisibility(cursor.getInt(INDEX_CAN_ENCRYPT) != 0 ? View.VISIBLE : View.GONE);
- signIcon.setVisibility(cursor.getInt(INDEX_CAN_SIGN) != 0 ? View.VISIBLE : View.GONE);
+ vMasterKeyIcon.setVisibility(cursor.getInt(INDEX_RANK) == 0 ? View.VISIBLE : View.INVISIBLE);
+ vCertifyIcon.setVisibility(cursor.getInt(INDEX_CAN_CERTIFY) != 0 ? View.VISIBLE : View.GONE);
+ vEncryptIcon.setVisibility(cursor.getInt(INDEX_CAN_ENCRYPT) != 0 ? View.VISIBLE : View.GONE);
+ vSignIcon.setVisibility(cursor.getInt(INDEX_CAN_SIGN) != 0 ? View.VISIBLE : View.GONE);
+
+ boolean isRevoked = cursor.getInt(INDEX_IS_REVOKED) > 0;
+
+ // for edit key
+ if (mSaveKeyringParcel != null) {
+ boolean revokeThisSubkey = (mSaveKeyringParcel.revokeSubKeys.contains(keyId));
- boolean valid = true;
- if (cursor.getInt(INDEX_IS_REVOKED) > 0) {
- revokedKeyIcon.setVisibility(View.VISIBLE);
+ if (revokeThisSubkey) {
+ if (!isRevoked) {
+ isRevoked = true;
+ }
+ }
- valid = false;
+ vEditImage.setVisibility(View.VISIBLE);
} else {
- keyId.setTextColor(mDefaultTextColor);
- keyDetails.setTextColor(mDefaultTextColor);
- keyExpiry.setTextColor(mDefaultTextColor);
+ vEditImage.setVisibility(View.GONE);
+ }
- revokedKeyIcon.setVisibility(View.GONE);
+ if (isRevoked) {
+ vRevokedKeyIcon.setVisibility(View.VISIBLE);
+ } else {
+ vKeyId.setTextColor(mDefaultTextColor);
+ vKeyDetails.setTextColor(mDefaultTextColor);
+ vKeyExpiry.setTextColor(mDefaultTextColor);
+
+ vRevokedKeyIcon.setVisibility(View.GONE);
}
+ boolean isExpired;
if (!cursor.isNull(INDEX_EXPIRY)) {
Date expiryDate = new Date(cursor.getLong(INDEX_EXPIRY) * 1000);
+ isExpired = expiryDate.before(new Date());
- valid = valid && expiryDate.after(new Date());
- keyExpiry.setText(
- context.getString(R.string.label_expiry) + ": " +
- DateFormat.getDateFormat(context).format(expiryDate)
- );
+ vKeyExpiry.setText(context.getString(R.string.label_expiry) + ": "
+ + DateFormat.getDateFormat(context).format(expiryDate));
} else {
- keyExpiry.setText(
- context.getString(R.string.label_expiry) + ": " +
- context.getString(R.string.none)
- );
+ isExpired = false;
+
+ vKeyExpiry.setText(context.getString(R.string.label_expiry) + ": " + context.getString(R.string.none));
}
// if key is expired or revoked, strike through text
- if (!valid) {
- keyId.setText(OtherHelper.strikeOutText(keyId.getText()));
- keyDetails.setText(OtherHelper.strikeOutText(keyDetails.getText()));
- keyExpiry.setText(OtherHelper.strikeOutText(keyExpiry.getText()));
+ boolean isInvalid = isRevoked || isExpired;
+ if (isInvalid) {
+ vKeyId.setText(OtherHelper.strikeOutText(vKeyId.getText()));
+ vKeyDetails.setText(OtherHelper.strikeOutText(vKeyDetails.getText()));
+ vKeyExpiry.setText(OtherHelper.strikeOutText(vKeyExpiry.getText()));
}
- keyId.setEnabled(valid);
- keyDetails.setEnabled(valid);
- keyExpiry.setEnabled(valid);
+ vKeyId.setEnabled(!isInvalid);
+ vKeyDetails.setEnabled(!isInvalid);
+ vKeyExpiry.setEnabled(!isInvalid);
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
- View view = mInflater.inflate(R.layout.view_key_keys_item, null);
+ View view = mInflater.inflate(R.layout.view_key_subkey_item, null);
if (mDefaultTextColor == null) {
TextView keyId = (TextView) view.findViewById(R.id.keyId);
mDefaultTextColor = keyId.getTextColors();
@@ -177,13 +204,21 @@ public class SubkeysAdapter extends CursorAdapter {
// Disable selection of items, http://stackoverflow.com/a/4075045
@Override
public boolean areAllItemsEnabled() {
- return false;
+ if (mSaveKeyringParcel == null) {
+ return false;
+ } else {
+ return super.areAllItemsEnabled();
+ }
}
// Disable selection of items, http://stackoverflow.com/a/4075045
@Override
public boolean isEnabled(int position) {
- return false;
+ if (mSaveKeyringParcel == null) {
+ return false;
+ } else {
+ return super.isEnabled(position);
+ }
}
}
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 d729648e5..10e299ae3 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
@@ -40,9 +40,7 @@ import java.util.ArrayList;
public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemClickListener {
private LayoutInflater mInflater;
-
private final ArrayList<Boolean> mCheckStates;
-
private SaveKeyringParcel mSaveKeyringParcel;
public static final String[] USER_IDS_PROJECTION = new String[]{
@@ -60,7 +58,6 @@ public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemC
private static final int INDEX_IS_PRIMARY = 4;
private static final int INDEX_IS_REVOKED = 5;
-
public UserIdsAdapter(Context context, Cursor c, int flags, boolean showCheckBoxes,
SaveKeyringParcel saveKeyringParcel) {
super(context, c, flags);
@@ -139,10 +136,13 @@ public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemC
&& mSaveKeyringParcel.changePrimaryUserId.equals(userId));
boolean revokeThisUserId = (mSaveKeyringParcel.revokeUserIds.contains(userId));
+ // only if primary user id will be changed
+ // (this is not triggered if the user id is currently the primary one)
if (changeAnyPrimaryUserId) {
- // change all user ids, only this one should be primary
+ // change _all_ primary user ids and set new one to true
isPrimary = changeThisPrimaryUserId;
}
+
if (revokeThisUserId) {
if (!isRevoked) {
isRevoked = true;
@@ -233,7 +233,7 @@ public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemC
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
- View view = mInflater.inflate(R.layout.view_key_userids_item, null);
+ View view = mInflater.inflate(R.layout.view_key_user_id_item, null);
// only need to do this once ever, since mShowCheckBoxes is final
view.findViewById(R.id.checkBox).setVisibility(mCheckStates != null ? View.VISIBLE : View.GONE);
return view;
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/EditSubkeyDialogFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/EditSubkeyDialogFragment.java
new file mode 100644
index 000000000..9fef88a78
--- /dev/null
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/EditSubkeyDialogFragment.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2014 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.dialog;
+
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.os.Message;
+import android.os.Messenger;
+import android.os.RemoteException;
+import android.support.v4.app.DialogFragment;
+
+import org.sufficientlysecure.keychain.Constants;
+import org.sufficientlysecure.keychain.R;
+import org.sufficientlysecure.keychain.util.Log;
+
+public class EditSubkeyDialogFragment extends DialogFragment {
+ private static final String ARG_MESSENGER = "messenger";
+
+ public static final int MESSAGE_CHANGE_EXPIRY = 1;
+ public static final int MESSAGE_REVOKE = 2;
+
+ private Messenger mMessenger;
+
+ /**
+ * Creates new instance of this dialog fragment
+ */
+ public static EditSubkeyDialogFragment newInstance(Messenger messenger) {
+ EditSubkeyDialogFragment frag = new EditSubkeyDialogFragment();
+ Bundle args = new Bundle();
+ args.putParcelable(ARG_MESSENGER, messenger);
+
+ frag.setArguments(args);
+
+ return frag;
+ }
+
+ /**
+ * Creates dialog
+ */
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ mMessenger = getArguments().getParcelable(ARG_MESSENGER);
+
+ CustomAlertDialogBuilder builder = new CustomAlertDialogBuilder(getActivity());
+ CharSequence[] array = getResources().getStringArray(R.array.edit_key_edit_subkey);
+
+ builder.setTitle(R.string.edit_key_edit_subkey_title);
+ builder.setItems(array, new DialogInterface.OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ switch (which) {
+ case 0:
+ sendMessageToHandler(MESSAGE_CHANGE_EXPIRY, null);
+ break;
+ case 1:
+ sendMessageToHandler(MESSAGE_REVOKE, null);
+ break;
+ default:
+ break;
+ }
+ }
+ });
+ builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ dismiss();
+ }
+ });
+
+ return builder.show();
+ }
+
+ /**
+ * Send message back to handler which is initialized in a activity
+ *
+ * @param what Message integer you want to send
+ */
+ private void sendMessageToHandler(Integer what, Bundle data) {
+ Message msg = Message.obtain();
+ msg.what = what;
+ if (data != null) {
+ msg.setData(data);
+ }
+
+ try {
+ mMessenger.send(msg);
+ } catch (RemoteException e) {
+ Log.w(Constants.TAG, "Exception sending message, Is handler present?", e);
+ } catch (NullPointerException e) {
+ Log.w(Constants.TAG, "Messenger is null!", e);
+ }
+ }
+}
diff --git a/OpenKeychain/src/main/res/layout/edit_key_fragment.xml b/OpenKeychain/src/main/res/layout/edit_key_fragment.xml
index 2ffbc66f4..e4c374130 100644
--- a/OpenKeychain/src/main/res/layout/edit_key_fragment.xml
+++ b/OpenKeychain/src/main/res/layout/edit_key_fragment.xml
@@ -117,6 +117,36 @@
android:clickable="true"
style="@style/SelectableItem" />
+ <LinearLayout
+ android:id="@+id/edit_key_debug_layout"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ style="@style/SectionHeader"
+ android:layout_width="wrap_content"
+ android:layout_height="0dp"
+ android:layout_marginTop="8dp"
+ android:text="DEBUG options"
+ android:layout_weight="1" />
+
+ <TextView
+ android:id="@+id/edit_key_debug_change_passphrase"
+ android:paddingLeft="8dp"
+ android:paddingRight="8dp"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:text="@string/edit_key_action_change_passphrase"
+ android:minHeight="?android:attr/listPreferredItemHeight"
+ android:drawableRight="@drawable/ic_action_edit"
+ android:drawablePadding="8dp"
+ android:gravity="center_vertical"
+ android:clickable="true"
+ style="@style/SelectableItem" />
+ </LinearLayout>
+
</LinearLayout>
</ScrollView>
diff --git a/OpenKeychain/src/main/res/layout/view_key_keys_item.xml b/OpenKeychain/src/main/res/layout/view_key_subkey_item.xml
index 13feaf2cc..0c0a5d7e6 100644
--- a/OpenKeychain/src/main/res/layout/view_key_keys_item.xml
+++ b/OpenKeychain/src/main/res/layout/view_key_subkey_item.xml
@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:orientation="horizontal"
- android:paddingRight="3dip"
android:singleLine="true">
<ImageView
@@ -13,28 +12,44 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:src="@drawable/key_small"
- android:layout_marginLeft="8dp" />
+ android:padding="8dp"
+ android:layout_centerVertical="true"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true" />
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/edit_image"
+ android:src="@drawable/ic_action_edit"
+ android:padding="8dp"
+ android:layout_centerVertical="true"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentEnd="true" />
<LinearLayout
android:orientation="vertical"
- android:layout_width="fill_parent"
+ android:layout_toRightOf="@id/ic_masterKey"
+ android:layout_toLeftOf="@id/edit_image"
+ android:layout_centerVertical="true"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:layout_marginLeft="8dp"
- android:layout_marginRight="8dp">
+ android:layout_marginRight="8dp"
+ android:id="@+id/linearLayout">
<LinearLayout
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="2dip"
android:paddingTop="2dip">
<TextView
android:id="@+id/keyId"
- android:layout_width="0dp"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/label_key_id"
+ android:text="0x00000000"
android:textAppearance="?android:attr/textAppearanceMedium"
android:typeface="monospace"
android:layout_weight="1" />
@@ -75,8 +90,8 @@
<LinearLayout
android:orientation="horizontal"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
<TextView
android:id="@+id/keyDetails"
@@ -94,8 +109,9 @@
android:text="Expiry: 4/7/2016"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_gravity="right" />
+
</LinearLayout>
</LinearLayout>
-</LinearLayout>
+</RelativeLayout>
diff --git a/OpenKeychain/src/main/res/layout/view_key_userids_item.xml b/OpenKeychain/src/main/res/layout/view_key_user_id_item.xml
index 8f036e600..7de2f9c05 100644
--- a/OpenKeychain/src/main/res/layout/view_key_userids_item.xml
+++ b/OpenKeychain/src/main/res/layout/view_key_user_id_item.xml
@@ -63,7 +63,6 @@
</LinearLayout>
-
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml
index 29780f235..274309fd0 100644
--- a/OpenKeychain/src/main/res/values/strings.xml
+++ b/OpenKeychain/src/main/res/values/strings.xml
@@ -480,6 +480,11 @@
<item>Change to Primary Identity</item>
<item>Revoke Identity</item>
</string-array>
+ <string name="edit_key_edit_subkey_title">Select an action!</string>
+ <string-array name="edit_key_edit_subkey">
+ <item>Change Expiry</item>
+ <item>Revoke Subkey</item>
+ </string-array>
<!-- Navigation Drawer -->
<string name="nav_keys">Keys</string>