diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-04-01 20:22:38 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-04-01 20:22:38 +0200 |
commit | c2f72e3d8c91f92cc8cfe6480196a2f55d9e4364 (patch) | |
tree | 2ff80905d36d18890ceb91c568fb1da22322bd84 /src/main/java | |
parent | 02ceb5cb2eac35710528e539f9d279d7f6a781a7 (diff) |
finished app compat themeing
Diffstat (limited to '')
7 files changed, 6 insertions, 29 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ChangePasswordActivity.java b/src/main/java/de/pixart/messenger/ui/ChangePasswordActivity.java index f6bec9838..5f1b5ba94 100644 --- a/src/main/java/de/pixart/messenger/ui/ChangePasswordActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ChangePasswordActivity.java @@ -35,7 +35,6 @@ public class ChangePasswordActivity extends XmppActivity implements XmppConnecti mNewPasswordLayout.setError(null); xmppConnectionService.updateAccountPasswordOnServer(mAccount, newPassword, ChangePasswordActivity.this); mChangePasswordButton.setEnabled(false); - mChangePasswordButton.setTextColor(getSecondaryTextColor()); mChangePasswordButton.setText(R.string.updating); } } @@ -103,7 +102,6 @@ public class ChangePasswordActivity extends XmppActivity implements XmppConnecti runOnUiThread(() -> { mNewPasswordLayout.setError(getString(R.string.could_not_change_password)); mChangePasswordButton.setEnabled(true); - mChangePasswordButton.setTextColor(getPrimaryTextColor()); mChangePasswordButton.setText(R.string.change_password); }); diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java index b69cf637e..a1a1956bc 100644 --- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java @@ -455,29 +455,23 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat if (!mInitMode && passwordChangedInMagicCreateMode()) { this.mSaveButton.setText(R.string.change_password); this.mSaveButton.setEnabled(true); - this.mSaveButton.setTextColor(getPrimaryTextColor()); } else if (accountInfoEdited && !mInitMode) { this.mSaveButton.setText(R.string.save); this.mSaveButton.setEnabled(true); - this.mSaveButton.setTextColor(getPrimaryTextColor()); } else if (mAccount != null && (mAccount.getStatus() == Account.State.CONNECTING || mAccount.getStatus() == Account.State.REGISTRATION_SUCCESSFUL || mFetchingAvatar)) { this.mSaveButton.setEnabled(false); - this.mSaveButton.setTextColor(getSecondaryTextColor()); 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.setText(R.string.enable); } else { this.mSaveButton.setEnabled(true); - this.mSaveButton.setTextColor(getPrimaryTextColor()); if (!mInitMode) { if (mAccount != null && mAccount.isOnlineAndConnected()) { this.mSaveButton.setText(R.string.save); if (!accountInfoEdited) { this.mSaveButton.setEnabled(false); - this.mSaveButton.setTextColor(getSecondaryTextColor()); } } else { XmppConnection connection = mAccount == null ? null : mAccount.getXmppConnection(); @@ -776,7 +770,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat if (Config.MAGIC_CREATE_DOMAIN == null && this.xmppConnectionService.getAccounts().size() == 0) { this.mCancelButton.setEnabled(false); - this.mCancelButton.setTextColor(getSecondaryTextColor()); } if (mUsernameMode) { this.binding.accountJid.setHint(R.string.username_hint); diff --git a/src/main/java/de/pixart/messenger/ui/PublishProfilePictureActivity.java b/src/main/java/de/pixart/messenger/ui/PublishProfilePictureActivity.java index 681aedc6e..1dd23a3de 100644 --- a/src/main/java/de/pixart/messenger/ui/PublishProfilePictureActivity.java +++ b/src/main/java/de/pixart/messenger/ui/PublishProfilePictureActivity.java @@ -291,7 +291,6 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC final boolean status = enabled && !publishing; this.publishButton.setText(publishing ? R.string.publishing : res); this.publishButton.setEnabled(status); - this.publishButton.setTextColor(status ? getPrimaryTextColor() : getSecondaryTextColor()); } public void refreshUiReal() { diff --git a/src/main/java/de/pixart/messenger/ui/SetPresenceActivity.java b/src/main/java/de/pixart/messenger/ui/SetPresenceActivity.java index d4bddb534..383763402 100644 --- a/src/main/java/de/pixart/messenger/ui/SetPresenceActivity.java +++ b/src/main/java/de/pixart/messenger/ui/SetPresenceActivity.java @@ -157,7 +157,6 @@ public class SetPresenceActivity extends XmppActivity implements View.OnClickLis } boolean e = noAccountUsesPgp(); this.binding.allAccounts.setEnabled(e); - this.binding.allAccounts.setTextColor(e ? getPrimaryTextColor() : getSecondaryTextColor()); } redrawTemplates(); } diff --git a/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java b/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java index 751c51f09..5641fc171 100644 --- a/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java +++ b/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java @@ -415,12 +415,10 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat private void unlock() { binding.saveButton.setEnabled(true); - binding.saveButton.setTextColor(getPrimaryTextColor()); } private void lock() { binding.saveButton.setEnabled(false); - binding.saveButton.setTextColor(getSecondaryTextColor()); } private void lockOrUnlockAsNeeded() { diff --git a/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java b/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java index 47e991520..83518fcda 100644 --- a/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java +++ b/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java @@ -378,14 +378,12 @@ public class VerifyOTRActivity extends XmppActivity implements XmppConnectionSer protected void activateButton(Button button, int text, View.OnClickListener listener) { button.setEnabled(true); - button.setTextColor(getPrimaryTextColor()); button.setText(text); button.setOnClickListener(listener); } protected void deactivateButton(Button button, int text) { button.setEnabled(false); - button.setTextColor(getSecondaryTextColor()); button.setText(text); button.setOnClickListener(null); } diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index 38d7086f4..d38563d04 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -95,9 +95,6 @@ public abstract class XmppActivity extends AppCompatActivity { 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; @@ -413,9 +410,6 @@ public abstract class XmppActivity extends AppCompatActivity { super.onCreate(savedInstanceState); metrics = getResources().getDisplayMetrics(); ExceptionHelper.init(getApplicationContext()); - mPrimaryTextColor = ContextCompat.getColor(this, R.color.black87); - mSecondaryTextColor = ContextCompat.getColor(this, R.color.black54); - mTertiaryTextColor = ContextCompat.getColor(this, R.color.black12); mColorRed = ContextCompat.getColor(this, R.color.red800); mColorWarningButton = ContextCompat.getColor(this, R.color.warning_button); mColorWhite = ContextCompat.getColor(this, R.color.white70); @@ -434,6 +428,11 @@ public abstract class XmppActivity extends AppCompatActivity { } } + // todo theme +// public boolean isDarkTheme() { +// return this.mTheme == R.style.ConversationsTheme_Dark; +// } + public int getThemeResource(int r_attr_name, int r_drawable_def) { int[] attrs = { r_attr_name }; TypedArray ta = this.getTheme().obtainStyledAttributes(attrs); @@ -906,14 +905,6 @@ public abstract class XmppActivity extends AppCompatActivity { } } - public int getSecondaryTextColor() { - return this.mSecondaryTextColor; - } - - public int getPrimaryTextColor() { - return this.mPrimaryTextColor; - } - public int getWarningTextColor() { return this.mColorRed; } @@ -1010,6 +1001,7 @@ public abstract class XmppActivity extends AppCompatActivity { } protected int findTheme() { + Boolean dark = getPreferences().getString(SettingsActivity.THEME, getResources().getString(R.string.theme)).equals("dark"); Boolean larger = getPreferences().getBoolean("use_larger_font", getResources().getBoolean(R.bool.use_larger_font)); if (larger) { |