aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/ui
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java6
-rw-r--r--src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java13
-rw-r--r--src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java15
-rw-r--r--src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java6
-rw-r--r--src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java6
-rw-r--r--src/main/java/eu/siacs/conversations/ui/XmppActivity.java66
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java8
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java3
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java9
-rw-r--r--src/main/java/eu/siacs/conversations/ui/forms/FormFieldWrapper.java4
10 files changed, 52 insertions, 84 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java b/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java
index 1cc8fd29..5c3f9bb3 100644
--- a/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java
@@ -6,6 +6,8 @@ import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
+import de.thedevstack.conversationsplus.ConversationsPlusColors;
+
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.services.XmppConnectionService;
@@ -38,7 +40,7 @@ public class ChangePasswordActivity extends XmppActivity implements XmppConnecti
mNewPasswordConfirm.setError(null);
xmppConnectionService.updateAccountPasswordOnServer(mAccount, newPassword, ChangePasswordActivity.this);
mChangePasswordButton.setEnabled(false);
- mChangePasswordButton.setTextColor(getSecondaryTextColor());
+ mChangePasswordButton.setTextColor(ConversationsPlusColors.secondaryText());
mChangePasswordButton.setText(R.string.updating);
}
}
@@ -91,7 +93,7 @@ public class ChangePasswordActivity extends XmppActivity implements XmppConnecti
public void run() {
mNewPassword.setError(getString(R.string.could_not_change_password));
mChangePasswordButton.setEnabled(true);
- mChangePasswordButton.setTextColor(getPrimaryTextColor());
+ mChangePasswordButton.setTextColor(ConversationsPlusColors.primaryText());
mChangePasswordButton.setText(R.string.change_password);
}
});
diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
index 720a7454..9e01837a 100644
--- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
@@ -38,6 +38,7 @@ import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
+import de.thedevstack.conversationsplus.ConversationsPlusColors;
import de.thedevstack.conversationsplus.ui.listeners.ShowResourcesListDialogListener;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
@@ -336,24 +337,24 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
if (accountInfoEdited() && !mInitMode) {
this.mSaveButton.setText(R.string.save);
this.mSaveButton.setEnabled(true);
- this.mSaveButton.setTextColor(getPrimaryTextColor());
+ this.mSaveButton.setTextColor(ConversationsPlusColors.primaryText());
} else if (mAccount != null && (mAccount.getStatus() == Account.State.CONNECTING || mFetchingAvatar)) {
this.mSaveButton.setEnabled(false);
- this.mSaveButton.setTextColor(getSecondaryTextColor());
+ this.mSaveButton.setTextColor(ConversationsPlusColors.secondaryText());
this.mSaveButton.setText(R.string.account_status_connecting);
} else if (mAccount != null && mAccount.getStatus() == Account.State.DISABLED && !mInitMode) {
this.mSaveButton.setEnabled(true);
- this.mSaveButton.setTextColor(getPrimaryTextColor());
+ this.mSaveButton.setTextColor(ConversationsPlusColors.primaryText());
this.mSaveButton.setText(R.string.enable);
} else {
this.mSaveButton.setEnabled(true);
- this.mSaveButton.setTextColor(getPrimaryTextColor());
+ this.mSaveButton.setTextColor(ConversationsPlusColors.primaryText());
if (!mInitMode) {
if (mAccount != null && mAccount.isOnlineAndConnected()) {
this.mSaveButton.setText(R.string.save);
if (!accountInfoEdited()) {
this.mSaveButton.setEnabled(false);
- this.mSaveButton.setTextColor(getSecondaryTextColor());
+ this.mSaveButton.setTextColor(ConversationsPlusColors.secondaryText());
}
} else {
this.mSaveButton.setText(R.string.connect);
@@ -552,7 +553,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
getActionBar().setHomeButtonEnabled(false);
}
this.mCancelButton.setEnabled(false);
- this.mCancelButton.setTextColor(getSecondaryTextColor());
+ this.mCancelButton.setTextColor(ConversationsPlusColors.secondaryText());
}
if (Config.DOMAIN_LOCK == null) {
final KnownHostsAdapter mKnownHostsAdapter = new KnownHostsAdapter(this,
diff --git a/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java b/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java
index 57fcf4e3..301baff5 100644
--- a/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java
@@ -22,6 +22,7 @@ import com.soundcloud.android.crop.Crop;
import java.io.File;
import java.io.FileNotFoundException;
+import de.thedevstack.conversationsplus.ConversationsPlusColors;
import de.thedevstack.conversationsplus.utils.ImageUtil;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
@@ -85,7 +86,7 @@ public class PublishProfilePictureActivity extends XmppActivity {
@Override
public void run() {
hintOrWarning.setText(errorCode);
- hintOrWarning.setTextColor(getWarningTextColor());
+ hintOrWarning.setTextColor(ConversationsPlusColors.warning());
publishButton.setText(R.string.publish);
enablePublishButton();
}
@@ -245,7 +246,7 @@ public class PublishProfilePictureActivity extends XmppActivity {
}
if (!support) {
this.hintOrWarning
- .setTextColor(getWarningTextColor());
+ .setTextColor(ConversationsPlusColors.warning());
this.hintOrWarning
.setText(R.string.error_publish_avatar_no_server_support);
}
@@ -288,7 +289,7 @@ public class PublishProfilePictureActivity extends XmppActivity {
if (bm == null) {
disablePublishButton();
- this.hintOrWarning.setTextColor(getWarningTextColor());
+ this.hintOrWarning.setTextColor(ConversationsPlusColors.warning());
this.hintOrWarning
.setText(R.string.error_publish_avatar_converting);
return;
@@ -298,10 +299,10 @@ public class PublishProfilePictureActivity extends XmppActivity {
enablePublishButton();
this.publishButton.setText(R.string.publish);
this.hintOrWarning.setText(R.string.publish_avatar_explanation);
- this.hintOrWarning.setTextColor(getPrimaryTextColor());
+ this.hintOrWarning.setTextColor(ConversationsPlusColors.primaryText());
} else {
disablePublishButton();
- this.hintOrWarning.setTextColor(getWarningTextColor());
+ this.hintOrWarning.setTextColor(ConversationsPlusColors.warning());
this.hintOrWarning
.setText(R.string.error_publish_avatar_no_server_support);
}
@@ -316,12 +317,12 @@ public class PublishProfilePictureActivity extends XmppActivity {
protected void enablePublishButton() {
this.publishButton.setEnabled(true);
- this.publishButton.setTextColor(getPrimaryTextColor());
+ this.publishButton.setTextColor(ConversationsPlusColors.primaryText());
}
protected void disablePublishButton() {
this.publishButton.setEnabled(false);
- this.publishButton.setTextColor(getSecondaryTextColor());
+ this.publishButton.setTextColor(ConversationsPlusColors.secondaryText());
}
public void refreshUiReal() {
diff --git a/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java
index cc4ba7b2..96a365ef 100644
--- a/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java
@@ -18,6 +18,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import de.thedevstack.conversationsplus.ConversationsPlusColors;
+
import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.axolotl.AxolotlService;
import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession;
@@ -305,12 +307,12 @@ public class TrustKeysActivity extends XmppActivity implements OnKeyStatusUpdate
private void unlock() {
mSaveButton.setEnabled(true);
- mSaveButton.setTextColor(getPrimaryTextColor());
+ mSaveButton.setTextColor(ConversationsPlusColors.primaryText());
}
private void lock() {
mSaveButton.setEnabled(false);
- mSaveButton.setTextColor(getSecondaryTextColor());
+ mSaveButton.setTextColor(ConversationsPlusColors.secondaryText());
}
private void lockOrUnlockAsNeeded() {
diff --git a/src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java b/src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java
index 2e415d5b..d94c9a1e 100644
--- a/src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java
@@ -19,6 +19,8 @@ import com.google.zxing.integration.android.IntentResult;
import net.java.otr4j.OtrException;
import net.java.otr4j.session.Session;
+import de.thedevstack.conversationsplus.ConversationsPlusColors;
+
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
@@ -380,14 +382,14 @@ public class VerifyOTRActivity extends XmppActivity implements XmppConnectionSer
protected void activateButton(Button button, int text, View.OnClickListener listener) {
button.setEnabled(true);
- button.setTextColor(getPrimaryTextColor());
+ button.setTextColor(ConversationsPlusColors.primaryText());
button.setText(text);
button.setOnClickListener(listener);
}
protected void deactivateButton(Button button, int text) {
button.setEnabled(false);
- button.setTextColor(getSecondaryTextColor());
+ button.setTextColor(ConversationsPlusColors.secondaryText());
button.setText(text);
button.setOnClickListener(null);
}
diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
index 2568e4b9..880641b9 100644
--- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/main/java/eu/siacs/conversations/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;
@@ -104,16 +105,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;
@@ -361,15 +352,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();
@@ -750,30 +732,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;
}
@@ -783,7 +765,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));
@@ -945,34 +927,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));
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java
index b8f15e0e..55d3f5a7 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java
@@ -12,6 +12,8 @@ import android.widget.TextView;
import java.util.List;
+import de.thedevstack.conversationsplus.ConversationsPlusColors;
+
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
@@ -48,14 +50,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/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
index 2e40717a..31e54a0d 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
+++ b/src/main/java/eu/siacs/conversations/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 eu.siacs.conversations.R;
@@ -53,7 +54,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/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
index 1c0813a5..478c0604 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/main/java/eu/siacs/conversations/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.providers.ConversationsPlusFileProvider;
import eu.siacs.conversations.R;
@@ -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/eu/siacs/conversations/ui/forms/FormFieldWrapper.java b/src/main/java/eu/siacs/conversations/ui/forms/FormFieldWrapper.java
index 3b051191..cb504576 100644
--- a/src/main/java/eu/siacs/conversations/ui/forms/FormFieldWrapper.java
+++ b/src/main/java/eu/siacs/conversations/ui/forms/FormFieldWrapper.java
@@ -9,6 +9,8 @@ import android.view.View;
import java.util.List;
+import de.thedevstack.conversationsplus.ConversationsPlusColors;
+
import eu.siacs.conversations.R;
import eu.siacs.conversations.xmpp.forms.Field;
@@ -57,7 +59,7 @@ public abstract class FormFieldWrapper {
int start = label.length();
int end = label.length() + 2;
spannableString.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), start, end, 0);
- spannableString.setSpan(new ForegroundColorSpan(context.getResources().getColor(R.color.accent)), start, end, 0);
+ spannableString.setSpan(new ForegroundColorSpan(ConversationsPlusColors.accent()), start, end, 0);
}
return spannableString;
}