skip background connect when changing theme

This commit is contained in:
Daniel Gultsch 2018-02-26 12:03:17 +01:00
parent fe8e131e3a
commit 9a76aff8f9
2 changed files with 12 additions and 2 deletions

View file

@ -396,7 +396,8 @@ public class ConversationActivity extends XmppActivity implements OnConversation
@Override @Override
public void onSaveInstanceState(Bundle savedInstanceState) { public void onSaveInstanceState(Bundle savedInstanceState) {
savedInstanceState.putParcelable("intent", getIntent()); Intent pendingIntent = pendingViewIntent.pop();
savedInstanceState.putParcelable("intent", pendingIntent == null ? pendingIntent : getIntent());
super.onSaveInstanceState(savedInstanceState); super.onSaveInstanceState(savedInstanceState);
} }
@ -404,7 +405,10 @@ public class ConversationActivity extends XmppActivity implements OnConversation
protected void onStart() { protected void onStart() {
final int theme = findTheme(); final int theme = findTheme();
if (this.mTheme != theme) { if (this.mTheme != theme) {
this.mSkipBackgroundBinding = true;
recreate(); recreate();
} else {
this.mSkipBackgroundBinding = false;
} }
mRedirectInProcess.set(false); mRedirectInProcess.set(false);
super.onStart(); super.onStart();

View file

@ -40,6 +40,7 @@ import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.text.InputType; import android.text.InputType;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.inputmethod.InputMethodManager; 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) { public static boolean cancelPotentialWork(Message message, ImageView imageView) {
final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView); final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
@ -205,7 +207,11 @@ public abstract class XmppActivity extends AppCompatActivity {
protected void onStart() { protected void onStart() {
super.onStart(); super.onStart();
if (!xmppConnectionServiceBound) { if (!xmppConnectionServiceBound) {
if (this.mSkipBackgroundBinding) {
Log.d(Config.LOGTAG,"skipping background binding");
} else {
connectToBackend(); connectToBackend();
}
} else { } else {
if (!registeredListeners) { if (!registeredListeners) {
this.registerListeners(); this.registerListeners();