aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-07-20 13:21:21 +0200
committeriNPUTmice <daniel@gultsch.de>2014-07-20 13:21:21 +0200
commit3b7f89bbb0ba96b00f97ff23ea713bd2915c7c74 (patch)
tree6816040ec496933aaabc3b2fee28da603e1f2d7b /src/eu/siacs/conversations
parent542cbef53ba4a62405d03cd08b1a6342d5c3cddc (diff)
disable subscription checkboxes when account is offline
Diffstat (limited to 'src/eu/siacs/conversations')
-rw-r--r--src/eu/siacs/conversations/ui/ContactDetailsActivity.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/eu/siacs/conversations/ui/ContactDetailsActivity.java
index 71ff4ca8a..2ec6459b2 100644
--- a/src/eu/siacs/conversations/ui/ContactDetailsActivity.java
+++ b/src/eu/siacs/conversations/ui/ContactDetailsActivity.java
@@ -31,6 +31,7 @@ import eu.siacs.conversations.crypto.PgpEngine;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Presences;
+import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate;
import eu.siacs.conversations.services.XmppConnectionService.OnRosterUpdate;
import eu.siacs.conversations.utils.UIHelper;
@@ -144,6 +145,20 @@ public class ContactDetailsActivity extends XmppActivity {
}
};
+ private OnAccountUpdate accountUpdate = new OnAccountUpdate() {
+
+ @Override
+ public void onAccountUpdate() {
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ populateView();
+ }
+ });
+ }
+ };
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -244,6 +259,13 @@ public class ContactDetailsActivity extends XmppActivity {
receive.setChecked(false);
}
}
+ if (contact.getAccount().getStatus() == Account.STATUS_ONLINE) {
+ receive.setEnabled(true);
+ send.setEnabled(true);
+ } else {
+ receive.setEnabled(false);
+ send.setEnabled(false);
+ }
lastseen.setText(UIHelper.lastseen(getApplicationContext(),
contact.lastseen.time));
@@ -338,6 +360,7 @@ public class ContactDetailsActivity extends XmppActivity {
@Override
public void onBackendConnected() {
xmppConnectionService.setOnRosterUpdateListener(this.rosterUpdate);
+ xmppConnectionService.setOnAccountListChangedListener(this.accountUpdate );
if ((accountJid != null) && (contactJid != null)) {
Account account = xmppConnectionService
.findAccountByJid(accountJid);
@@ -353,6 +376,7 @@ public class ContactDetailsActivity extends XmppActivity {
protected void onStop() {
super.onStop();
xmppConnectionService.removeOnRosterUpdateListener();
+ xmppConnectionService.removeOnAccountListChangedListener();
}
}