diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index d7c2e4074..6be671e02 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -396,7 +396,8 @@ public class ConversationActivity extends XmppActivity implements OnConversation @Override public void onSaveInstanceState(Bundle savedInstanceState) { - savedInstanceState.putParcelable("intent", getIntent()); + Intent pendingIntent = pendingViewIntent.pop(); + savedInstanceState.putParcelable("intent", pendingIntent == null ? pendingIntent : getIntent()); super.onSaveInstanceState(savedInstanceState); } @@ -404,7 +405,10 @@ public class ConversationActivity extends XmppActivity implements OnConversation protected void onStart() { final int theme = findTheme(); if (this.mTheme != theme) { + this.mSkipBackgroundBinding = true; recreate(); + } else { + this.mSkipBackgroundBinding = false; } mRedirectInProcess.set(false); super.onStart(); diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index 997df6422..d03a449e3 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -40,6 +40,7 @@ import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.text.InputType; import android.util.DisplayMetrics; +import android.util.Log; import android.view.MenuItem; import android.view.View; import android.view.inputmethod.InputMethodManager; @@ -145,6 +146,7 @@ public abstract class XmppActivity extends AppCompatActivity { } }; + public boolean mSkipBackgroundBinding = false; public static boolean cancelPotentialWork(Message message, ImageView imageView) { final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView); @@ -205,7 +207,11 @@ public abstract class XmppActivity extends AppCompatActivity { protected void onStart() { super.onStart(); if (!xmppConnectionServiceBound) { - connectToBackend(); + if (this.mSkipBackgroundBinding) { + Log.d(Config.LOGTAG,"skipping background binding"); + } else { + connectToBackend(); + } } else { if (!registeredListeners) { this.registerListeners();