2019-01-09 23:22: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.home
|
|
|
|
|
|
|
|
import android.os.Bundle
|
2019-01-15 02:42:58 +01:00
|
|
|
import android.transition.TransitionInflater
|
2019-01-09 23:22:58 +01:00
|
|
|
import android.view.LayoutInflater
|
|
|
|
import android.view.View
|
|
|
|
import android.view.ViewGroup
|
2019-01-15 02:42:58 +01:00
|
|
|
import androidx.core.view.ViewCompat
|
|
|
|
import androidx.fragment.app.Fragment
|
|
|
|
import androidx.navigation.Navigation
|
|
|
|
import androidx.navigation.fragment.FragmentNavigator
|
2019-01-10 01:07:33 +01:00
|
|
|
import kotlinx.android.synthetic.main.fragment_home.*
|
2019-01-09 23:22:58 +01:00
|
|
|
import org.mozilla.fenix.R
|
2019-01-28 17:46:39 +01:00
|
|
|
import org.mozilla.fenix.home.sessions.SessionsComponent
|
|
|
|
import org.mozilla.fenix.home.sessions.layoutComponents
|
|
|
|
import org.mozilla.fenix.mvi.ActionBusFactory
|
2019-01-09 23:22:58 +01:00
|
|
|
|
|
|
|
class HomeFragment : Fragment() {
|
|
|
|
override fun onCreateView(
|
|
|
|
inflater: LayoutInflater, container: ViewGroup?,
|
|
|
|
savedInstanceState: Bundle?
|
|
|
|
): View? {
|
|
|
|
return inflater.inflate(R.layout.fragment_home, container, false)
|
|
|
|
}
|
|
|
|
|
2019-01-10 01:07:33 +01:00
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
|
|
super.onViewCreated(view, savedInstanceState)
|
2019-01-11 18:44:22 +01:00
|
|
|
|
2019-01-25 17:11:43 +01:00
|
|
|
// Hide buttons that aren't used yet to prevent confusion
|
|
|
|
menuButton.visibility = View.GONE
|
|
|
|
privateBrowsingButton.visibility = View.GONE
|
|
|
|
|
2019-01-10 01:07:33 +01:00
|
|
|
toolbar_wrapper.clipToOutline = false
|
2019-01-15 02:42:58 +01:00
|
|
|
toolbar.setOnClickListener { it ->
|
|
|
|
val extras = FragmentNavigator.Extras.Builder().addSharedElement(
|
2019-01-23 01:12:20 +01:00
|
|
|
toolbar, ViewCompat.getTransitionName(toolbar)!!
|
2019-01-15 02:42:58 +01:00
|
|
|
).build()
|
2019-01-23 22:39:53 +01:00
|
|
|
Navigation.findNavController(it).navigate(R.id.action_homeFragment_to_searchFragment, null, null, extras)
|
2019-01-10 01:19:54 +01:00
|
|
|
}
|
2019-01-11 18:44:22 +01:00
|
|
|
|
2019-01-28 17:46:39 +01:00
|
|
|
SessionsComponent(homeLayout, ActionBusFactory.get(this)).setup()
|
|
|
|
layoutComponents(homeLayout)
|
2019-01-10 01:07:33 +01:00
|
|
|
}
|
|
|
|
|
2019-01-15 02:42:58 +01:00
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
|
super.onCreate(savedInstanceState)
|
|
|
|
enterTransition = TransitionInflater.from(context).inflateTransition(android.R.transition.fade)
|
|
|
|
exitTransition = TransitionInflater.from(context).inflateTransition(android.R.transition.fade)
|
2019-01-09 23:22:58 +01:00
|
|
|
}
|
|
|
|
}
|