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
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();

View File

@ -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();