aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2016-03-29 11:53:34 +0200
committersteckbrief <steckbrief@chefmail.de>2016-03-29 11:53:34 +0200
commite388dfc0b8c32ea5916ae6f803217061dac58663 (patch)
tree64162bd7e68fbe0ae83b354ff7d6878948c2bee1 /src/main/java/de/thedevstack
parent77b1f2138e19545a48ea93c97f8518a87b065831 (diff)
parent6244834096727cfc1aaaeba7845a6d9cfe27d2b0 (diff)
Merge remote-tracking branch 'remotes/origin/trz/rename' into trz/rebase
Conflicts: src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java src/main/java/eu/siacs/conversations/ui/forms/FormFieldWrapper.java src/main/java/eu/siacs/conversations/utils/UIHelper.java
Diffstat (limited to 'src/main/java/de/thedevstack')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ConversationsPlusColors.java157
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/adapter/PresencesArrayAdapter.java2
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java4
3 files changed, 161 insertions, 2 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusColors.java b/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusColors.java
new file mode 100644
index 00000000..352e86e3
--- /dev/null
+++ b/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusColors.java
@@ -0,0 +1,157 @@
+package de.thedevstack.conversationsplus;
+
+/**
+ * Helper class for accessing colors.
+ */
+public final class ConversationsPlusColors {
+ /**
+ * Returns the primary background color.
+ * @return the primary background color
+ */
+ public static int primaryBackground() {
+ return byId(R.color.primaryBackground);
+ }
+
+ /**
+ * Returns the secondary background color.
+ * @return the secondary background color
+ */
+ public static int secondaryBackground() {
+ return byId(R.color.secondaryBackground);
+ }
+
+ /**
+ * Returns the primary text color.
+ * @return the primary text color
+ */
+ public static int primaryText() {
+ return byId(R.color.primaryText);
+ }
+
+ /**
+ * Returns the secondary text color.
+ * @return the secondary text color
+ */
+ public static int secondaryText() {
+ return byId(R.color.secondaryText);
+ }
+
+ /**
+ * Returns the tertiary text color.
+ * @return the tertiary text color
+ */
+ public static int tertiaryText() {
+ return byId(R.color.tertiaryText);
+ }
+
+ /**
+ * Returns the primary text color on dark background.
+ * @return the primary text color on dark background
+ */
+ public static int primaryTextOnDark() {
+ return byId(R.color.primaryTextOnDark);
+ }
+
+ /**
+ * Returns the secondary text color on dark background.
+ * @return the secondary text color on dark background
+ */
+ public static int secondaryTextOnDark() {
+ return byId(R.color.secondaryTextOnDark);
+ }
+
+ /**
+ * Returns the online color.
+ * @return the online color
+ */
+ public static int online() {
+ return byId(R.color.online);
+ }
+
+ /**
+ * Returns the color for the presence status 'chat'.
+ * @return the color for the presence status 'chat'
+ */
+ public static int chat() {
+ return byId(R.color.chat);
+ }
+
+ /**
+ * Returns the color for the presence status 'away'.
+ * @return the color for the presence status 'away'
+ */
+ public static int away() {
+ return byId(R.color.away);
+ }
+
+ /**
+ * Returns the color for the presence status 'dnd'.
+ * @return the color for the presence status 'dnd'
+ */
+ public static int dnd() {
+ return byId(R.color.dnd);
+ }
+
+ /**
+ * Returns the color for the presence status 'xa'.
+ * @return the color for the presence status 'xa'
+ */
+ public static int xa() {
+ return byId(R.color.xa);
+ }
+
+ /**
+ * Returns the color for the presence status 'offline'.
+ * @return the color for the presence status 'offline'
+ */
+ public static int offline() {
+ return byId(R.color.offline);
+ }
+
+ /**
+ * Returns the error color.
+ * @return the error color
+ */
+ public static int error() {
+ return byId(R.color.error);
+ }
+
+ /**
+ * Returns the warning color.
+ * @return the warning color
+ */
+ public static int warning() {
+ return byId(R.color.warning);
+ }
+
+ /**
+ * Returns the notification color.
+ * @return the notification color
+ */
+ public static int notification() {
+ return byId(R.color.notification);
+ }
+
+ /**
+ * Returns the accent color.
+ * @return the accent color
+ */
+ public static int accent() {
+ return byId(R.color.accent);
+ }
+
+ /**
+ * Returns the color identified by id.
+ * Delegates to android.content.res.Resources.getColor(int)
+ * @param id the id of the color
+ * @see {@link android.content.res.Resources#getColor(int)}
+ * @return the color identified by id
+ */
+ private static int byId(int id) {
+ return ConversationsPlusApplication.getAppContext().getResources().getColor(id);
+ }
+
+ private ConversationsPlusColors() {
+ // avoid instantiation - helper class
+ }
+}
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 e14d7f6b..d1f1e835 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;
}
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java b/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java
index 9ada85f3..e5a478e8 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java
@@ -8,6 +8,8 @@ import android.widget.TextView;
import java.util.Date;
import de.thedevstack.android.logcat.Logging;
+import de.thedevstack.conversationsplus.ConversationsPlusColors;
+
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Message;
@@ -86,7 +88,7 @@ public class MessageDetailsDialog extends AbstractAlertDialog {
break;
case Message.STATUS_SEND_FAILED:
msgStatusResId = R.string.dlg_msg_details_msg_status_failed;
- msgStatusTextView.setTextColor(getContext().getResources().getColor(R.color.error));
+ msgStatusTextView.setTextColor(ConversationsPlusColors.error());
break;
case Message.STATUS_RECEIVED:
msgStatusResId = R.string.dlg_msg_details_msg_status_received;