2019-01-15 02:42:58 +01:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
package org.mozilla.fenix.browser
|
|
|
|
|
|
|
|
import android.os.Bundle
|
2019-01-19 00:33:40 +01:00
|
|
|
import android.transition.TransitionInflater
|
2019-01-15 02:42:58 +01:00
|
|
|
import android.view.LayoutInflater
|
|
|
|
import android.view.View
|
|
|
|
import android.view.ViewGroup
|
|
|
|
import androidx.fragment.app.Fragment
|
2019-01-19 00:33:40 +01:00
|
|
|
import kotlinx.android.synthetic.main.fragment_browser.*
|
|
|
|
import mozilla.components.feature.session.SessionFeature
|
|
|
|
import mozilla.components.feature.session.SessionUseCases
|
2019-01-23 17:13:05 +01:00
|
|
|
import mozilla.components.support.ktx.android.arch.lifecycle.addObservers
|
2019-01-15 02:42:58 +01:00
|
|
|
import org.mozilla.fenix.R
|
2019-01-23 23:48:15 +01:00
|
|
|
import org.mozilla.fenix.components.toolbar.ToolbarIntegration
|
2019-01-23 22:39:53 +01:00
|
|
|
import org.mozilla.fenix.ext.requireComponents
|
2019-01-15 02:42:58 +01:00
|
|
|
|
|
|
|
class BrowserFragment : Fragment() {
|
|
|
|
|
2019-01-19 00:33:40 +01:00
|
|
|
private lateinit var sessionFeature: SessionFeature
|
|
|
|
|
2019-01-15 02:42:58 +01:00
|
|
|
override fun onCreateView(
|
|
|
|
inflater: LayoutInflater, container: ViewGroup?,
|
|
|
|
savedInstanceState: Bundle?
|
|
|
|
): View? {
|
|
|
|
return inflater.inflate(R.layout.fragment_browser, container, false)
|
|
|
|
}
|
2019-01-19 00:33:40 +01:00
|
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
|
super.onCreate(savedInstanceState)
|
|
|
|
|
|
|
|
sharedElementEnterTransition = TransitionInflater.from(context).inflateTransition(android.R.transition.move)
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
|
|
super.onViewCreated(view, savedInstanceState)
|
|
|
|
|
2019-01-23 22:39:53 +01:00
|
|
|
val sessionManager = requireComponents.core.sessionManager
|
2019-01-19 00:33:40 +01:00
|
|
|
|
|
|
|
sessionFeature = SessionFeature(
|
|
|
|
sessionManager,
|
|
|
|
SessionUseCases(sessionManager),
|
2019-01-23 23:48:15 +01:00
|
|
|
engineView
|
|
|
|
)
|
|
|
|
|
|
|
|
lifecycle.addObserver(
|
|
|
|
ToolbarIntegration(
|
|
|
|
requireContext(),
|
|
|
|
toolbar,
|
|
|
|
requireComponents.toolbar.shippedDomainsProvider
|
|
|
|
)
|
|
|
|
)
|
2019-01-19 00:33:40 +01:00
|
|
|
|
|
|
|
lifecycle.addObservers(sessionFeature)
|
|
|
|
}
|
2019-01-15 02:42:58 +01:00
|
|
|
}
|