diff options
Diffstat (limited to 'src/main/java/de/pixart')
5 files changed, 34 insertions, 25 deletions
diff --git a/src/main/java/de/pixart/messenger/services/AudioPlayer.java b/src/main/java/de/pixart/messenger/services/AudioPlayer.java index e2600c100..e6d1e7c08 100644 --- a/src/main/java/de/pixart/messenger/services/AudioPlayer.java +++ b/src/main/java/de/pixart/messenger/services/AudioPlayer.java @@ -57,7 +57,11 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti } private boolean init(ViewHolder viewHolder, Message message) { - viewHolder.runtime.setTextColor(this.messageAdapter.getMessageTextColor(viewHolder.darkBackground, false)); + if (viewHolder.darkBackground) { + viewHolder.runtime.setTextAppearance(this.messageAdapter.getContext(), R.style.TextAppearance_Conversations_Caption_OnDark); + } else { + viewHolder.runtime.setTextAppearance(this.messageAdapter.getContext(), R.style.TextAppearance_Conversations_Caption); + } viewHolder.progress.setOnSeekBarChangeListener(this); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ColorStateList color = ContextCompat.getColorStateList(messageAdapter.getContext(), viewHolder.darkBackground ? R.color.white70 : R.color.bubble); diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java index 3bba088ad..b69cf637e 100644 --- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java @@ -1008,7 +1008,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat this.mPgpFingerprint.setText(OpenPgpUtils.convertKeyIdToHex(pgpKeyId)); this.mPgpFingerprint.setOnClickListener(openPgp); if ("pgp".equals(messageFingerprint)) { - this.getmPgpFingerprintDesc.setTextColor(ContextCompat.getColor(this, R.color.accent)); + this.getmPgpFingerprintDesc.setTextAppearance(this, R.style.TextAppearance_Conversations_Caption_Highlight); } this.getmPgpFingerprintDesc.setOnClickListener(openPgp); this.mPgpDeleteFingerprintButton.setOnClickListener(delete); @@ -1038,10 +1038,10 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat if (ownAxolotlFingerprint != null && Config.supportOmemo()) { this.mAxolotlFingerprintBox.setVisibility(View.VISIBLE); if (ownAxolotlFingerprint.equals(messageFingerprint)) { - this.mOwnFingerprintDesc.setTextColor(ContextCompat.getColor(this, R.color.accent)); + this.mOwnFingerprintDesc.setTextAppearance(this, R.style.TextAppearance_Conversations_Caption_Highlight); this.mOwnFingerprintDesc.setText(R.string.omemo_fingerprint_selected_message); } else { - this.mOwnFingerprintDesc.setTextColor(getSecondaryTextColor()); + this.mOwnFingerprintDesc.setTextAppearance(this, R.style.TextAppearance_Conversations_Caption); this.mOwnFingerprintDesc.setText(R.string.omemo_fingerprint); } this.mAxolotlFingerprint.setText(CryptoHelper.prettifyFingerprint(ownAxolotlFingerprint.substring(2))); diff --git a/src/main/java/de/pixart/messenger/ui/OmemoActivity.java b/src/main/java/de/pixart/messenger/ui/OmemoActivity.java index b278e146c..850188a2c 100644 --- a/src/main/java/de/pixart/messenger/ui/OmemoActivity.java +++ b/src/main/java/de/pixart/messenger/ui/OmemoActivity.java @@ -3,7 +3,6 @@ package de.pixart.messenger.ui; import android.content.Intent; import android.databinding.DataBindingUtil; -import android.os.Bundle; import android.support.v4.content.ContextCompat; import android.support.v7.app.AlertDialog; import android.view.ContextMenu; @@ -11,7 +10,6 @@ import android.view.MenuItem; import android.view.View; import android.widget.CompoundButton; import android.widget.LinearLayout; -import android.widget.TextView; import android.widget.Toast; import de.pixart.messenger.Config; @@ -133,8 +131,8 @@ public abstract class OmemoActivity extends XmppActivity { binding.tglTrust.setChecked(status.isTrusted()); if (status.isActive()) { - binding.key.setTextColor(getPrimaryTextColor()); - binding.keyType.setTextColor(getSecondaryTextColor()); + binding.key.setTextAppearance(this, R.style.TextAppearance_Conversations_Fingerprint); + binding.keyType.setTextAppearance(this, R.style.TextAppearance_Conversations_Caption); if (status.isVerified()) { binding.verifiedFingerprint.setVisibility(View.VISIBLE); binding.verifiedFingerprint.setAlpha(1.0f); @@ -160,8 +158,8 @@ public abstract class OmemoActivity extends XmppActivity { toast = v -> hideToast(); } } else { - binding.key.setTextColor(getTertiaryTextColor()); - binding.keyType.setTextColor(getTertiaryTextColor()); + binding.key.setTextAppearance(this, R.style.TextAppearance_Conversations_Fingerprint_Disabled); + binding.keyType.setTextAppearance(this, R.style.TextAppearance_Conversations_Caption_Disabled); toast = v -> replaceToast(getString(R.string.this_device_is_no_longer_in_use), false); if (status.isVerified()) { binding.tglTrust.setVisibility(View.GONE); @@ -184,7 +182,7 @@ public abstract class OmemoActivity extends XmppActivity { binding.keyType.setVisibility(View.GONE); } if (highlight) { - binding.keyType.setTextColor(ContextCompat.getColor(this, R.color.accent)); + binding.keyType.setTextAppearance(this, R.style.TextAppearance_Conversations_Caption_Highlight); binding.keyType.setText(getString(x509 ? R.string.omemo_fingerprint_x509_selected_message : R.string.omemo_fingerprint_selected_message)); } else { binding.keyType.setText(getString(x509 ? R.string.omemo_fingerprint_x509 : R.string.omemo_fingerprint)); diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index 4ae530d37..38d7086f4 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -906,10 +906,6 @@ public abstract class XmppActivity extends AppCompatActivity { } } - public int getTertiaryTextColor() { - return this.mTertiaryTextColor; - } - public int getSecondaryTextColor() { return this.mSecondaryTextColor; } diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java index defaffa99..436f0f219 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java @@ -304,7 +304,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie break; } if (error && type == SENT) { - viewHolder.time.setTextColor(activity.getWarningTextColor()); + viewHolder.time.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Caption_Waring); DownloadableFile file = activity.xmppConnectionService.getFileBackend().getFile(message); if (file.exists()) { if (activity.xmppConnectionService.mHttpConnectionManager.getAutoAcceptFileSize() >= message.getFileParams().size) { @@ -329,6 +329,11 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie viewHolder.resend_button.setVisibility(View.GONE); viewHolder.time.setTextColor(this.getMessageTextColor(darkBackground, false)); } else { + if (darkBackground) { + viewHolder.time.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Caption_OnDark); + } else { + viewHolder.time.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Caption); + } viewHolder.time.setTextColor(this.getMessageTextColor(darkBackground, false)); } if (message.getEncryption() == Message.ENCRYPTION_NONE) { @@ -386,8 +391,11 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie viewHolder.image.setVisibility(View.GONE); viewHolder.messageBody.setVisibility(View.VISIBLE); viewHolder.messageBody.setText(text); - viewHolder.messageBody.setTextColor(getMessageTextColor(darkBackground, false)); - viewHolder.messageBody.setTypeface(null, Typeface.ITALIC); + if (darkBackground) { + viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1_Secondary_OnDark); + } else { + viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1_Secondary); + } viewHolder.messageBody.setTextIsSelectable(false); } @@ -396,10 +404,11 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie viewHolder.image.setVisibility(View.GONE); viewHolder.audioPlayer.setVisibility(View.GONE); viewHolder.messageBody.setVisibility(View.VISIBLE); - viewHolder.messageBody.setText(getContext().getString( - R.string.decryption_failed)); - viewHolder.messageBody.setTextColor(getMessageTextColor(darkBackground, false)); - viewHolder.messageBody.setTypeface(null, Typeface.NORMAL); + if (darkBackground) { + viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1_Secondary_OnDark); + } else { + viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1_Secondary); + } viewHolder.messageBody.setTextIsSelectable(false); } @@ -507,8 +516,11 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie viewHolder.image.setVisibility(View.GONE); viewHolder.audioPlayer.setVisibility(View.GONE); viewHolder.messageBody.setVisibility(View.VISIBLE); - viewHolder.messageBody.setTextColor(this.getMessageTextColor(darkBackground, true)); - viewHolder.messageBody.setLinkTextColor(this.getMessageTextColor(darkBackground, true)); + if (darkBackground) { + viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1_OnDark); + } else { + viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1); + } viewHolder.messageBody.setHighlightColor(ContextCompat.getColor(activity, darkBackground ? R.color.grey800 : R.color.grey500)); viewHolder.messageBody.setTypeface(null, Typeface.NORMAL); if (message.getBody() != null) { @@ -853,7 +865,6 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie } else { viewHolder.status_message.setText(DateUtils.formatDateTime(activity, message.getTimeSent(), DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR)); } - viewHolder.status_message.setTextColor(activity.getSecondaryTextColor()); return view; } else if (type == STATUS) { if ("LOAD_MORE".equals(message.getBody())) { |