diff options
author | steckbrief <steckbrief@chefmail.de> | 2016-03-29 22:28:19 +0200 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2016-03-29 22:28:19 +0200 |
commit | 1d5d94080a6bffaf5fa7c358af76a3cfae0a8ade (patch) | |
tree | 8aa91ceb1f114a2d20249c65223e6b87b7191af6 /src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java | |
parent | 6244834096727cfc1aaaeba7845a6d9cfe27d2b0 (diff) |
Introduction of a TextViewUtil to easily set attributes for TextViews
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java index 9a616414..33b73a32 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java @@ -51,6 +51,7 @@ import de.thedevstack.conversationsplus.services.XmppConnectionService.OnCaptcha import de.thedevstack.conversationsplus.ui.adapter.KnownHostsAdapter; import de.thedevstack.conversationsplus.utils.CryptoHelper; import de.thedevstack.conversationsplus.utils.UIHelper; +import de.thedevstack.conversationsplus.utils.ui.TextViewUtil; import de.thedevstack.conversationsplus.xml.Element; import de.thedevstack.conversationsplus.xmpp.OnKeyStatusUpdated; import de.thedevstack.conversationsplus.xmpp.XmppConnection; @@ -335,26 +336,18 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate protected void updateSaveButton() { if (accountInfoEdited() && !mInitMode) { - this.mSaveButton.setText(R.string.save); - this.mSaveButton.setEnabled(true); - this.mSaveButton.setTextColor(ConversationsPlusColors.primaryText()); + TextViewUtil.enable(mSaveButton, ConversationsPlusColors.primaryText(), R.string.save); } else if (mAccount != null && (mAccount.getStatus() == Account.State.CONNECTING || mFetchingAvatar)) { - this.mSaveButton.setEnabled(false); - this.mSaveButton.setTextColor(ConversationsPlusColors.secondaryText()); - this.mSaveButton.setText(R.string.account_status_connecting); + TextViewUtil.disable(mSaveButton, ConversationsPlusColors.secondaryText(), R.string.account_status_connecting); } else if (mAccount != null && mAccount.getStatus() == Account.State.DISABLED && !mInitMode) { - this.mSaveButton.setEnabled(true); - this.mSaveButton.setTextColor(ConversationsPlusColors.primaryText()); - this.mSaveButton.setText(R.string.enable); + TextViewUtil.enable(mSaveButton, ConversationsPlusColors.primaryText(), R.string.enable); } else { - this.mSaveButton.setEnabled(true); - this.mSaveButton.setTextColor(ConversationsPlusColors.primaryText()); + TextViewUtil.enable(mSaveButton, ConversationsPlusColors.primaryText()); if (!mInitMode) { if (mAccount != null && mAccount.isOnlineAndConnected()) { this.mSaveButton.setText(R.string.save); if (!accountInfoEdited()) { - this.mSaveButton.setEnabled(false); - this.mSaveButton.setTextColor(ConversationsPlusColors.secondaryText()); + TextViewUtil.disable(mSaveButton, ConversationsPlusColors.secondaryText()); } } else { this.mSaveButton.setText(R.string.connect); @@ -552,8 +545,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate getActionBar().setDisplayShowHomeEnabled(false); getActionBar().setHomeButtonEnabled(false); } - this.mCancelButton.setEnabled(false); - this.mCancelButton.setTextColor(ConversationsPlusColors.secondaryText()); + TextViewUtil.disable(mCancelButton, ConversationsPlusColors.secondaryText()); } if (Config.DOMAIN_LOCK == null) { final KnownHostsAdapter mKnownHostsAdapter = new KnownHostsAdapter(this, |