|
|
@ -6,6 +6,7 @@ package org.mozilla.fenix
|
|
|
|
|
|
|
|
|
|
|
|
import android.app.Activity
|
|
|
|
import android.app.Activity
|
|
|
|
import android.content.Context
|
|
|
|
import android.content.Context
|
|
|
|
|
|
|
|
import android.content.Intent
|
|
|
|
import android.os.Bundle
|
|
|
|
import android.os.Bundle
|
|
|
|
import android.util.AttributeSet
|
|
|
|
import android.util.AttributeSet
|
|
|
|
import android.view.View
|
|
|
|
import android.view.View
|
|
|
@ -24,6 +25,7 @@ import mozilla.components.support.ktx.kotlin.toNormalizedUrl
|
|
|
|
import mozilla.components.support.utils.SafeIntent
|
|
|
|
import mozilla.components.support.utils.SafeIntent
|
|
|
|
import org.mozilla.fenix.ext.components
|
|
|
|
import org.mozilla.fenix.ext.components
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("TooManyFunctions")
|
|
|
|
open class HomeActivity : AppCompatActivity() {
|
|
|
|
open class HomeActivity : AppCompatActivity() {
|
|
|
|
val themeManager = DefaultThemeManager().also {
|
|
|
|
val themeManager = DefaultThemeManager().also {
|
|
|
|
it.onThemeChange = { theme ->
|
|
|
|
it.onThemeChange = { theme ->
|
|
|
@ -51,9 +53,12 @@ open class HomeActivity : AppCompatActivity() {
|
|
|
|
setSupportActionBar(navigationToolbar)
|
|
|
|
setSupportActionBar(navigationToolbar)
|
|
|
|
NavigationUI.setupWithNavController(navigationToolbar, hostNavController, appBarConfiguration)
|
|
|
|
NavigationUI.setupWithNavController(navigationToolbar, hostNavController, appBarConfiguration)
|
|
|
|
|
|
|
|
|
|
|
|
if (intent?.extras?.getBoolean(OPEN_TO_BROWSER) == true) {
|
|
|
|
handleOpenedFromExternalSourceIfNecessary()
|
|
|
|
handleOpenedFromExternalSource()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onNewIntent(intent: Intent?) {
|
|
|
|
|
|
|
|
super.onNewIntent(intent)
|
|
|
|
|
|
|
|
handleOpenedFromExternalSourceIfNecessary()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
override fun onCreateView(
|
|
|
|
override fun onCreateView(
|
|
|
@ -90,6 +95,12 @@ open class HomeActivity : AppCompatActivity() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun handleOpenedFromExternalSourceIfNecessary() {
|
|
|
|
|
|
|
|
if (intent?.extras?.getBoolean(OPEN_TO_BROWSER) == true) {
|
|
|
|
|
|
|
|
handleOpenedFromExternalSource()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun handleOpenedFromExternalSource() {
|
|
|
|
private fun handleOpenedFromExternalSource() {
|
|
|
|
intent?.putExtra(OPEN_TO_BROWSER, false)
|
|
|
|
intent?.putExtra(OPEN_TO_BROWSER, false)
|
|
|
|
openToBrowser(SafeIntent(intent).getStringExtra(IntentProcessor.ACTIVE_SESSION_ID))
|
|
|
|
openToBrowser(SafeIntent(intent).getStringExtra(IntentProcessor.ACTIVE_SESSION_ID))
|
|
|
|