From a5de5060a92957b3f2ef6890e3784b5b684b886b Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 10 Mar 2014 21:52:58 +0100 Subject: another possible fix for notificationgate --- src/eu/siacs/conversations/ui/ConversationActivity.java | 16 ++++++++++------ src/eu/siacs/conversations/ui/ConversationFragment.java | 6 +----- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java index 02d78427..ced860da 100644 --- a/src/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/eu/siacs/conversations/ui/ConversationActivity.java @@ -407,9 +407,8 @@ public class ConversationActivity extends XmppActivity { public void onStart() { super.onStart(); - if (xmppConnectionServiceBound) { - xmppConnectionService.setOnConversationListChangedListener(this.onConvChanged); - } + this.registerListener(); + xmppConnectionService.setOnConversationListChangedListener(this.onConvChanged); if (conversationList.size()>=1) { onConvChanged.onConversationListChanged(); } @@ -427,8 +426,7 @@ public class ConversationActivity extends XmppActivity { @Override void onBackendConnected() { - xmppConnectionService.setOnConversationListChangedListener(this.onConvChanged); - + this.registerListener(); if (conversationList.size()==0) { conversationList.addAll(xmppConnectionService .getConversations()); @@ -472,7 +470,13 @@ public class ConversationActivity extends XmppActivity { } } } - @Override + public void registerListener() { + if (xmppConnectionServiceBound) { + xmppConnectionService.setOnConversationListChangedListener(this.onConvChanged); + } + } + + @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java index 2c84ffed..b49106f1 100644 --- a/src/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/eu/siacs/conversations/ui/ConversationFragment.java @@ -13,7 +13,6 @@ import net.java.otr4j.session.SessionStatus; import eu.siacs.conversations.R; import eu.siacs.conversations.crypto.PgpEngine.OpenPgpException; import eu.siacs.conversations.crypto.PgpEngine.UserInputRequiredException; -import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Message; @@ -24,8 +23,6 @@ import eu.siacs.conversations.utils.PhoneHelper; import eu.siacs.conversations.utils.UIHelper; import android.app.AlertDialog; import android.app.Fragment; -import android.app.NotificationManager; -import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentSender; @@ -40,10 +37,8 @@ import android.os.Bundle; import android.preference.PreferenceManager; import android.util.Log; import android.view.LayoutInflater; -import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; -import android.view.View.OnTouchListener; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.EditText; @@ -335,6 +330,7 @@ public class ConversationFragment extends Fragment { public void onBackendConnected() { final ConversationActivity activity = (ConversationActivity) getActivity(); + activity.registerListener(); this.conversation = activity.getSelectedConversation(); this.selfBitmap = findSelfPicture(); updateMessages(); -- cgit v1.2.3