aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/ui/adapter
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2016-03-29 11:43:22 +0200
committersteckbrief <steckbrief@chefmail.de>2016-03-29 11:43:22 +0200
commit6244834096727cfc1aaaeba7845a6d9cfe27d2b0 (patch)
treebc532e86b2bfca9afbcfcfc4c383b48ecb287ea4 /src/main/java/de/thedevstack/conversationsplus/ui/adapter
parent0c0676b7dbf87e24ebcc4714adfb10d91e3d72b8 (diff)
Implements FS#173: Move access to colors to separate helper class
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/ui/adapter')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/adapter/AccountAdapter.java7
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java3
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java9
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/adapter/PresencesArrayAdapter.java2
4 files changed, 12 insertions, 9 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/AccountAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/AccountAdapter.java
index b6caa019..ee209576 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/AccountAdapter.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/AccountAdapter.java
@@ -13,6 +13,7 @@ import android.widget.TextView;
import java.util.List;
import de.thedevstack.conversationsplus.Config;
+import de.thedevstack.conversationsplus.ConversationsPlusColors;
import de.thedevstack.conversationsplus.R;
import de.thedevstack.conversationsplus.entities.Account;
import de.thedevstack.conversationsplus.services.AvatarService;
@@ -48,14 +49,14 @@ public class AccountAdapter extends ArrayAdapter<Account> {
statusView.setText(getContext().getString(account.getStatus().getReadableId()));
switch (account.getStatus()) {
case ONLINE:
- statusView.setTextColor(activity.getOnlineColor());
+ statusView.setTextColor(ConversationsPlusColors.online());
break;
case DISABLED:
case CONNECTING:
- statusView.setTextColor(activity.getSecondaryTextColor());
+ statusView.setTextColor(ConversationsPlusColors.secondaryText());
break;
default:
- statusView.setTextColor(activity.getWarningTextColor());
+ statusView.setTextColor(ConversationsPlusColors.warning());
break;
}
final Switch tglAccountState = (Switch) view.findViewById(R.id.tgl_account_status);
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java
index ab131cd0..37b8aa18 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java
@@ -20,6 +20,7 @@ import java.lang.ref.WeakReference;
import java.util.List;
import java.util.concurrent.RejectedExecutionException;
+import de.thedevstack.conversationsplus.ConversationsPlusColors;
import de.thedevstack.conversationsplus.ui.listeners.ShowResourcesListDialogListener;
import de.tzur.conversations.Settings;
import de.thedevstack.conversationsplus.R;
@@ -52,7 +53,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
// Highlight the currently selected conversation
if (this.activity instanceof ConversationActivity) {
ConversationActivity a = (ConversationActivity) this.activity;
- int c = conversation == a.getSelectedConversation() ? a.getSecondaryBackgroundColor() : a.getPrimaryBackgroundColor();
+ int c = conversation == a.getSelectedConversation() ? ConversationsPlusColors.secondaryBackground() : ConversationsPlusColors.primaryBackground();
view.findViewById(R.id.conversationListRowContent).setBackgroundColor(c);
view.findViewById(R.id.conversationListRowFrame).setBackgroundColor(c);
}
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java
index bcfc1dc6..9311674b 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java
@@ -39,6 +39,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import de.thedevstack.conversationsplus.ConversationsPlusApplication;
+import de.thedevstack.conversationsplus.ConversationsPlusColors;
import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
import de.thedevstack.conversationsplus.R;
import de.thedevstack.conversationsplus.crypto.axolotl.XmppAxolotlSession;
@@ -121,9 +122,9 @@ public class MessageAdapter extends ArrayAdapter<Message> {
private int getMessageTextColor(boolean onDark, boolean primary) {
if (onDark) {
- return activity.getResources().getColor(primary ? R.color.white : R.color.white70);
+ return primary ? ConversationsPlusColors.primaryTextOnDark() : ConversationsPlusColors.secondaryTextOnDark();
} else {
- return activity.getResources().getColor(primary ? R.color.black87 : R.color.black54);
+ return primary ? ConversationsPlusColors.primaryText() : ConversationsPlusColors.secondaryText();
}
}
@@ -184,7 +185,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
break;
}
if (error && type == SENT) {
- viewHolder.time.setTextColor(activity.getWarningTextColor());
+ viewHolder.time.setTextColor(ConversationsPlusColors.warning());
} else {
viewHolder.time.setTextColor(this.getMessageTextColor(darkBackground,false));
}
@@ -199,7 +200,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
message.getAxolotlFingerprint());
if(trust == null || (!trust.trusted() && !trust.trustedInactive())) {
- viewHolder.indicator.setColorFilter(activity.getWarningTextColor());
+ viewHolder.indicator.setColorFilter(ConversationsPlusColors.warning());
viewHolder.indicator.setAlpha(1.0f);
} else {
viewHolder.indicator.clearColorFilter();
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/PresencesArrayAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/PresencesArrayAdapter.java
index 2f8d12f2..2d777897 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/PresencesArrayAdapter.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/PresencesArrayAdapter.java
@@ -36,7 +36,7 @@ public class PresencesArrayAdapter extends ArrayAdapter<Presence> {
View rowView = inflater.inflate(R.layout.dialog_resources_status, parent, false);
TextView textView = (TextView) rowView.findViewById(R.id.dlg_res_stat_resource_name);
textView.setText(this.values[position].resource);
- textView.setTextColor(Color.parseColor(UIHelper.getStatusColor(this.values[position].status)));
+ textView.setTextColor(UIHelper.getStatusColor(this.values[position].status));
return rowView;
}