|
|
@ -17,6 +17,8 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout
|
|
|
|
import androidx.core.content.ContextCompat
|
|
|
|
import androidx.core.content.ContextCompat
|
|
|
|
import androidx.fragment.app.Fragment
|
|
|
|
import androidx.fragment.app.Fragment
|
|
|
|
import androidx.navigation.Navigation
|
|
|
|
import androidx.navigation.Navigation
|
|
|
|
|
|
|
|
import com.google.android.material.snackbar.Snackbar
|
|
|
|
|
|
|
|
import kotlinx.android.synthetic.main.component_search.*
|
|
|
|
import kotlinx.android.synthetic.main.fragment_browser.view.*
|
|
|
|
import kotlinx.android.synthetic.main.fragment_browser.view.*
|
|
|
|
import mozilla.components.browser.toolbar.behavior.BrowserToolbarBottomBehavior
|
|
|
|
import mozilla.components.browser.toolbar.behavior.BrowserToolbarBottomBehavior
|
|
|
|
import mozilla.components.feature.contextmenu.ContextMenuCandidate
|
|
|
|
import mozilla.components.feature.contextmenu.ContextMenuCandidate
|
|
|
@ -24,11 +26,14 @@ import mozilla.components.feature.contextmenu.ContextMenuFeature
|
|
|
|
import mozilla.components.feature.customtabs.CustomTabsToolbarFeature
|
|
|
|
import mozilla.components.feature.customtabs.CustomTabsToolbarFeature
|
|
|
|
import mozilla.components.feature.downloads.DownloadsFeature
|
|
|
|
import mozilla.components.feature.downloads.DownloadsFeature
|
|
|
|
import mozilla.components.feature.prompts.PromptFeature
|
|
|
|
import mozilla.components.feature.prompts.PromptFeature
|
|
|
|
|
|
|
|
import mozilla.components.feature.session.FullScreenFeature
|
|
|
|
import mozilla.components.feature.session.SessionFeature
|
|
|
|
import mozilla.components.feature.session.SessionFeature
|
|
|
|
import mozilla.components.feature.session.SessionUseCases
|
|
|
|
import mozilla.components.feature.session.SessionUseCases
|
|
|
|
import mozilla.components.feature.sitepermissions.SitePermissionsFeature
|
|
|
|
import mozilla.components.feature.sitepermissions.SitePermissionsFeature
|
|
|
|
import mozilla.components.support.base.feature.BackHandler
|
|
|
|
import mozilla.components.support.base.feature.BackHandler
|
|
|
|
import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
|
|
|
|
import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
|
|
|
|
|
|
|
|
import mozilla.components.support.ktx.android.view.enterToImmersiveMode
|
|
|
|
|
|
|
|
import mozilla.components.support.ktx.android.view.exitImmersiveModeIfNeeded
|
|
|
|
import org.mozilla.fenix.BrowsingModeManager
|
|
|
|
import org.mozilla.fenix.BrowsingModeManager
|
|
|
|
import org.mozilla.fenix.DefaultThemeManager
|
|
|
|
import org.mozilla.fenix.DefaultThemeManager
|
|
|
|
import org.mozilla.fenix.HomeActivity
|
|
|
|
import org.mozilla.fenix.HomeActivity
|
|
|
@ -56,6 +61,7 @@ class BrowserFragment : Fragment(), BackHandler {
|
|
|
|
private val customTabsToolbarFeature = ViewBoundFeatureWrapper<CustomTabsToolbarFeature>()
|
|
|
|
private val customTabsToolbarFeature = ViewBoundFeatureWrapper<CustomTabsToolbarFeature>()
|
|
|
|
private val toolbarIntegration = ViewBoundFeatureWrapper<ToolbarIntegration>()
|
|
|
|
private val toolbarIntegration = ViewBoundFeatureWrapper<ToolbarIntegration>()
|
|
|
|
private val sitePermissionsFeature = ViewBoundFeatureWrapper<SitePermissionsFeature>()
|
|
|
|
private val sitePermissionsFeature = ViewBoundFeatureWrapper<SitePermissionsFeature>()
|
|
|
|
|
|
|
|
private val fullScreenFeature = ViewBoundFeatureWrapper<FullScreenFeature>()
|
|
|
|
var sessionId: String? = null
|
|
|
|
var sessionId: String? = null
|
|
|
|
|
|
|
|
|
|
|
|
override fun onCreateView(
|
|
|
|
override fun onCreateView(
|
|
|
@ -178,6 +184,26 @@ class BrowserFragment : Fragment(), BackHandler {
|
|
|
|
owner = this,
|
|
|
|
owner = this,
|
|
|
|
view = view
|
|
|
|
view = view
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fullScreenFeature.set(
|
|
|
|
|
|
|
|
feature = FullScreenFeature(
|
|
|
|
|
|
|
|
sessionManager,
|
|
|
|
|
|
|
|
SessionUseCases(sessionManager),
|
|
|
|
|
|
|
|
sessionId
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
if (it) {
|
|
|
|
|
|
|
|
Snackbar.make(view.rootView, getString(R.string.full_screen_notification), Snackbar.LENGTH_LONG)
|
|
|
|
|
|
|
|
.show()
|
|
|
|
|
|
|
|
activity?.enterToImmersiveMode()
|
|
|
|
|
|
|
|
toolbar.visibility = View.GONE
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
activity?.exitImmersiveModeIfNeeded()
|
|
|
|
|
|
|
|
toolbar.visibility = View.VISIBLE
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
owner = this,
|
|
|
|
|
|
|
|
view = view
|
|
|
|
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
override fun onResume() {
|
|
|
|
override fun onResume() {
|
|
|
|