mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-24 09:42:17 -05:00
show encryption type in warned/red messages
This commit is contained in:
parent
ec473a4437
commit
a7fd629c05
@ -36,6 +36,7 @@ import eu.siacs.conversations.entities.Message;
|
|||||||
import eu.siacs.conversations.entities.Message.FileParams;
|
import eu.siacs.conversations.entities.Message.FileParams;
|
||||||
import eu.siacs.conversations.entities.Transferable;
|
import eu.siacs.conversations.entities.Transferable;
|
||||||
import eu.siacs.conversations.ui.ConversationActivity;
|
import eu.siacs.conversations.ui.ConversationActivity;
|
||||||
|
import eu.siacs.conversations.utils.CryptoHelper;
|
||||||
import eu.siacs.conversations.utils.GeoHelper;
|
import eu.siacs.conversations.utils.GeoHelper;
|
||||||
import eu.siacs.conversations.utils.UIHelper;
|
import eu.siacs.conversations.utils.UIHelper;
|
||||||
|
|
||||||
@ -462,6 +463,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
|||||||
.findViewById(R.id.message_time);
|
.findViewById(R.id.message_time);
|
||||||
viewHolder.indicatorReceived = (ImageView) view
|
viewHolder.indicatorReceived = (ImageView) view
|
||||||
.findViewById(R.id.indicator_received);
|
.findViewById(R.id.indicator_received);
|
||||||
|
viewHolder.encryption = (TextView) view.findViewById(R.id.message_encryption);
|
||||||
break;
|
break;
|
||||||
case STATUS:
|
case STATUS:
|
||||||
view = activity.getLayoutInflater().inflate(R.layout.message_status, parent, false);
|
view = activity.getLayoutInflater().inflate(R.layout.message_status, parent, false);
|
||||||
@ -585,8 +587,11 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
|||||||
} else {
|
} else {
|
||||||
viewHolder.message_box.setBackgroundResource(R.drawable.message_bubble_received);
|
viewHolder.message_box.setBackgroundResource(R.drawable.message_bubble_received);
|
||||||
}
|
}
|
||||||
|
viewHolder.encryption.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
viewHolder.message_box.setBackgroundResource(R.drawable.message_bubble_received_warning);
|
viewHolder.message_box.setBackgroundResource(R.drawable.message_bubble_received_warning);
|
||||||
|
viewHolder.encryption.setVisibility(View.VISIBLE);
|
||||||
|
viewHolder.encryption.setText(CryptoHelper.encryptionTypeToText(message.getEncryption()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -667,5 +672,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
|||||||
protected TextView messageBody;
|
protected TextView messageBody;
|
||||||
protected ImageView contact_picture;
|
protected ImageView contact_picture;
|
||||||
protected TextView status_message;
|
protected TextView status_message;
|
||||||
|
protected TextView encryption;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,8 @@ import java.util.LinkedHashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
|
import eu.siacs.conversations.R;
|
||||||
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
|
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
|
||||||
import eu.siacs.conversations.xmpp.jid.Jid;
|
import eu.siacs.conversations.xmpp.jid.Jid;
|
||||||
|
|
||||||
@ -164,4 +166,17 @@ public final class CryptoHelper {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int encryptionTypeToText(int encryption) {
|
||||||
|
switch (encryption) {
|
||||||
|
case Message.ENCRYPTION_OTR:
|
||||||
|
return R.string.encryption_choice_otr;
|
||||||
|
case Message.ENCRYPTION_AXOLOTL:
|
||||||
|
return R.string.encryption_choice_omemo;
|
||||||
|
case Message.ENCRYPTION_NONE:
|
||||||
|
return R.string.encryption_choice_unencrypted;
|
||||||
|
default:
|
||||||
|
return R.string.encryption_choice_pgp;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,17 @@
|
|||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingBottom="2dp">
|
android:paddingBottom="2dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/message_encryption"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_marginRight="4sp"
|
||||||
|
android:textColor="@color/white70"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textSize="?attr/TextSizeInfo" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/security_indicator"
|
android:id="@+id/security_indicator"
|
||||||
android:layout_width="?attr/TextSizeInfo"
|
android:layout_width="?attr/TextSizeInfo"
|
||||||
|
Loading…
Reference in New Issue
Block a user