[fenix] For 4780: ThemeManager now sends an intent before recreating

Updating themes recreates the activity, so if we aren't persisting 'usePrivateMode', we need to pass it to the new instance
pull/600/head
Severin Rudie 5 years ago committed by Emily Kager
parent 17e9a4e5c9
commit 691c47d576

@ -6,6 +6,7 @@ package org.mozilla.fenix.theme
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.content.res.Configuration
import android.graphics.Color
import android.os.Build
@ -14,6 +15,8 @@ import android.util.TypedValue
import android.view.View
import android.view.Window
import androidx.annotation.StyleRes
import mozilla.components.support.utils.toSafeIntent
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
import org.mozilla.fenix.ext.getColorFromAttr
@ -111,6 +114,10 @@ class DefaultThemeManager(
field = value
setActivityTheme(activity)
val intent = activity.intent ?: Intent().also { activity.intent = it }
intent.putExtra(HomeActivity.PRIVATE_BROWSING_MODE, value == BrowsingMode.Private)
activity.recreate()
}
}

Loading…
Cancel
Save