finally fixed #notificationgate

This commit is contained in:
Daniel Gultsch 2014-03-29 20:29:03 +01:00
parent 38efb84690
commit e8290d52b1
3 changed files with 8 additions and 9 deletions

View File

@ -85,6 +85,7 @@ public class XmppConnectionService extends Service {
private List<Conversation> conversations = null;
public OnConversationListChangedListener convChangedListener = null;
private int convChangedListenerCount = 0;
private OnAccountListChangedListener accountChangedListener = null;
private OnTLSExceptionReceived tlsException = null;
@ -1009,10 +1010,16 @@ public class XmppConnectionService extends Service {
public void setOnConversationListChangedListener(
OnConversationListChangedListener listener) {
this.convChangedListener = listener;
this.convChangedListenerCount++;
Log.d(LOGTAG,"registered on conv changed in backend ("+convChangedListenerCount+")");
}
public void removeOnConversationListChangedListener() {
this.convChangedListener = null;
this.convChangedListenerCount--;
Log.d(LOGTAG,"someone on conv changed listener removed listener ("+convChangedListenerCount+")");
if (this.convChangedListenerCount==0) {
this.convChangedListener = null;
}
}
public void setOnAccountListChangedListener(

View File

@ -417,7 +417,6 @@ public class ConversationActivity extends XmppActivity {
@Override
void onBackendConnected() {
this.registerListener();
if (conversationList.size()==0) {
updateConversationList();

View File

@ -333,15 +333,8 @@ public class ConversationFragment extends Fragment {
this.onBackendConnected();
}
}
@Override
public void onResume() {
super.onResume();
activity.registerListener();
}
public void onBackendConnected() {
activity.registerListener();
this.conversation = activity.getSelectedConversation();
if (this.conversation == null) {
return;