From dee46f34536577f6b395f7fe62d3503ecf5cf7fc Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Thu, 11 Sep 2014 14:24:10 +0200 Subject: [PATCH] match color in contact details to the colors in the send button. also migrated some other colors from hard coding to using resources --- res/values/colors.xml | 4 +++- .../conversations/ui/ContactDetailsActivity.java | 14 +++++++------- src/eu/siacs/conversations/ui/XmppActivity.java | 10 +++++++--- .../conversations/ui/adapter/MessageAdapter.java | 6 +++--- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/res/values/colors.xml b/res/values/colors.xml index ed0a0ffbf..fdaff5da9 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -9,5 +9,7 @@ #ffeeeeee #ff323232 #1f000000 - #ffe51c23 + #ffe51c23 + #ffff9800 + #ff259b24 \ No newline at end of file diff --git a/src/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/eu/siacs/conversations/ui/ContactDetailsActivity.java index 8de2ce804..9d384c601 100644 --- a/src/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -278,31 +278,31 @@ public class ContactDetailsActivity extends XmppActivity { switch (contact.getMostAvailableStatus()) { case Presences.CHAT: status.setText(R.string.contact_status_free_to_chat); - status.setTextColor(0xFF83b600); + status.setTextColor(mColorGreen); break; case Presences.ONLINE: status.setText(R.string.contact_status_online); - status.setTextColor(0xFF83b600); + status.setTextColor(mColorGreen); break; case Presences.AWAY: status.setText(R.string.contact_status_away); - status.setTextColor(0xFFffa713); + status.setTextColor(mColorOrange); break; case Presences.XA: status.setText(R.string.contact_status_extended_away); - status.setTextColor(0xFFffa713); + status.setTextColor(mColorOrange); break; case Presences.DND: status.setText(R.string.contact_status_do_not_disturb); - status.setTextColor(0xFFe92727); + status.setTextColor(mColorRed); break; case Presences.OFFLINE: status.setText(R.string.contact_status_offline); - status.setTextColor(0xFFe92727); + status.setTextColor(mSecondaryTextColor); break; default: status.setText(R.string.contact_status_offline); - status.setTextColor(0xFFe92727); + status.setTextColor(mSecondaryTextColor); break; } if (contact.getPresences().size() > 1) { diff --git a/src/eu/siacs/conversations/ui/XmppActivity.java b/src/eu/siacs/conversations/ui/XmppActivity.java index f13c112a9..a3503048e 100644 --- a/src/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/eu/siacs/conversations/ui/XmppActivity.java @@ -55,7 +55,9 @@ public abstract class XmppActivity extends Activity { protected int mPrimaryTextColor; protected int mSecondaryTextColor; - protected int mWarningTextColor; + protected int mColorRed; + protected int mColorOrange; + protected int mColorGreen; protected int mPrimaryColor; private DisplayMetrics metrics; @@ -183,7 +185,9 @@ public abstract class XmppActivity extends Activity { ExceptionHelper.init(getApplicationContext()); mPrimaryTextColor = getResources().getColor(R.color.primarytext); mSecondaryTextColor = getResources().getColor(R.color.secondarytext); - mWarningTextColor = getResources().getColor(R.color.warningtext); + mColorRed = getResources().getColor(R.color.red); + mColorOrange = getResources().getColor(R.color.orange); + mColorGreen = getResources().getColor(R.color.green); mPrimaryColor = getResources().getColor(R.color.primary); if (getPreferences().getBoolean("use_larger_font", false)) { setTheme(R.style.ConversationsTheme_LargerText); @@ -475,7 +479,7 @@ public abstract class XmppActivity extends Activity { } public int getWarningTextColor() { - return this.mWarningTextColor; + return this.mColorRed; } public int getPrimaryColor() { diff --git a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java index 967042d80..db01eabee 100644 --- a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -145,7 +145,7 @@ public class MessageAdapter extends ArrayAdapter { break; } if (error) { - viewHolder.time.setTextColor(0xFFe92727); + viewHolder.time.setTextColor(activity.getWarningTextColor()); } else { viewHolder.time.setTextColor(activity.getSecondaryTextColor()); } @@ -191,7 +191,7 @@ public class MessageAdapter extends ArrayAdapter { viewHolder.image.setVisibility(View.GONE); viewHolder.messageBody.setVisibility(View.VISIBLE); viewHolder.messageBody.setText(getContext().getString(r)); - viewHolder.messageBody.setTextColor(0xff33B5E5); + viewHolder.messageBody.setTextColor(activity.getSecondaryTextColor()); viewHolder.messageBody.setTypeface(null, Typeface.ITALIC); viewHolder.messageBody.setTextIsSelectable(false); } @@ -204,7 +204,7 @@ public class MessageAdapter extends ArrayAdapter { viewHolder.messageBody.setVisibility(View.VISIBLE); viewHolder.messageBody.setText(getContext().getString( R.string.decryption_failed)); - viewHolder.messageBody.setTextColor(0xFFe92727); + viewHolder.messageBody.setTextColor(activity.getWarningTextColor()); viewHolder.messageBody.setTypeface(null, Typeface.NORMAL); viewHolder.messageBody.setTextIsSelectable(false); }