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

This commit is contained in:
Daniel Gultsch 2014-03-28 12:22:09 +01:00
parent 9fa95f50ae
commit 0b235171a8
3 changed files with 15 additions and 4 deletions

View file

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

View file

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

View file

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