|
|
|
@ -11,6 +11,7 @@ import android.graphics.drawable.ColorDrawable
|
|
|
|
|
import android.view.View
|
|
|
|
|
import android.view.ViewGroup
|
|
|
|
|
import androidx.annotation.VisibleForTesting
|
|
|
|
|
import androidx.core.graphics.drawable.toDrawable
|
|
|
|
|
import androidx.navigation.NavController
|
|
|
|
|
import androidx.navigation.NavDirections
|
|
|
|
|
import androidx.navigation.NavOptions
|
|
|
|
@ -184,14 +185,18 @@ class DefaultBrowserToolbarController(
|
|
|
|
|
val directions = BrowserFragmentDirections.actionBrowserFragmentToSearchFragment(
|
|
|
|
|
sessionId = null
|
|
|
|
|
)
|
|
|
|
|
adjustBackgroundAndNavigate.invoke(directions)
|
|
|
|
|
|
|
|
|
|
// Do not adjustBackground here or an exception gets thrown as we switch themes
|
|
|
|
|
navController.nav(R.id.browserFragment, directions)
|
|
|
|
|
browsingModeManager.mode = BrowsingMode.Normal
|
|
|
|
|
}
|
|
|
|
|
ToolbarMenu.Item.NewPrivateTab -> {
|
|
|
|
|
val directions = BrowserFragmentDirections.actionBrowserFragmentToSearchFragment(
|
|
|
|
|
sessionId = null
|
|
|
|
|
)
|
|
|
|
|
adjustBackgroundAndNavigate.invoke(directions)
|
|
|
|
|
|
|
|
|
|
// Do not adjustBackground here or an exception gets thrown as we switch themes
|
|
|
|
|
navController.nav(R.id.browserFragment, directions)
|
|
|
|
|
browsingModeManager.mode = BrowsingMode.Private
|
|
|
|
|
}
|
|
|
|
|
ToolbarMenu.Item.FindInPage -> {
|
|
|
|
@ -299,16 +304,22 @@ class DefaultBrowserToolbarController(
|
|
|
|
|
browserLayout,
|
|
|
|
|
"${TAB_ITEM_TRANSITION_NAME}${currentSession?.id}"
|
|
|
|
|
).build()
|
|
|
|
|
swipeRefresh.background = ColorDrawable(Color.TRANSPARENT)
|
|
|
|
|
engineView.asView().visibility = View.GONE
|
|
|
|
|
if (!navController.popBackStack(R.id.homeFragment, false)) {
|
|
|
|
|
navController.nav(
|
|
|
|
|
R.id.browserFragment,
|
|
|
|
|
R.id.action_browserFragment_to_homeFragment,
|
|
|
|
|
null,
|
|
|
|
|
options,
|
|
|
|
|
extras
|
|
|
|
|
)
|
|
|
|
|
engineView.captureThumbnail { bitmap ->
|
|
|
|
|
scope.launch {
|
|
|
|
|
// If the bitmap is null, the best we can do to reduce the flash is set transparent
|
|
|
|
|
swipeRefresh.background = bitmap?.toDrawable(activity.resources)
|
|
|
|
|
?: ColorDrawable(Color.TRANSPARENT)
|
|
|
|
|
engineView.asView().visibility = View.GONE
|
|
|
|
|
if (!navController.popBackStack(R.id.homeFragment, false)) {
|
|
|
|
|
navController.nav(
|
|
|
|
|
R.id.browserFragment,
|
|
|
|
|
R.id.action_browserFragment_to_homeFragment,
|
|
|
|
|
null,
|
|
|
|
|
options,
|
|
|
|
|
extras
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|