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/TrustKeysActivity.java | |
parent | 6244834096727cfc1aaaeba7845a6d9cfe27d2b0 (diff) |
Introduction of a TextViewUtil to easily set attributes for TextViews
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/ui/TrustKeysActivity.java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/TrustKeysActivity.java | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/TrustKeysActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/TrustKeysActivity.java index 7772adc4..9ecf7f62 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/TrustKeysActivity.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/TrustKeysActivity.java @@ -25,6 +25,7 @@ import de.thedevstack.conversationsplus.crypto.axolotl.XmppAxolotlSession; import de.thedevstack.conversationsplus.entities.Account; import de.thedevstack.conversationsplus.entities.Contact; import de.thedevstack.conversationsplus.entities.Conversation; +import de.thedevstack.conversationsplus.utils.ui.TextViewUtil; import de.thedevstack.conversationsplus.xmpp.OnKeyStatusUpdated; import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; import de.thedevstack.conversationsplus.xmpp.jid.Jid; @@ -161,8 +162,7 @@ public class TrustKeysActivity extends XmppActivity implements OnKeyStatusUpdate ownKeysCard.setVisibility(hasOwnKeys ? View.VISIBLE : View.GONE); foreignKeys.setVisibility(hasForeignKeys ? View.VISIBLE : View.GONE); if(hasPendingKeyFetches()) { - setFetching(); - lock(); + TextViewUtil.disable(this.mSaveButton, ConversationsPlusColors.secondaryText(), R.string.fetching_keys); } else { if (!hasForeignKeys && hasNoOtherTrustedKeys()) { keyErrorMessageCard.setVisibility(View.VISIBLE); @@ -178,7 +178,7 @@ public class TrustKeysActivity extends XmppActivity implements OnKeyStatusUpdate foreignKeys.setVisibility(View.GONE); } lockOrUnlockAsNeeded(); - setDone(); + mSaveButton.setText(R.string.done); } } @@ -305,35 +305,16 @@ public class TrustKeysActivity extends XmppActivity implements OnKeyStatusUpdate } } - private void unlock() { - mSaveButton.setEnabled(true); - mSaveButton.setTextColor(ConversationsPlusColors.primaryText()); - } - - private void lock() { - mSaveButton.setEnabled(false); - mSaveButton.setTextColor(ConversationsPlusColors.secondaryText()); - } - private void lockOrUnlockAsNeeded() { synchronized (this.foreignKeysToTrust) { for (Jid jid : contactJids) { Map<String, Boolean> fingerprints = foreignKeysToTrust.get(jid); if (hasNoOtherTrustedKeys(jid) && (fingerprints == null || !fingerprints.values().contains(true))) { - lock(); + TextViewUtil.disable(this.mSaveButton, ConversationsPlusColors.secondaryText()); return; } } } - unlock(); - - } - - private void setDone() { - mSaveButton.setText(getString(R.string.done)); - } - - private void setFetching() { - mSaveButton.setText(getString(R.string.fetching_keys)); + TextViewUtil.enable(this.mSaveButton, ConversationsPlusColors.primaryText()); } } |