diff options
author | mar-v-in <github@rvin.mooo.com> | 2014-08-01 23:30:31 +0200 |
---|---|---|
committer | mar-v-in <github@rvin.mooo.com> | 2014-08-01 23:30:31 +0200 |
commit | 9d101b4fe5ea3aa4c67264131eaaf055c0c35641 (patch) | |
tree | 8c5eabfb0a06ce00dffdb1d0ebaee8fea3fbae71 /OpenKeychain | |
parent | b206b6d351e38c96eb44d801a45c872844c1a0fd (diff) | |
download | open-keychain-9d101b4fe5ea3aa4c67264131eaaf055c0c35641.tar.gz open-keychain-9d101b4fe5ea3aa4c67264131eaaf055c0c35641.tar.bz2 open-keychain-9d101b4fe5ea3aa4c67264131eaaf055c0c35641.zip |
Encrypt UI (drop downs)
Diffstat (limited to 'OpenKeychain')
6 files changed, 75 insertions, 35 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java index 609ac8ab7..8a516e6af 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java @@ -300,13 +300,12 @@ public class EncryptActivity extends DrawerActivity implements EncryptActivityIn // file if (mOutputUris.size() == 1) { sendIntent = new Intent(Intent.ACTION_SEND); - sendIntent.setType("*/*"); sendIntent.putExtra(Intent.EXTRA_STREAM, mOutputUris.get(0)); } else { sendIntent = new Intent(Intent.ACTION_SEND_MULTIPLE); - sendIntent.setType("*/*"); sendIntent.putExtra(Intent.EXTRA_STREAM, mOutputUris); } + sendIntent.setType("application/pgp-encrypted"); } if (!isModeSymmetric() && mEncryptionUserIds != null) { Set<String> users = new HashSet<String>(); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java index 2295183a9..ed3be0e7f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptAsymmetricFragment.java @@ -40,6 +40,7 @@ import com.tokenautocomplete.TokenCompleteTextView; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; +import org.sufficientlysecure.keychain.pgp.KeyRing; import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing; @@ -261,8 +262,9 @@ public class EncryptAsymmetricFragment extends Fragment implements EncryptActivi @Override public void bindView(View view, Context context, Cursor cursor) { - ((TextView) view.findViewById(android.R.id.text1)).setText(cursor.getString(mIndexUserId)); - view.findViewById(android.R.id.text2).setVisibility(View.VISIBLE); + String[] userId = KeyRing.splitUserId(cursor.getString(mIndexUserId)); + ((TextView) view.findViewById(android.R.id.title)).setText(userId[2] == null ? userId[0] : (userId[0] + " (" + userId[2] + ")")); + ((TextView) view.findViewById(android.R.id.text1)).setText(userId[1]); ((TextView) view.findViewById(android.R.id.text2)).setText(PgpKeyHelper.convertKeyIdToHex(cursor.getLong(mIndexKeyId))); } @@ -309,19 +311,29 @@ public class EncryptAsymmetricFragment extends Fragment implements EncryptActivi @Override public View getView(int position, View convertView, ViewGroup parent) { + View v = getDropDownView(position, convertView, parent); + v.findViewById(android.R.id.text1).setVisibility(View.GONE); + return v; + } + + @Override + public View getDropDownView(int position, View convertView, ViewGroup parent) { + View v; if (position == 0) { - View v; if (convertView == null) { v = inner.newView(null, null, parent); } else { v = convertView; } - ((TextView) v.findViewById(android.R.id.text1)).setText("None"); + ((TextView) v.findViewById(android.R.id.title)).setText("None"); + v.findViewById(android.R.id.text1).setVisibility(View.GONE); v.findViewById(android.R.id.text2).setVisibility(View.GONE); - return v; } else { - return inner.getView(position - 1, convertView, parent); + v = inner.getView(position - 1, convertView, parent); + v.findViewById(android.R.id.text1).setVisibility(View.VISIBLE); + v.findViewById(android.R.id.text2).setVisibility(View.VISIBLE); } + return v; } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFileFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFileFragment.java index 7538d2a56..7650c3954 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFileFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFileFragment.java @@ -245,7 +245,6 @@ public class EncryptFileFragment extends Fragment implements EncryptActivityInte // Clear cache if needed for (Uri uri : new HashSet<Uri>(thumbnailCache.keySet())) { if (!mEncryptInterface.getInputUris().contains(uri)) { - Log.d(Constants.TAG, "Removed thumbnail for uri: "+uri); thumbnailCache.remove(uri); } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EncryptKeyCompletionView.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EncryptKeyCompletionView.java index 53731b278..329ef2c9b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EncryptKeyCompletionView.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EncryptKeyCompletionView.java @@ -130,12 +130,14 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView { } public class EncryptionKey { - private String mUserId; + private String mUserIdFull; + private String[] mUserId; private long mKeyId; private String mFingerprint; public EncryptionKey(String userId, long keyId, String fingerprint) { - this.mUserId = userId; + this.mUserId = KeyRing.splitUserId(userId); + this.mUserIdFull = userId; this.mKeyId = keyId; this.mFingerprint = fingerprint; } @@ -154,7 +156,7 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView { } public String getUserId() { - return mUserId; + return mUserIdFull; } public String getFingerprint() { @@ -162,25 +164,31 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView { } public String getPrimary() { - String[] userId = KeyRing.splitUserId(mUserId); - if (userId[0] != null && userId[2] != null) { - return userId[0] + " (" + userId[2] + ")"; - } else if (userId[0] != null) { - return userId[0]; + if (mUserId[0] != null && mUserId[2] != null) { + return mUserId[0] + " (" + mUserId[2] + ")"; + } else if (mUserId[0] != null) { + return mUserId[0]; } else { - return userId[1]; + return mUserId[1]; } } public String getSecondary() { - String[] userId = KeyRing.splitUserId(mUserId); - if (userId[0] != null) { - return userId[1] + " (" + getKeyIdHexShort() + ")"; + if (mUserId[0] != null) { + return mUserId[1]; } else { return getKeyIdHex(); } } + public String getTertiary() { + if (mUserId[0] != null) { + return getKeyIdHex(); + } else { + return null; + } + } + public long getKeyId() { return mKeyId; } @@ -216,6 +224,7 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView { } ((TextView) view.findViewById(android.R.id.title)).setText(getItem(position).getPrimary()); ((TextView) view.findViewById(android.R.id.text1)).setText(getItem(position).getSecondary()); + ((TextView) view.findViewById(android.R.id.text2)).setText(getItem(position).getTertiary()); setImageByKey((ImageView) view.findViewById(android.R.id.icon), getItem(position)); return view; } diff --git a/OpenKeychain/src/main/res/layout/encrypt_asymmetric_signkey.xml b/OpenKeychain/src/main/res/layout/encrypt_asymmetric_signkey.xml index 35c618c72..703f9133b 100644 --- a/OpenKeychain/src/main/res/layout/encrypt_asymmetric_signkey.xml +++ b/OpenKeychain/src/main/res/layout/encrypt_asymmetric_signkey.xml @@ -3,17 +3,29 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="wrap_content" - android:padding="8dp" + android:padding="4dp" android:layout_height="wrap_content"> - <TextView - android:id="@android:id/text1" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceMedium"/> - <TextView - android:id="@android:id/text2" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceSmall"/> - + <TextView android:id="@android:id/title" + android:textColor="?android:attr/textColorSecondary" + android:textSize="18sp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:singleLine="true" + android:ellipsize="end"/> + <TextView android:id="@android:id/text1" + android:textColor="?android:attr/textColorTertiary" + android:textSize="14sp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:singleLine="true" + android:ellipsize="end" + android:layout_marginTop="-4dip"/> + <TextView android:id="@android:id/text2" + android:textColor="?android:attr/textColorTertiary" + android:textSize="14sp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:singleLine="true" + android:ellipsize="end" + android:layout_marginTop="-4dip"/> </LinearLayout>
\ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/recipient_selection_list_entry.xml b/OpenKeychain/src/main/res/layout/recipient_selection_list_entry.xml index 2be37fb4c..9d2d1e9a9 100644 --- a/OpenKeychain/src/main/res/layout/recipient_selection_list_entry.xml +++ b/OpenKeychain/src/main/res/layout/recipient_selection_list_entry.xml @@ -30,11 +30,20 @@ android:singleLine="true" android:ellipsize="end" android:layout_marginTop="-4dip"/> + <TextView android:id="@android:id/text2" + android:textColor="?android:attr/textColorTertiary" + android:textSize="14sp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingLeft="16dip" + android:singleLine="true" + android:ellipsize="end" + android:layout_marginTop="-4dip"/> </LinearLayout> <ImageView android:id="@android:id/icon" - android:layout_width="48dip" - android:layout_height="48dip" + android:layout_width="56dip" + android:layout_height="56dip" android:layout_marginLeft="12dip" android:cropToPadding="true" android:background="#ccc" |