finished app compat themeing

This commit is contained in:
Daniel Gultsch 2018-03-02 17:09:00 +01:00
parent e5704f4cbd
commit 57bcf824e9
19 changed files with 16 additions and 94 deletions

View file

@ -35,7 +35,6 @@ public class ChangePasswordActivity extends XmppActivity implements XmppConnecti
mNewPasswordLayout.setError(null); mNewPasswordLayout.setError(null);
xmppConnectionService.updateAccountPasswordOnServer(mAccount, newPassword, ChangePasswordActivity.this); xmppConnectionService.updateAccountPasswordOnServer(mAccount, newPassword, ChangePasswordActivity.this);
mChangePasswordButton.setEnabled(false); mChangePasswordButton.setEnabled(false);
mChangePasswordButton.setTextColor(getSecondaryTextColor());
mChangePasswordButton.setText(R.string.updating); mChangePasswordButton.setText(R.string.updating);
} }
} }
@ -97,7 +96,6 @@ public class ChangePasswordActivity extends XmppActivity implements XmppConnecti
runOnUiThread(() -> { runOnUiThread(() -> {
mNewPasswordLayout.setError(getString(R.string.could_not_change_password)); mNewPasswordLayout.setError(getString(R.string.could_not_change_password));
mChangePasswordButton.setEnabled(true); mChangePasswordButton.setEnabled(true);
mChangePasswordButton.setTextColor(getPrimaryTextColor());
mChangePasswordButton.setText(R.string.change_password); mChangePasswordButton.setText(R.string.change_password);
}); });

View file

