mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-02-25 16:01:52 -05:00
Encrypt UI (drop downs)
This commit is contained in:
parent
b206b6d351
commit
9d101b4fe5
@ -300,13 +300,12 @@ public class EncryptActivity extends DrawerActivity implements EncryptActivityIn
|
|||||||
// file
|
// file
|
||||||
if (mOutputUris.size() == 1) {
|
if (mOutputUris.size() == 1) {
|
||||||
sendIntent = new Intent(Intent.ACTION_SEND);
|
sendIntent = new Intent(Intent.ACTION_SEND);
|
||||||
sendIntent.setType("*/*");
|
|
||||||
sendIntent.putExtra(Intent.EXTRA_STREAM, mOutputUris.get(0));
|
sendIntent.putExtra(Intent.EXTRA_STREAM, mOutputUris.get(0));
|
||||||
} else {
|
} else {
|
||||||
sendIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
|
sendIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
|
||||||
sendIntent.setType("*/*");
|
|
||||||
sendIntent.putExtra(Intent.EXTRA_STREAM, mOutputUris);
|
sendIntent.putExtra(Intent.EXTRA_STREAM, mOutputUris);
|
||||||
}
|
}
|
||||||
|
sendIntent.setType("application/pgp-encrypted");
|
||||||
}
|
}
|
||||||
if (!isModeSymmetric() && mEncryptionUserIds != null) {
|
if (!isModeSymmetric() && mEncryptionUserIds != null) {
|
||||||
Set<String> users = new HashSet<String>();
|
Set<String> users = new HashSet<String>();
|
||||||
|
@ -40,6 +40,7 @@ import com.tokenautocomplete.TokenCompleteTextView;
|
|||||||
|
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
|
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||||
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
|
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
|
||||||
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||||
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
||||||
@ -261,8 +262,9 @@ public class EncryptAsymmetricFragment extends Fragment implements EncryptActivi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bindView(View view, Context context, Cursor cursor) {
|
public void bindView(View view, Context context, Cursor cursor) {
|
||||||
((TextView) view.findViewById(android.R.id.text1)).setText(cursor.getString(mIndexUserId));
|
String[] userId = KeyRing.splitUserId(cursor.getString(mIndexUserId));
|
||||||
view.findViewById(android.R.id.text2).setVisibility(View.VISIBLE);
|
((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)));
|
((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
|
@Override
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
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) {
|
if (position == 0) {
|
||||||
View v;
|
|
||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
v = inner.newView(null, null, parent);
|
v = inner.newView(null, null, parent);
|
||||||
} else {
|
} else {
|
||||||
v = convertView;
|
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);
|
v.findViewById(android.R.id.text2).setVisibility(View.GONE);
|
||||||
return v;
|
|
||||||
} else {
|
} 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,6 @@ public class EncryptFileFragment extends Fragment implements EncryptActivityInte
|
|||||||
// Clear cache if needed
|
// Clear cache if needed
|
||||||
for (Uri uri : new HashSet<Uri>(thumbnailCache.keySet())) {
|
for (Uri uri : new HashSet<Uri>(thumbnailCache.keySet())) {
|
||||||
if (!mEncryptInterface.getInputUris().contains(uri)) {
|
if (!mEncryptInterface.getInputUris().contains(uri)) {
|
||||||
Log.d(Constants.TAG, "Removed thumbnail for uri: "+uri);
|
|
||||||
thumbnailCache.remove(uri);
|
thumbnailCache.remove(uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,12 +130,14 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class EncryptionKey {
|
public class EncryptionKey {
|
||||||
private String mUserId;
|
private String mUserIdFull;
|
||||||
|
private String[] mUserId;
|
||||||
private long mKeyId;
|
private long mKeyId;
|
||||||
private String mFingerprint;
|
private String mFingerprint;
|
||||||
|
|
||||||
public EncryptionKey(String userId, long keyId, String fingerprint) {
|
public EncryptionKey(String userId, long keyId, String fingerprint) {
|
||||||
this.mUserId = userId;
|
this.mUserId = KeyRing.splitUserId(userId);
|
||||||
|
this.mUserIdFull = userId;
|
||||||
this.mKeyId = keyId;
|
this.mKeyId = keyId;
|
||||||
this.mFingerprint = fingerprint;
|
this.mFingerprint = fingerprint;
|
||||||
}
|
}
|
||||||
@ -154,7 +156,7 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getUserId() {
|
public String getUserId() {
|
||||||
return mUserId;
|
return mUserIdFull;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFingerprint() {
|
public String getFingerprint() {
|
||||||
@ -162,25 +164,31 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getPrimary() {
|
public String getPrimary() {
|
||||||
String[] userId = KeyRing.splitUserId(mUserId);
|
if (mUserId[0] != null && mUserId[2] != null) {
|
||||||
if (userId[0] != null && userId[2] != null) {
|
return mUserId[0] + " (" + mUserId[2] + ")";
|
||||||
return userId[0] + " (" + userId[2] + ")";
|
} else if (mUserId[0] != null) {
|
||||||
} else if (userId[0] != null) {
|
return mUserId[0];
|
||||||
return userId[0];
|
|
||||||
} else {
|
} else {
|
||||||
return userId[1];
|
return mUserId[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSecondary() {
|
public String getSecondary() {
|
||||||
String[] userId = KeyRing.splitUserId(mUserId);
|
if (mUserId[0] != null) {
|
||||||
if (userId[0] != null) {
|
return mUserId[1];
|
||||||
return userId[1] + " (" + getKeyIdHexShort() + ")";
|
|
||||||
} else {
|
} else {
|
||||||
return getKeyIdHex();
|
return getKeyIdHex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTertiary() {
|
||||||
|
if (mUserId[0] != null) {
|
||||||
|
return getKeyIdHex();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public long getKeyId() {
|
public long getKeyId() {
|
||||||
return mKeyId;
|
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.title)).setText(getItem(position).getPrimary());
|
||||||
((TextView) view.findViewById(android.R.id.text1)).setText(getItem(position).getSecondary());
|
((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));
|
setImageByKey((ImageView) view.findViewById(android.R.id.icon), getItem(position));
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
@ -3,17 +3,29 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:padding="8dp"
|
android:padding="4dp"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<TextView
|
<TextView android:id="@android:id/title"
|
||||||
android:id="@android:id/text1"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:layout_width="wrap_content"
|
android:textSize="18sp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"/>
|
android:layout_height="wrap_content"
|
||||||
<TextView
|
android:singleLine="true"
|
||||||
android:id="@android:id/text2"
|
android:ellipsize="end"/>
|
||||||
android:layout_width="wrap_content"
|
<TextView android:id="@android:id/text1"
|
||||||
android:layout_height="wrap_content"
|
android:textColor="?android:attr/textColorTertiary"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
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>
|
</LinearLayout>
|
@ -30,11 +30,20 @@
|
|||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:layout_marginTop="-4dip"/>
|
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>
|
</LinearLayout>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@android:id/icon"
|
android:id="@android:id/icon"
|
||||||
android:layout_width="48dip"
|
android:layout_width="56dip"
|
||||||
android:layout_height="48dip"
|
android:layout_height="56dip"
|
||||||
android:layout_marginLeft="12dip"
|
android:layout_marginLeft="12dip"
|
||||||
android:cropToPadding="true"
|
android:cropToPadding="true"
|
||||||
android:background="#ccc"
|
android:background="#ccc"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user