diff options
author | Christian Schneppe <christian@pix-art.de> | 2016-11-19 22:26:04 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-11-19 22:26:04 +0100 |
commit | 508e5b589f3e9b8b5208d322b9ff9dc9fff8056a (patch) | |
tree | 78b18c37b204c6c07458c2177d844a8aa372fecc | |
parent | 54f1422d3d076b7e96cf2c03c61cf75affaf43e7 (diff) |
correct colors for uncrypted messages in encrypted chats
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/XmppActivity.java | 6 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index b9c62e516..26f185294 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -109,6 +109,7 @@ public abstract class XmppActivity extends Activity { protected int mPrimaryBackgroundColor; protected int mSecondaryBackgroundColor; protected int mColorRed; + protected int mColorWhite; protected int mColorOrange; protected int mColorGreen; protected int mPrimaryColor; @@ -414,6 +415,7 @@ public abstract class XmppActivity extends Activity { mSecondaryTextColor = getResources().getColor(R.color.black54); mTertiaryTextColor = getResources().getColor(R.color.black12); mColorRed = getResources().getColor(R.color.red800); + mColorWhite = getResources().getColor(R.color.white70); mColorOrange = getResources().getColor(R.color.orange500); mColorGreen = getResources().getColor(R.color.realgreen); mPrimaryColor = getResources().getColor(R.color.primary); @@ -972,6 +974,10 @@ public abstract class XmppActivity extends Activity { return this.mColorRed; } + public int getUnencryptedTextColor() { + return this.mColorWhite; + } + public int getOnlineColor() { return this.mColorGreen; } diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java index 1a93c7f68..02cbbdfd0 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java @@ -162,7 +162,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie if (message.getType() == Message.TYPE_IMAGE || message.getType() == Message.TYPE_FILE || message.getTransferable() != null) { FileParams params = message.getFileParams(); if (params.size > (1 * 1024 * 1024)) { - filesize = params.size / (1024 * 1024)+ " MiB"; + filesize = params.size / (1024 * 1024) + " MiB"; } else if (params.size > (1 * 1024)) { filesize = params.size / 1024 + " KiB"; } else if (params.size > 0) { @@ -178,8 +178,8 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie break; case Message.STATUS_UNSEND: Transferable d = message.getTransferable(); - if (d!=null) { - info = getContext().getString(R.string.sending_file,d.getProgress()); + if (d != null) { + info = getContext().getString(R.string.sending_file, d.getProgress()); } else { info = getContext().getString(R.string.sending); } @@ -210,6 +210,8 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie } if (error && type == SENT) { viewHolder.time.setTextColor(activity.getWarningTextColor()); + } else if (!message.isValidInSession() && type == RECEIVED) { + viewHolder.time.setTextColor(activity.getUnencryptedTextColor()); } else { viewHolder.time.setTextColor(this.getMessageTextColor(darkBackground,false)); } |