show "simple" crypto available indicator

This commit is contained in:
Vincent Breitmoser 2017-06-27 19:18:06 +02:00
parent 9ab04c0931
commit 4fd39e3ba3
3 changed files with 47 additions and 7 deletions

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 49.999997 99.999998" height="100" width="50" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
<metadata>
<rdf:RDF>
<cc:Work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title/>
</cc:Work>
</rdf:RDF>
</metadata>
<path d="m0 0h50v50z" fill-rule="evenodd" stroke="#000" stroke-width="1px"/>
</svg>

After

Width:  |  Height:  |  Size: 611 B

View file

@ -129,11 +129,30 @@ public class RecipientSelectView extends TokenCompleteTextView<Recipient> implem
RecipientAdapter.setContactPhotoOrPlaceholder(getContext(), holder.vContactPhoto, recipient);
boolean hasCryptoProvider = cryptoProvider != null;
if (!showAdvancedInfo || !hasCryptoProvider) {
if (!hasCryptoProvider) {
holder.cryptoStatusSimple.setVisibility(View.GONE);
holder.cryptoStatusRed.setVisibility(View.GONE);
holder.cryptoStatusOrange.setVisibility(View.GONE);
holder.cryptoStatusGreen.setVisibility(View.GONE);
} else if (recipient.cryptoStatus == RecipientCryptoStatus.UNAVAILABLE) {
return;
}
if (!showAdvancedInfo) {
holder.cryptoStatusRed.setVisibility(View.GONE);
holder.cryptoStatusOrange.setVisibility(View.GONE);
holder.cryptoStatusGreen.setVisibility(View.GONE);
if (recipient.cryptoStatus == RecipientCryptoStatus.AVAILABLE_TRUSTED ||
recipient.cryptoStatus == RecipientCryptoStatus.AVAILABLE_UNTRUSTED) {
holder.cryptoStatusSimple.setVisibility(View.VISIBLE);
} else {
holder.cryptoStatusSimple.setVisibility(View.GONE);
}
return;
}
if (recipient.cryptoStatus == RecipientCryptoStatus.UNAVAILABLE) {
holder.cryptoStatusRed.setVisibility(View.VISIBLE);
holder.cryptoStatusOrange.setVisibility(View.GONE);
holder.cryptoStatusGreen.setVisibility(View.GONE);
@ -503,11 +522,12 @@ public class RecipientSelectView extends TokenCompleteTextView<Recipient> implem
}
private static class RecipientTokenViewHolder {
public final TextView vName;
public final ImageView vContactPhoto;
public final View cryptoStatusRed;
public final View cryptoStatusOrange;
public final View cryptoStatusGreen;
final TextView vName;
final ImageView vContactPhoto;
final View cryptoStatusRed;
final View cryptoStatusOrange;
final View cryptoStatusGreen;
final View cryptoStatusSimple;
RecipientTokenViewHolder(View view) {
@ -516,6 +536,7 @@ public class RecipientSelectView extends TokenCompleteTextView<Recipient> implem
cryptoStatusRed = view.findViewById(R.id.contact_crypto_status_red);
cryptoStatusOrange = view.findViewById(R.id.contact_crypto_status_orange);
cryptoStatusGreen = view.findViewById(R.id.contact_crypto_status_green);
cryptoStatusSimple = view.findViewById(R.id.contact_crypto_status_icon_simple);
}
}

View file

@ -0,0 +1,6 @@
<vector android:autoMirrored="true" android:height="24dp"
android:viewportHeight="100.0" android:viewportWidth="49.999996"
android:width="12dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="m0,0h50v50z"
android:strokeColor="#000" android:strokeWidth="1"/>
</vector>