From 6244834096727cfc1aaaeba7845a6d9cfe27d2b0 Mon Sep 17 00:00:00 2001 From: steckbrief Date: Tue, 29 Mar 2016 11:43:22 +0200 Subject: Implements FS#173: Move access to colors to separate helper class --- .../conversationsplus/ConversationsPlusColors.java | 157 +++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 src/main/java/de/thedevstack/conversationsplus/ConversationsPlusColors.java (limited to 'src/main/java/de/thedevstack/conversationsplus/ConversationsPlusColors.java') 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 + } +} -- cgit v1.2.3