diff options
author | steckbrief <steckbrief@chefmail.de> | 2016-03-29 11:43:22 +0200 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2016-03-29 11:43:22 +0200 |
commit | 6244834096727cfc1aaaeba7845a6d9cfe27d2b0 (patch) | |
tree | bc532e86b2bfca9afbcfcfc4c383b48ecb287ea4 /src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java | |
parent | 0c0676b7dbf87e24ebcc4714adfb10d91e3d72b8 (diff) |
Implements FS#173: Move access to colors to separate helper class
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java | 66 |
1 files changed, 10 insertions, 56 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java index fed3049b..f7856a9c 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java @@ -70,6 +70,7 @@ import java.util.List; import java.util.concurrent.RejectedExecutionException; import de.thedevstack.android.logcat.Logging; +import de.thedevstack.conversationsplus.ConversationsPlusColors; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; import de.thedevstack.conversationsplus.utils.ImageUtil; import de.thedevstack.conversationsplus.Config; @@ -103,16 +104,6 @@ public abstract class XmppActivity extends Activity { public boolean xmppConnectionServiceBound = false; protected boolean registeredListeners = false; - protected int mPrimaryTextColor; - protected int mSecondaryTextColor; - protected int mTertiaryTextColor; - protected int mPrimaryBackgroundColor; - protected int mSecondaryBackgroundColor; - protected int mColorRed; - protected int mColorOrange; - protected int mColorGreen; - protected int mPrimaryColor; - protected boolean mUseSubject = true; private DisplayMetrics metrics; @@ -360,15 +351,6 @@ public abstract class XmppActivity extends Activity { super.onCreate(savedInstanceState); metrics = getResources().getDisplayMetrics(); ExceptionHelper.init(getApplicationContext()); - mPrimaryTextColor = getResources().getColor(R.color.primaryText); - mSecondaryTextColor = getResources().getColor(R.color.secondaryText); - mTertiaryTextColor = getResources().getColor(R.color.black12); - mColorRed = getResources().getColor(R.color.error); - mColorOrange = getResources().getColor(R.color.orange500); - mColorGreen = getResources().getColor(R.color.online); - mPrimaryColor = getResources().getColor(R.color.primary); - mPrimaryBackgroundColor = getResources().getColor(R.color.primaryBackground); - mSecondaryBackgroundColor = getResources().getColor(R.color.secondaryBackground); this.mTheme = findTheme(); setTheme(this.mTheme); this.mUsingEnterKey = ConversationsPlusPreferences.displayEnterKey(); @@ -749,30 +731,30 @@ public abstract class XmppActivity extends Activity { if (Config.X509_VERIFICATION && trust == XmppAxolotlSession.Trust.TRUSTED_X509) { trustToggle.setOnClickListener(null); } - key.setTextColor(getPrimaryTextColor()); - keyType.setTextColor(getSecondaryTextColor()); + key.setTextColor(ConversationsPlusColors.primaryText()); + keyType.setTextColor(ConversationsPlusColors.secondaryText()); break; case UNDECIDED: trustToggle.setChecked(false); trustToggle.setEnabled(false); - key.setTextColor(getPrimaryTextColor()); - keyType.setTextColor(getSecondaryTextColor()); + key.setTextColor(ConversationsPlusColors.primaryText()); + keyType.setTextColor(ConversationsPlusColors.secondaryText()); break; case INACTIVE_UNTRUSTED: case INACTIVE_UNDECIDED: trustToggle.setOnClickListener(null); trustToggle.setChecked(false); trustToggle.setEnabled(false); - key.setTextColor(getTertiaryTextColor()); - keyType.setTextColor(getTertiaryTextColor()); + key.setTextColor(ConversationsPlusColors.tertiaryText()); + keyType.setTextColor(ConversationsPlusColors.tertiaryText()); break; case INACTIVE_TRUSTED: case INACTIVE_TRUSTED_X509: trustToggle.setOnClickListener(null); trustToggle.setChecked(true); trustToggle.setEnabled(false); - key.setTextColor(getTertiaryTextColor()); - keyType.setTextColor(getTertiaryTextColor()); + key.setTextColor(ConversationsPlusColors.tertiaryText()); + keyType.setTextColor(ConversationsPlusColors.tertiaryText()); break; } @@ -782,7 +764,7 @@ public abstract class XmppActivity extends Activity { keyType.setVisibility(View.GONE); } if (highlight) { - keyType.setTextColor(getResources().getColor(R.color.accent)); + keyType.setTextColor(ConversationsPlusColors.accent()); keyType.setText(getString(x509 ? R.string.omemo_fingerprint_x509_selected_message : R.string.omemo_fingerprint_selected_message)); } else { keyType.setText(getString(x509 ? R.string.omemo_fingerprint_x509 : R.string.omemo_fingerprint)); @@ -944,34 +926,6 @@ public abstract class XmppActivity extends Activity { } }; - public int getTertiaryTextColor() { - return this.mTertiaryTextColor; - } - - public int getSecondaryTextColor() { - return this.mSecondaryTextColor; - } - - public int getPrimaryTextColor() { - return this.mPrimaryTextColor; - } - - public int getWarningTextColor() { - return this.mColorRed; - } - - public int getOnlineColor() { - return this.mColorGreen; - } - - public int getPrimaryBackgroundColor() { - return this.mPrimaryBackgroundColor; - } - - public int getSecondaryBackgroundColor() { - return this.mSecondaryBackgroundColor; - } - public int getPixel(int dp) { DisplayMetrics metrics = getResources().getDisplayMetrics(); return ((int) (dp * metrics.density)); |