Commit 4e499e7a authored by Jeff Boek's avatar Jeff Boek
Browse files

For #10504 - Adds tabTrayDialogInteractor to browserfragment

parent cc6a380d
......@@ -64,6 +64,7 @@ import mozilla.components.support.base.feature.UserInteractionHandler
import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
import mozilla.components.support.ktx.android.view.exitImmersiveModeIfNeeded
import mozilla.components.support.ktx.android.view.hideKeyboard
import org.mozilla.fenix.BrowserDirection
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.IntentReceiverActivity
......@@ -213,6 +214,16 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
onTabCounterClicked = {
val tabTrayDialog = TabTrayDialogFragment()
tabTrayDialog.show(parentFragmentManager, null)
tabTrayDialog.interactor = object : TabTrayDialogFragment.Interactor {
override fun onTabSelected(tab: mozilla.components.concept.tabstray.Tab) {
tabTrayDialog.dismiss()
}
override fun onNewTabTapped() {
tabTrayDialog.dismiss()
findNavController().navigate(BrowserFragmentDirections.actionGlobalHome())
}
}
}
)
......
......@@ -360,6 +360,16 @@ class HomeFragment : Fragment() {
hideOnboardingIfNeeded()
val tabTrayDialog = TabTrayDialogFragment()
tabTrayDialog.show(parentFragmentManager, null)
tabTrayDialog.interactor = object : TabTrayDialogFragment.Interactor {
override fun onTabSelected(tab: mozilla.components.concept.tabstray.Tab) {
tabTrayDialog.dismiss()
(activity as HomeActivity).openToBrowser(BrowserDirection.FromHome)
}
override fun onNewTabTapped() {
tabTrayDialog.dismiss()
}
}
}
PrivateBrowsingButtonView(
......
......@@ -17,7 +17,13 @@ import mozilla.components.concept.tabstray.Tab
import org.mozilla.fenix.R
class TabTrayDialogFragment : AppCompatDialogFragment(), TabTrayInteractor {
interface Interactor {
fun onTabSelected(tab: Tab)
fun onNewTabTapped()
}
private lateinit var tabTrayView: TabTrayView
var interactor: Interactor? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
......@@ -52,11 +58,11 @@ class TabTrayDialogFragment : AppCompatDialogFragment(), TabTrayInteractor {
}
override fun onTabSelected(tab: Tab) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
interactor?.onTabSelected(tab)
}
override fun onNewTabTapped(private: Boolean) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
interactor?.onNewTabTapped()
}
override fun onTabTrayDismissed() {
......
......@@ -109,7 +109,6 @@ class TabTrayFragment : Fragment(R.layout.fragment_tab_tray), TabsTray.Observer,
override fun onResume() {
super.onResume()
onTabsChanged()
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment