tryping to fix #24 - notificationgate - since i still cant reproduce this patches are all blind

Daniel Gultsch created

Change summary

src/eu/siacs/conversations/ui/ConversationActivity.java |  6 ++++--
src/eu/siacs/conversations/ui/ConversationFragment.java | 10 ++++++++--
src/eu/siacs/conversations/ui/XmppActivity.java         |  3 +++
3 files changed, 15 insertions(+), 4 deletions(-)

Detailed changes

src/eu/siacs/conversations/ui/ConversationActivity.java 🔗

@@ -394,11 +394,14 @@ public class ConversationActivity extends XmppActivity {
 		return super.onKeyDown(keyCode, event);
 	}
 	
+	@Override
 	public void onStart() {
 		super.onStart();
-		this.registerListener();
 		SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
 		this.useSubject = preferences.getBoolean("use_subject_in_muc", true);
+		if (this.xmppConnectionServiceBound) {
+			this.onBackendConnected();
+		}
 		if (conversationList.size()>=1) {
 			onConvChanged.onConversationListChanged();
 		}
@@ -406,7 +409,6 @@ public class ConversationActivity extends XmppActivity {
 	
 	@Override
 	protected void onStop() {
-		Log.d("gultsch","called on stop in conversation activity");
 		if (xmppConnectionServiceBound) {
         	xmppConnectionService.removeOnConversationListChangedListener();
 		}

src/eu/siacs/conversations/ui/ConversationFragment.java 🔗

@@ -115,6 +115,7 @@ public class ConversationFragment extends Fragment {
 			startActivity(intent);
 		}
 	};
+	private ConversationActivity activity;
 
 	public void hidePgpPassphraseBox() {
 		pgpInfo.setVisibility(View.GONE);
@@ -325,16 +326,21 @@ public class ConversationFragment extends Fragment {
 	@Override
 	public void onStart() {
 		super.onStart();
-		ConversationActivity activity = (ConversationActivity) getActivity();
+		this.activity = (ConversationActivity) getActivity();
 		SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
 		this.useSubject = preferences.getBoolean("use_subject_in_muc", true);
 		if (activity.xmppConnectionServiceBound) {
 			this.onBackendConnected();
 		}
 	}
+	
+	@Override
+	public void onResume() {
+		super.onResume();
+		activity.registerListener();
+	}
 
 	public void onBackendConnected() {
-		final ConversationActivity activity = (ConversationActivity) getActivity();
 		activity.registerListener();
 		this.conversation = activity.getSelectedConversation();
 		if (this.conversation == null) {

src/eu/siacs/conversations/ui/XmppActivity.java 🔗

@@ -19,6 +19,9 @@ import android.view.View;
 import android.view.inputmethod.InputMethodManager;
 
 public abstract class XmppActivity extends Activity {
+	
+	protected final static String LOGTAG = "xmppService";
+	
 	public XmppConnectionService xmppConnectionService;
 	public boolean xmppConnectionServiceBound = false;
 	protected boolean handledViewIntent = false;