From ebeb5f04ab10aeeda56597b29a757e657d71d218 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sat, 31 Mar 2018 22:28:44 +0200 Subject: skip background connect when changing theme --- src/main/java/de/pixart/messenger/ui/ConversationActivity.java | 6 +++++- src/main/java/de/pixart/messenger/ui/XmppActivity.java | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java index 52b993582..0934d967a 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java @@ -469,7 +469,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); } @@ -477,7 +478,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); final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index c6f9a70ca..d124b580b 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -162,6 +162,8 @@ public abstract class XmppActivity extends AppCompatActivity { } }; + public boolean mSkipBackgroundBinding = false; + public static boolean cancelPotentialWork(Message message, ImageView imageView) { final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView); @@ -221,7 +223,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(); -- cgit v1.2.3