match color in contact details to the colors in the send button. also migrated some other colors from hard coding to using resources

This commit is contained in:
iNPUTmice 2014-09-11 14:24:10 +02:00
parent ff41918cb7
commit dee46f3453
4 changed files with 20 additions and 14 deletions

View file

@ -9,5 +9,7 @@
<color name="secondarybackground" type="color">#ffeeeeee</color> <color name="secondarybackground" type="color">#ffeeeeee</color>
<color name="darkbackground" type="color">#ff323232</color> <color name="darkbackground" type="color">#ff323232</color>
<color name="divider">#1f000000</color> <color name="divider">#1f000000</color>
<color name="warningtext">#ffe51c23</color> <color name="red">#ffe51c23</color>
<color name="orange">#ffff9800</color>
<color name="green">#ff259b24</color>
</resources> </resources>

View file

@ -278,31 +278,31 @@ public class ContactDetailsActivity extends XmppActivity {
switch (contact.getMostAvailableStatus()) { switch (contact.getMostAvailableStatus()) {
case Presences.CHAT: case Presences.CHAT:
status.setText(R.string.contact_status_free_to_chat); status.setText(R.string.contact_status_free_to_chat);
status.setTextColor(0xFF83b600); status.setTextColor(mColorGreen);
break; break;
case Presences.ONLINE: case Presences.ONLINE:
status.setText(R.string.contact_status_online); status.setText(R.string.contact_status_online);
status.setTextColor(0xFF83b600); status.setTextColor(mColorGreen);
break; break;
case Presences.AWAY: case Presences.AWAY:
status.setText(R.string.contact_status_away); status.setText(R.string.contact_status_away);
status.setTextColor(0xFFffa713); status.setTextColor(mColorOrange);
break; break;
case Presences.XA: case Presences.XA:
status.setText(R.string.contact_status_extended_away); status.setText(R.string.contact_status_extended_away);
status.setTextColor(0xFFffa713); status.setTextColor(mColorOrange);
break; break;
case Presences.DND: case Presences.DND:
status.setText(R.string.contact_status_do_not_disturb); status.setText(R.string.contact_status_do_not_disturb);
status.setTextColor(0xFFe92727); status.setTextColor(mColorRed);
break; break;
case Presences.OFFLINE: case Presences.OFFLINE:
status.setText(R.string.contact_status_offline); status.setText(R.string.contact_status_offline);
status.setTextColor(0xFFe92727); status.setTextColor(mSecondaryTextColor);
break; break;
default: default:
status.setText(R.string.contact_status_offline); status.setText(R.string.contact_status_offline);
status.setTextColor(0xFFe92727); status.setTextColor(mSecondaryTextColor);
break; break;
} }
if (contact.getPresences().size() > 1) { if (contact.getPresences().size() > 1) {

View file

@ -55,7 +55,9 @@ public abstract class XmppActivity extends Activity {
protected int mPrimaryTextColor; protected int mPrimaryTextColor;
protected int mSecondaryTextColor; protected int mSecondaryTextColor;
protected int mWarningTextColor; protected int mColorRed;
protected int mColorOrange;
protected int mColorGreen;
protected int mPrimaryColor; protected int mPrimaryColor;
private DisplayMetrics metrics; private DisplayMetrics metrics;
@ -183,7 +185,9 @@ public abstract class XmppActivity extends Activity {
ExceptionHelper.init(getApplicationContext()); ExceptionHelper.init(getApplicationContext());
mPrimaryTextColor = getResources().getColor(R.color.primarytext); mPrimaryTextColor = getResources().getColor(R.color.primarytext);
mSecondaryTextColor = getResources().getColor(R.color.secondarytext); 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); mPrimaryColor = getResources().getColor(R.color.primary);
if (getPreferences().getBoolean("use_larger_font", false)) { if (getPreferences().getBoolean("use_larger_font", false)) {
setTheme(R.style.ConversationsTheme_LargerText); setTheme(R.style.ConversationsTheme_LargerText);
@ -475,7 +479,7 @@ public abstract class XmppActivity extends Activity {
} }
public int getWarningTextColor() { public int getWarningTextColor() {
return this.mWarningTextColor; return this.mColorRed;
} }
public int getPrimaryColor() { public int getPrimaryColor() {

View file

@ -145,7 +145,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
break; break;
} }
if (error) { if (error) {
viewHolder.time.setTextColor(0xFFe92727); viewHolder.time.setTextColor(activity.getWarningTextColor());
} else { } else {
viewHolder.time.setTextColor(activity.getSecondaryTextColor()); viewHolder.time.setTextColor(activity.getSecondaryTextColor());
} }
@ -191,7 +191,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
viewHolder.image.setVisibility(View.GONE); viewHolder.image.setVisibility(View.GONE);
viewHolder.messageBody.setVisibility(View.VISIBLE); viewHolder.messageBody.setVisibility(View.VISIBLE);
viewHolder.messageBody.setText(getContext().getString(r)); viewHolder.messageBody.setText(getContext().getString(r));
viewHolder.messageBody.setTextColor(0xff33B5E5); viewHolder.messageBody.setTextColor(activity.getSecondaryTextColor());
viewHolder.messageBody.setTypeface(null, Typeface.ITALIC); viewHolder.messageBody.setTypeface(null, Typeface.ITALIC);
viewHolder.messageBody.setTextIsSelectable(false); viewHolder.messageBody.setTextIsSelectable(false);
} }
@ -204,7 +204,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
viewHolder.messageBody.setVisibility(View.VISIBLE); viewHolder.messageBody.setVisibility(View.VISIBLE);
viewHolder.messageBody.setText(getContext().getString( viewHolder.messageBody.setText(getContext().getString(
R.string.decryption_failed)); R.string.decryption_failed));
viewHolder.messageBody.setTextColor(0xFFe92727); viewHolder.messageBody.setTextColor(activity.getWarningTextColor());
viewHolder.messageBody.setTypeface(null, Typeface.NORMAL); viewHolder.messageBody.setTypeface(null, Typeface.NORMAL);
viewHolder.messageBody.setTextIsSelectable(false); viewHolder.messageBody.setTextIsSelectable(false);
} }