@ -447,29 +447,23 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
if (!mInitMode && passwordChangedInMagicCreateMode()) { if (!mInitMode && passwordChangedInMagicCreateMode()) {
this.mSaveButton.setText(R.string.change_password); this.mSaveButton.setText(R.string.change_password);
this.mSaveButton.setEnabled(true); this.mSaveButton.setEnabled(true);
this.mSaveButton.setTextColor(getPrimaryTextColor());
} else if (accountInfoEdited && !mInitMode) { } else if (accountInfoEdited && !mInitMode) {
this.mSaveButton.setText(R.string.save); this.mSaveButton.setText(R.string.save);
this.mSaveButton.setEnabled(true); this.mSaveButton.setEnabled(true);
this.mSaveButton.setTextColor(getPrimaryTextColor());
} else if (mAccount != null } else if (mAccount != null
&& (mAccount.getStatus() == Account.State.CONNECTING || mAccount.getStatus() == Account.State.REGISTRATION_SUCCESSFUL || mFetchingAvatar)) { && (mAccount.getStatus() == Account.State.CONNECTING || mAccount.getStatus() == Account.State.REGISTRATION_SUCCESSFUL || mFetchingAvatar)) {
this.mSaveButton.setEnabled(false); this.mSaveButton.setEnabled(false);
this.mSaveButton.setTextColor(getSecondaryTextColor());
this.mSaveButton.setText(R.string.account_status_connecting); this.mSaveButton.setText(R.string.account_status_connecting);
} else if (mAccount != null && mAccount.getStatus() == Account.State.DISABLED && !mInitMode) { } else if (mAccount != null && mAccount.getStatus() == Account.State.DISABLED && !mInitMode) {
this.mSaveButton.setEnabled(true); this.mSaveButton.setEnabled(true);
this.mSaveButton.setTextColor(getPrimaryTextColor());
this.mSaveButton.setText(R.string.enable); this.mSaveButton.setText(R.string.enable);
} else { } else {
this.mSaveButton.setEnabled(true); this.mSaveButton.setEnabled(true);
this.mSaveButton.setTextColor(getPrimaryTextColor());
if (!mInitMode) { if (!mInitMode) {
if (mAccount != null && mAccount.isOnlineAndConnected()) { if (mAccount != null && mAccount.isOnlineAndConnected()) {
this.mSaveButton.setText(R.string.save); this.mSaveButton.setText(R.string.save);
if (!accountInfoEdited) { if (!accountInfoEdited) {
this.mSaveButton.setEnabled(false); this.mSaveButton.setEnabled(false);
this.mSaveButton.setTextColor(getSecondaryTextColor());
} }
} else { } else {
XmppConnection connection = mAccount == null ? null : mAccount.getXmppConnection(); 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) { if (Config.MAGIC_CREATE_DOMAIN == null && this.xmppConnectionService.getAccounts().size() == 0) {
this.mCancelButton.setEnabled(false); this.mCancelButton.setEnabled(false);
this.mCancelButton.setTextColor(getSecondaryTextColor());
} }
if (mUsernameMode) { if (mUsernameMode) {
this.binding.accountJid.setHint(R.string.username_hint); this.binding.accountJid.setHint(R.string.username_hint);

View file

@ -292,7 +292,6 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
final boolean status = enabled && !publishing; final boolean status = enabled && !publishing;
this.publishButton.setText(publishing ? R.string.publishing : res); this.publishButton.setText(publishing ? R.string.publishing : res);
this.publishButton.setEnabled(status); this.publishButton.setEnabled(status);
this.publishButton.setTextColor(status ? getPrimaryTextColor() : getSecondaryTextColor());
} }
public void refreshUiReal() { public void refreshUiReal() {

View file

@ -163,7 +163,6 @@ public class SetPresenceActivity extends XmppActivity implements View.OnClickLis
} }
boolean e = noAccountUsesPgp(); boolean e = noAccountUsesPgp();
this.binding.allAccounts.setEnabled(e); this.binding.allAccounts.setEnabled(e);
this.binding.allAccounts.setTextColor(e ? getPrimaryTextColor() : getSecondaryTextColor());
} }
redrawTemplates(); redrawTemplates();
} }

View file

@ -421,12 +421,10 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
private void unlock() { private void unlock() {
binding.saveButton.setEnabled(true); binding.saveButton.setEnabled(true);
binding.saveButton.setTextColor(getPrimaryTextColor());
} }
private void lock() { private void lock() {
binding.saveButton.setEnabled(false); binding.saveButton.setEnabled(false);
binding.saveButton.setTextColor(getSecondaryTextColor());
} }
private void lockOrUnlockAsNeeded() { private void lockOrUnlockAsNeeded() {

View file

@ -85,9 +85,6 @@ public abstract class XmppActivity extends AppCompatActivity {
public boolean xmppConnectionServiceBound = false; public boolean xmppConnectionServiceBound = false;
protected boolean registeredListeners = false; protected boolean registeredListeners = false;
protected int mPrimaryTextColor;
protected int mSecondaryTextColor;
protected int mTertiaryTextColor;
protected int mPrimaryBackgroundColor; protected int mPrimaryBackgroundColor;
protected int mSecondaryBackgroundColor; protected int mSecondaryBackgroundColor;
protected int mColorRed; protected int mColorRed;
@ -414,9 +411,6 @@ public abstract class XmppActivity extends AppCompatActivity {
metrics = getResources().getDisplayMetrics(); metrics = getResources().getDisplayMetrics();
ExceptionHelper.init(getApplicationContext()); 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); mColorRed = ContextCompat.getColor(this, R.color.red800);
mColorOrange = ContextCompat.getColor(this, R.color.orange500); mColorOrange = ContextCompat.getColor(this, R.color.orange500);
mColorGreen = ContextCompat.getColor(this, R.color.green500); mColorGreen = ContextCompat.getColor(this, R.color.green500);
@ -426,9 +420,6 @@ public abstract class XmppActivity extends AppCompatActivity {
this.mTheme = findTheme(); this.mTheme = findTheme();
if (isDarkTheme()) { 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); mPrimaryBackgroundColor = ContextCompat.getColor(this, R.color.grey800);
mSecondaryBackgroundColor = ContextCompat.getColor(this, R.color.grey900); mSecondaryBackgroundColor = ContextCompat.getColor(this, R.color.grey900);
} }
@ -443,7 +434,7 @@ public abstract class XmppActivity extends AppCompatActivity {
} }
public boolean isDarkTheme() { 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) { 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() { public int getWarningTextColor() {
return this.mColorRed; return this.mColorRed;
} }
@ -859,17 +842,10 @@ public abstract class XmppActivity extends AppCompatActivity {
protected int findTheme() { protected int findTheme() {
Boolean dark = getPreferences().getString(SettingsActivity.THEME, getResources().getString(R.string.theme)).equals("dark"); 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 (dark) {
if (larger)
return R.style.ConversationsTheme_Dark_LargerText;
else
return R.style.ConversationsTheme_Dark; return R.style.ConversationsTheme_Dark;
} else { } else {
if (larger)
return R.style.ConversationsTheme_LargerText;
else
return R.style.ConversationsTheme; return R.style.ConversationsTheme;
} }
} }

View file

@ -31,7 +31,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:passwordToggleDrawable="@drawable/visibility_toggle_drawable" app:passwordToggleDrawable="@drawable/visibility_toggle_drawable"
app:passwordToggleEnabled="true" app:passwordToggleEnabled="true"
app:passwordToggleTint="?attr/color_text_secondary"> app:passwordToggleTint="?android:textColorSecondary">
<android.support.design.widget.TextInputEditText <android.support.design.widget.TextInputEditText
android:id="@+id/current_password" android:id="@+id/current_password"
@ -48,7 +48,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:passwordToggleDrawable="@drawable/visibility_toggle_drawable" app:passwordToggleDrawable="@drawable/visibility_toggle_drawable"
app:passwordToggleEnabled="true" app:passwordToggleEnabled="true"
app:passwordToggleTint="?attr/color_text_secondary"> app:passwordToggleTint="?android:textColorSecondary">
<android.support.design.widget.TextInputEditText <android.support.design.widget.TextInputEditText
android:id="@+id/new_password" android:id="@+id/new_password"

View file

@ -71,7 +71,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:passwordToggleDrawable="@drawable/visibility_toggle_drawable" app:passwordToggleDrawable="@drawable/visibility_toggle_drawable"
app:passwordToggleEnabled="true" app:passwordToggleEnabled="true"
app:passwordToggleTint="?attr/color_text_secondary"> app:passwordToggleTint="?android:textColorSecondary">
<android.support.design.widget.TextInputEditText <android.support.design.widget.TextInputEditText
android:id="@+id/account_password" android:id="@+id/account_password"
@ -604,8 +604,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/cancel" android:text="@string/cancel"/>
android:textColor="?attr/color_text_primary"/>
<View <View
android:layout_width="1dp" android:layout_width="1dp"
@ -621,8 +620,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:enabled="false" android:enabled="false"
android:text="@string/save" android:text="@string/save"/>
android:textColor="?attr/color_text_secondary"/>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View file

@ -71,8 +71,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/cancel" android:text="@string/cancel"/>
android:textColor="?attr/color_text_primary"/>
<View <View
android:layout_width="1dp" android:layout_width="1dp"
@ -88,8 +87,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:enabled="false" android:enabled="false"
android:text="@string/publish" android:text="@string/publish"/>
android:textColor="?attr/color_text_secondary"/>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View file

@ -110,8 +110,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/cancel" android:text="@string/cancel"/>
android:textColor="?attr/color_text_primary"/>
<View <View
android:layout_width="1dp" android:layout_width="1dp"
@ -127,8 +126,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:enabled="true" android:enabled="true"
android:text="@string/done" android:text="@string/done"/>
android:textColor="?attr/color_text_secondary"/>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
</layout> </layout>

View file

@ -17,7 +17,6 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:id="@+id/report_spam" android:id="@+id/report_spam"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:textColor="?attr/color_text_primary"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/report_jid_as_spammer" /> android:text="@string/report_jid_as_spammer" />

View file

@ -18,7 +18,6 @@
<CheckBox <CheckBox
android:id="@+id/end_conversation_checkbox" android:id="@+id/end_conversation_checkbox"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:textColor="?attr/color_text_primary"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:checked="true" android:checked="true"
android:text="@string/also_end_conversation" /> android:text="@string/also_end_conversation" />

View file

@ -47,8 +47,7 @@
android:paddingBottom="12dp" android:paddingBottom="12dp"
android:paddingLeft="8dp" android:paddingLeft="8dp"
android:paddingRight="8dp" android:paddingRight="8dp"
android:paddingTop="12dp" android:paddingTop="12dp">
android:textColor="?attr/color_text_primary">
<requestFocus/> <requestFocus/>
</eu.siacs.conversations.ui.widget.EditMessage> </eu.siacs.conversations.ui.widget.EditMessage>

View file

@ -80,7 +80,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:textColor="?attr/color_text_secondary" android:textColor="?android:textColorSecondary"
android:textSize="@dimen/fineprint_size" android:textSize="@dimen/fineprint_size"
android:maxLines="1" android:maxLines="1"
android:text="@string/free_for_six_month" android:text="@string/free_for_six_month"

View file

@ -50,7 +50,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right" android:layout_gravity="right"
android:text="@string/use_own_provider" android:text="@string/use_own_provider"
android:textColor="?attr/color_text_secondary"/> android:textColor="?android:textColorSecondary"/>
</LinearLayout> </LinearLayout>
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -73,7 +73,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:textColor="?attr/color_text_secondary" android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/fineprint_size" android:textSize="@dimen/fineprint_size"
android:maxLines="1" android:maxLines="1"
android:text="@string/free_for_six_month" android:text="@string/free_for_six_month"

View file

@ -2,14 +2,10 @@
<resources> <resources>
<attr name="TextSizeInfo" format="dimension" /> <attr name="TextSizeInfo" format="dimension" />
<attr name="TextSizeBody" format="dimension" />
<attr name="TextSeparation" format="dimension"/> <attr name="TextSeparation" format="dimension"/>
<attr name="IconSize" format="dimension"/> <attr name="IconSize" format="dimension"/>
<attr name="color_text_primary" format="reference|color" />
<attr name="color_text_secondary" format="reference|color" />
<attr name="color_background_secondary" format="reference|color" /> <attr name="color_background_secondary" format="reference|color" />
<attr name="color_background_primary" format="reference|color" /> <attr name="color_background_primary" format="reference|color" />

View file

@ -283,8 +283,6 @@
<string name="title_pref_quiet_hours_end_time">End time</string> <string name="title_pref_quiet_hours_end_time">End time</string>
<string name="title_pref_enable_quiet_hours">Enable quiet hours</string> <string name="title_pref_enable_quiet_hours">Enable quiet hours</string>
<string name="pref_quiet_hours_summary">Notifications will be silenced during quiet hours</string> <string name="pref_quiet_hours_summary">Notifications will be silenced during quiet hours</string>
<string name="pref_use_larger_font">Increase font size</string>
<string name="pref_use_larger_font_summary">Use larger font sizes across the entire app</string>
<string name="pref_use_send_button_to_indicate_status">Send button indicates status</string> <string name="pref_use_send_button_to_indicate_status">Send button indicates status</string>
<string name="pref_use_indicate_received">Request message receipts</string> <string name="pref_use_indicate_received">Request message receipts</string>
<string name="pref_use_indicate_received_summary">Received messages will be marked with a green tick if supported</string> <string name="pref_use_indicate_received_summary">Received messages will be marked with a green tick if supported</string>

View file

@ -6,9 +6,6 @@
<item name="colorPrimaryDark">@color/primary700</item> <item name="colorPrimaryDark">@color/primary700</item>
<item name="colorAccent">@color/accent</item> <item name="colorAccent">@color/accent</item>
<item name="color_text_primary">@color/black87</item>
<item name="color_text_secondary">@color/black54</item>
<item name="color_background_primary">@color/grey50</item> <item name="color_background_primary">@color/grey50</item>
<item name="color_background_secondary">@color/grey200</item> <item name="color_background_secondary">@color/grey200</item>
@ -16,7 +13,6 @@
<item name="android:actionModeBackground">@color/accent</item> <item name="android:actionModeBackground">@color/accent</item>
<item name="TextSizeInfo">12sp</item> <item name="TextSizeInfo">12sp</item>
<item name="TextSizeBody">14sp</item>
<item name="TextSeparation">5sp</item> <item name="TextSeparation">5sp</item>
<item name="IconSize">18sp</item> <item name="IconSize">18sp</item>
@ -85,8 +81,6 @@
<item name="colorPrimaryDark">@color/primary900</item> <item name="colorPrimaryDark">@color/primary900</item>
<item name="colorAccent">@color/accent</item> <item name="colorAccent">@color/accent</item>
<item name="color_text_primary">@color/white</item>
<item name="color_text_secondary">@color/white70</item>
<item name="color_background_primary">@color/grey800</item> <item name="color_background_primary">@color/grey800</item>
<item name="color_background_secondary">@color/grey900</item> <item name="color_background_secondary">@color/grey900</item>
@ -95,7 +89,6 @@
<item name="android:actionModeBackground">@color/accent</item> <item name="android:actionModeBackground">@color/accent</item>
<item name="TextSizeInfo">12sp</item> <item name="TextSizeInfo">12sp</item>
<item name="TextSizeBody">14sp</item>
<item name="TextSeparation">5sp</item> <item name="TextSeparation">5sp</item>
<item name="IconSize">18sp</item> <item name="IconSize">18sp</item>
@ -159,20 +152,6 @@
<item type="reference" name="icon_enable_undecided_device">@drawable/ic_new_releases_white_24dp</item> <item type="reference" name="icon_enable_undecided_device">@drawable/ic_new_releases_white_24dp</item>
</style> </style>
<style name="ConversationsTheme.LargerText" parent="ConversationsTheme">
<item name="TextSizeInfo">14sp</item>
<item name="TextSizeBody">16sp</item>
<item name="TextSeparation">6sp</item>
<item name="IconSize">20sp</item>
</style>
<style name="ConversationsTheme.Dark.LargerText" parent="ConversationsTheme.Dark">
<item name="TextSizeInfo">14sp</item>
<item name="TextSizeBody">16sp</item>
<item name="IconSize">20sp</item>
<item name="TextSeparation">6sp</item>
</style>
<style name="ConversationsTheme.FullScreen" parent="@style/Theme.AppCompat.Light"> <style name="ConversationsTheme.FullScreen" parent="@style/Theme.AppCompat.Light">
<item name="android:windowNoTitle">true</item> <item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item> <item name="android:windowActionBar">false</item>

View file

@ -149,11 +149,6 @@
android:key="use_green_background" android:key="use_green_background"
android:summary="@string/pref_use_green_background_summary" android:summary="@string/pref_use_green_background_summary"
android:title="@string/pref_use_green_background"/> android:title="@string/pref_use_green_background"/>
<CheckBoxPreference
android:defaultValue="@bool/use_larger_font"
android:key="use_larger_font"
android:summary="@string/pref_use_larger_font_summary"
android:title="@string/pref_use_larger_font"/>
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="@bool/send_button_status" android:defaultValue="@bool/send_button_status"
android:key="send_button_status" android:key="send_button_status"