another possible fix for notificationgate

This commit is contained in:
Daniel Gultsch 2014-03-10 21:52:58 +01:00
parent baf0d64787
commit a5de5060a9
2 changed files with 11 additions and 11 deletions

View File

@ -407,9 +407,8 @@ public class ConversationActivity extends XmppActivity {
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
if (xmppConnectionServiceBound) { this.registerListener();
xmppConnectionService.setOnConversationListChangedListener(this.onConvChanged); xmppConnectionService.setOnConversationListChangedListener(this.onConvChanged);
}
if (conversationList.size()>=1) { if (conversationList.size()>=1) {
onConvChanged.onConversationListChanged(); onConvChanged.onConversationListChanged();
} }
@ -427,8 +426,7 @@ public class ConversationActivity extends XmppActivity {
@Override @Override
void onBackendConnected() { void onBackendConnected() {
xmppConnectionService.setOnConversationListChangedListener(this.onConvChanged); this.registerListener();
if (conversationList.size()==0) { if (conversationList.size()==0) {
conversationList.addAll(xmppConnectionService conversationList.addAll(xmppConnectionService
.getConversations()); .getConversations());
@ -472,6 +470,12 @@ public class ConversationActivity extends XmppActivity {
} }
} }
} }
public void registerListener() {
if (xmppConnectionServiceBound) {
xmppConnectionService.setOnConversationListChangedListener(this.onConvChanged);
}
}
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) { protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);

View File

@ -13,7 +13,6 @@ import net.java.otr4j.session.SessionStatus;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.PgpEngine.OpenPgpException; import eu.siacs.conversations.crypto.PgpEngine.OpenPgpException;
import eu.siacs.conversations.crypto.PgpEngine.UserInputRequiredException; import eu.siacs.conversations.crypto.PgpEngine.UserInputRequiredException;
import eu.siacs.conversations.entities.Account;
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.Message; import eu.siacs.conversations.entities.Message;
@ -24,8 +23,6 @@ import eu.siacs.conversations.utils.PhoneHelper;
import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.UIHelper;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Fragment; import android.app.Fragment;
import android.app.NotificationManager;
import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.IntentSender; import android.content.IntentSender;
@ -40,10 +37,8 @@ import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.EditText; import android.widget.EditText;
@ -335,6 +330,7 @@ public class ConversationFragment extends Fragment {
public void onBackendConnected() { public void onBackendConnected() {
final ConversationActivity activity = (ConversationActivity) getActivity(); final ConversationActivity activity = (ConversationActivity) getActivity();
activity.registerListener();
this.conversation = activity.getSelectedConversation(); this.conversation = activity.getSelectedConversation();
this.selfBitmap = findSelfPicture(); this.selfBitmap = findSelfPicture();
updateMessages(); updateMessages();