notify ui on roster changes
This commit is contained in:
parent
6b74c0594e
commit
4307b1de72
|
@ -38,6 +38,7 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mXmppConnectionService.updateRosterUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -99,6 +99,7 @@ public class PresenceParser extends AbstractParser implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mXmppConnectionService.updateRosterUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -105,6 +105,7 @@ public class XmppConnectionService extends Service {
|
||||||
private OnConversationUpdate mOnConversationUpdate = null;
|
private OnConversationUpdate mOnConversationUpdate = null;
|
||||||
private int convChangedListenerCount = 0;
|
private int convChangedListenerCount = 0;
|
||||||
private OnAccountUpdate mOnAccountUpdate = null;
|
private OnAccountUpdate mOnAccountUpdate = null;
|
||||||
|
private OnRosterUpdate mOnRosterUpdate = null;
|
||||||
private OnTLSExceptionReceived tlsException = null;
|
private OnTLSExceptionReceived tlsException = null;
|
||||||
public OnContactStatusChanged onContactStatusChanged = new OnContactStatusChanged() {
|
public OnContactStatusChanged onContactStatusChanged = new OnContactStatusChanged() {
|
||||||
|
|
||||||
|
@ -918,6 +919,14 @@ public class XmppConnectionService extends Service {
|
||||||
this.mOnAccountUpdate = null;
|
this.mOnAccountUpdate = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOnRosterUpdateListener(OnRosterUpdate listener) {
|
||||||
|
this.mOnRosterUpdate = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeOnRosterUpdateListener() {
|
||||||
|
this.mOnRosterUpdate = null;
|
||||||
|
}
|
||||||
|
|
||||||
public void connectMultiModeConversations(Account account) {
|
public void connectMultiModeConversations(Account account) {
|
||||||
List<Conversation> conversations = getConversations();
|
List<Conversation> conversations = getConversations();
|
||||||
for (int i = 0; i < conversations.size(); i++) {
|
for (int i = 0; i < conversations.size(); i++) {
|
||||||
|
@ -1262,6 +1271,12 @@ public class XmppConnectionService extends Service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateRosterUi() {
|
||||||
|
if (mOnRosterUpdate != null) {
|
||||||
|
mOnRosterUpdate.onRosterUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Account findAccountByJid(String accountJid) {
|
public Account findAccountByJid(String accountJid) {
|
||||||
for (Account account : this.accounts) {
|
for (Account account : this.accounts) {
|
||||||
if (account.getJid().equals(accountJid)) {
|
if (account.getJid().equals(accountJid)) {
|
||||||
|
|
|
@ -31,6 +31,7 @@ import eu.siacs.conversations.entities.Account;
|
||||||
import eu.siacs.conversations.entities.Contact;
|
import eu.siacs.conversations.entities.Contact;
|
||||||
import eu.siacs.conversations.entities.Presences;
|
import eu.siacs.conversations.entities.Presences;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
|
import eu.siacs.conversations.services.XmppConnectionService.OnRosterUpdate;
|
||||||
import eu.siacs.conversations.utils.UIHelper;
|
import eu.siacs.conversations.utils.UIHelper;
|
||||||
import eu.siacs.conversations.xmpp.stanzas.PresencePacket;
|
import eu.siacs.conversations.xmpp.stanzas.PresencePacket;
|
||||||
|
|
||||||
|
@ -89,6 +90,20 @@ public class ContactDetailsActivity extends XmppActivity {
|
||||||
|
|
||||||
private LinearLayout keys;
|
private LinearLayout keys;
|
||||||
|
|
||||||
|
private OnRosterUpdate rosterUpdate = new OnRosterUpdate() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRosterUpdate() {
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
populateView();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -270,6 +285,7 @@ public class ContactDetailsActivity extends XmppActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackendConnected() {
|
public void onBackendConnected() {
|
||||||
|
xmppConnectionService.setOnRosterUpdateListener(this.rosterUpdate );
|
||||||
if ((accountJid != null)&&(contactJid != null)) {
|
if ((accountJid != null)&&(contactJid != null)) {
|
||||||
Account account = xmppConnectionService.findAccountByJid(accountJid);
|
Account account = xmppConnectionService.findAccountByJid(accountJid);
|
||||||
if (account==null) {
|
if (account==null) {
|
||||||
|
@ -356,6 +372,7 @@ public class ContactDetailsActivity extends XmppActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
xmppConnectionService.removeOnRosterUpdateListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ import eu.siacs.conversations.entities.Bookmark;
|
||||||
import eu.siacs.conversations.entities.Contact;
|
import eu.siacs.conversations.entities.Contact;
|
||||||
import eu.siacs.conversations.entities.Conversation;
|
import eu.siacs.conversations.entities.Conversation;
|
||||||
import eu.siacs.conversations.entities.ListItem;
|
import eu.siacs.conversations.entities.ListItem;
|
||||||
|
import eu.siacs.conversations.services.XmppConnectionService.OnRosterUpdate;
|
||||||
import eu.siacs.conversations.ui.adapter.KnownHostsAdapter;
|
import eu.siacs.conversations.ui.adapter.KnownHostsAdapter;
|
||||||
import eu.siacs.conversations.ui.adapter.ListItemAdapter;
|
import eu.siacs.conversations.ui.adapter.ListItemAdapter;
|
||||||
import eu.siacs.conversations.utils.Validator;
|
import eu.siacs.conversations.utils.Validator;
|
||||||
|
@ -139,6 +140,19 @@ public class StartConversationActivity extends XmppActivity {
|
||||||
int count) {
|
int count) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
private OnRosterUpdate onRosterUpdate = new OnRosterUpdate() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRosterUpdate() {
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
filter(mSearchEditText.getText().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -201,6 +215,12 @@ public class StartConversationActivity extends XmppActivity {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
xmppConnectionService.removeOnRosterUpdateListener();
|
||||||
|
}
|
||||||
|
|
||||||
protected void openConversationForContact(int position) {
|
protected void openConversationForContact(int position) {
|
||||||
Contact contact = (Contact) contacts.get(position);
|
Contact contact = (Contact) contacts.get(position);
|
||||||
Conversation conversation = xmppConnectionService
|
Conversation conversation = xmppConnectionService
|
||||||
|
@ -444,6 +464,7 @@ public class StartConversationActivity extends XmppActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void onBackendConnected() {
|
void onBackendConnected() {
|
||||||
|
xmppConnectionService.setOnRosterUpdateListener(this.onRosterUpdate );
|
||||||
if (mSearchEditText != null) {
|
if (mSearchEditText != null) {
|
||||||
filter(mSearchEditText.getText().toString());
|
filter(mSearchEditText.getText().toString());
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue