From 57bcf824e951d0d5cdec04c167e08588f17c8d5a Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 2 Mar 2018 17:09:00 +0100 Subject: [PATCH] finished app compat themeing --- .../ui/ChangePasswordActivity.java | 2 -- .../conversations/ui/EditAccountActivity.java | 7 ----- .../ui/PublishProfilePictureActivity.java | 1 - .../conversations/ui/SetPresenceActivity.java | 1 - .../conversations/ui/TrustKeysActivity.java | 2 -- .../siacs/conversations/ui/XmppActivity.java | 30 ++----------------- .../res/layout/activity_change_password.xml | 4 +-- src/main/res/layout/activity_edit_account.xml | 8 ++--- .../activity_publish_profile_picture.xml | 6 ++-- src/main/res/layout/activity_trust_keys.xml | 6 ++-- src/main/res/layout/dialog_block_contact.xml | 1 - src/main/res/layout/dialog_clear_history.xml | 1 - src/main/res/layout/fragment_conversation.xml | 3 +- src/main/res/layout/magic_create.xml | 2 +- src/main/res/layout/welcome.xml | 4 +-- src/main/res/values/attrs.xml | 4 --- src/main/res/values/strings.xml | 2 -- src/main/res/values/themes.xml | 21 ------------- src/main/res/xml/preferences.xml | 5 ---- 19 files changed, 16 insertions(+), 94 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java b/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java index 37618fdb0..ea507bf68 100644 --- a/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java +++ b/src/main/java/eu/siacs/conversations/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); } } @@ -97,7 +96,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/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index 0d40e4d47..1d5fbf65a 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -447,29 +447,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(); @@ -750,7 +744,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/eu/siacs/conversations/ui/PublishProfilePictureActivity.java b/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java index 2b48becc4..9e94a2097 100644 --- a/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java @@ -292,7 +292,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/eu/siacs/conversations/ui/SetPresenceActivity.java b/src/main/java/eu/siacs/conversations/ui/SetPresenceActivity.java index f813cd599..78a2945f7 100644 --- a/src/main/java/eu/siacs/conversations/ui/SetPresenceActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/SetPresenceActivity.java @@ -163,7 +163,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/eu/siacs/conversations/ui/TrustKeysActivity.java b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java index 761e865b3..9f6ff6157 100644 --- a/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java @@ -421,12 +421,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/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index 32febdc00..6e1b2da11 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -85,9 +85,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; @@ -414,9 +411,6 @@ public abstract class XmppActivity extends AppCompatActivity { 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); mColorOrange = ContextCompat.getColor(this, R.color.orange500); mColorGreen = ContextCompat.getColor(this, R.color.green500); @@ -426,9 +420,6 @@ public abstract class XmppActivity extends AppCompatActivity { this.mTheme = findTheme(); if (isDarkTheme()) { - mPrimaryTextColor = ContextCompat.getColor(this, R.color.white); - mSecondaryTextColor = ContextCompat.getColor(this, R.color.white70); - mTertiaryTextColor = ContextCompat.getColor(this, R.color.white12); mPrimaryBackgroundColor = ContextCompat.getColor(this, R.color.grey800); mSecondaryBackgroundColor = ContextCompat.getColor(this, R.color.grey900); } @@ -443,7 +434,7 @@ public abstract class XmppActivity extends AppCompatActivity { } public boolean isDarkTheme() { - return this.mTheme == R.style.ConversationsTheme_Dark || this.mTheme == R.style.ConversationsTheme_Dark_LargerText; + return this.mTheme == R.style.ConversationsTheme_Dark; } public int getThemeResource(int r_attr_name, int r_drawable_def) { @@ -778,14 +769,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; } @@ -859,18 +842,11 @@ 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 (dark) { - if (larger) - return R.style.ConversationsTheme_Dark_LargerText; - else - return R.style.ConversationsTheme_Dark; + return R.style.ConversationsTheme_Dark; } else { - if (larger) - return R.style.ConversationsTheme_LargerText; - else - return R.style.ConversationsTheme; + return R.style.ConversationsTheme; } } diff --git a/src/main/res/layout/activity_change_password.xml b/src/main/res/layout/activity_change_password.xml index 3f8ceff1b..2148c2e43 100644 --- a/src/main/res/layout/activity_change_password.xml +++ b/src/main/res/layout/activity_change_password.xml @@ -31,7 +31,7 @@ android:layout_height="wrap_content" app:passwordToggleDrawable="@drawable/visibility_toggle_drawable" app:passwordToggleEnabled="true" - app:passwordToggleTint="?attr/color_text_secondary"> + app:passwordToggleTint="?android:textColorSecondary"> + app:passwordToggleTint="?android:textColorSecondary"> + app:passwordToggleTint="?android:textColorSecondary"> + android:text="@string/cancel"/> + android:text="@string/save"/> diff --git a/src/main/res/layout/activity_publish_profile_picture.xml b/src/main/res/layout/activity_publish_profile_picture.xml index 01a18f407..c77c7a4d2 100644 --- a/src/main/res/layout/activity_publish_profile_picture.xml +++ b/src/main/res/layout/activity_publish_profile_picture.xml @@ -71,8 +71,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" - android:text="@string/cancel" - android:textColor="?attr/color_text_primary"/> + android:text="@string/cancel"/> + android:text="@string/publish"/> \ No newline at end of file diff --git a/src/main/res/layout/activity_trust_keys.xml b/src/main/res/layout/activity_trust_keys.xml index d49347aa9..88d5066fd 100644 --- a/src/main/res/layout/activity_trust_keys.xml +++ b/src/main/res/layout/activity_trust_keys.xml @@ -110,8 +110,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" - android:text="@string/cancel" - android:textColor="?attr/color_text_primary"/> + android:text="@string/cancel"/> + android:text="@string/done"/> \ No newline at end of file diff --git a/src/main/res/layout/dialog_block_contact.xml b/src/main/res/layout/dialog_block_contact.xml index abdf6b7dc..23abaaa94 100644 --- a/src/main/res/layout/dialog_block_contact.xml +++ b/src/main/res/layout/dialog_block_contact.xml @@ -17,7 +17,6 @@ android:layout_marginTop="8dp" android:id="@+id/report_spam" android:layout_width="wrap_content" - android:textColor="?attr/color_text_primary" android:layout_height="wrap_content" android:text="@string/report_jid_as_spammer" /> diff --git a/src/main/res/layout/dialog_clear_history.xml b/src/main/res/layout/dialog_clear_history.xml index ae7c235e6..176252635 100644 --- a/src/main/res/layout/dialog_clear_history.xml +++ b/src/main/res/layout/dialog_clear_history.xml @@ -18,7 +18,6 @@ diff --git a/src/main/res/layout/fragment_conversation.xml b/src/main/res/layout/fragment_conversation.xml index 57888c622..c917cc533 100644 --- a/src/main/res/layout/fragment_conversation.xml +++ b/src/main/res/layout/fragment_conversation.xml @@ -47,8 +47,7 @@ android:paddingBottom="12dp" android:paddingLeft="8dp" android:paddingRight="8dp" - android:paddingTop="12dp" - android:textColor="?attr/color_text_primary"> + android:paddingTop="12dp"> diff --git a/src/main/res/layout/magic_create.xml b/src/main/res/layout/magic_create.xml index ba200d16d..b03797ad7 100644 --- a/src/main/res/layout/magic_create.xml +++ b/src/main/res/layout/magic_create.xml @@ -80,7 +80,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" - android:textColor="?attr/color_text_secondary" + android:textColor="?android:textColorSecondary" android:textSize="@dimen/fineprint_size" android:maxLines="1" android:text="@string/free_for_six_month" diff --git a/src/main/res/layout/welcome.xml b/src/main/res/layout/welcome.xml index aa35f4468..0c05452d6 100644 --- a/src/main/res/layout/welcome.xml +++ b/src/main/res/layout/welcome.xml @@ -50,7 +50,7 @@ android:layout_height="wrap_content" android:layout_gravity="right" android:text="@string/use_own_provider" - android:textColor="?attr/color_text_secondary"/> + android:textColor="?android:textColorSecondary"/> - - - - diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 1be95cb9f..ffc9d2d7c 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -283,8 +283,6 @@ End time Enable quiet hours Notifications will be silenced during quiet hours - Increase font size - Use larger font sizes across the entire app Send button indicates status Request message receipts Received messages will be marked with a green tick if supported diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml index 432ae9c68..2f8cbdad1 100644 --- a/src/main/res/values/themes.xml +++ b/src/main/res/values/themes.xml @@ -6,9 +6,6 @@ @color/primary700 @color/accent - @color/black87 - @color/black54 - @color/grey50 @color/grey200 @@ -16,7 +13,6 @@ @color/accent 12sp - 14sp 5sp 18sp @@ -85,8 +81,6 @@ @color/primary900 @color/accent - @color/white - @color/white70 @color/grey800 @color/grey900 @@ -95,7 +89,6 @@ @color/accent 12sp - 14sp 5sp 18sp @@ -159,20 +152,6 @@ @drawable/ic_new_releases_white_24dp - - - -