2020-05-21 04:57:47 +02: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.tabtray
|
|
|
|
|
2020-05-21 05:20:29 +02:00
|
|
|
import android.os.Bundle
|
|
|
|
import android.view.LayoutInflater
|
|
|
|
import android.view.View
|
|
|
|
import android.view.ViewGroup
|
2020-05-21 04:57:47 +02:00
|
|
|
import androidx.appcompat.app.AppCompatDialogFragment
|
2020-05-21 05:20:29 +02:00
|
|
|
import androidx.core.view.updatePadding
|
2020-05-21 05:47:07 +02:00
|
|
|
import kotlinx.android.synthetic.main.fragment_tab_tray_dialog.*
|
2020-05-21 05:20:29 +02:00
|
|
|
import kotlinx.android.synthetic.main.fragment_tab_tray_dialog.view.*
|
2020-05-21 05:47:07 +02:00
|
|
|
import mozilla.components.concept.tabstray.Tab
|
2020-05-21 05:20:29 +02:00
|
|
|
import org.mozilla.fenix.R
|
2020-05-21 04:57:47 +02:00
|
|
|
|
2020-05-21 05:47:07 +02:00
|
|
|
class TabTrayDialogFragment : AppCompatDialogFragment(), TabTrayInteractor {
|
|
|
|
private lateinit var tabTrayView: TabTrayView
|
|
|
|
|
2020-05-21 05:20:29 +02:00
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
|
super.onCreate(savedInstanceState)
|
|
|
|
setStyle(STYLE_NO_TITLE, R.style.TabTrayDialogStyle)
|
|
|
|
}
|
2020-05-21 04:57:47 +02:00
|
|
|
|
2020-05-21 05:20:29 +02:00
|
|
|
override fun onCreateView(
|
|
|
|
inflater: LayoutInflater,
|
|
|
|
container: ViewGroup?,
|
|
|
|
savedInstanceState: Bundle?
|
|
|
|
): View? = inflater.inflate(R.layout.fragment_tab_tray_dialog, container, false)
|
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
|
|
super.onViewCreated(view, savedInstanceState)
|
2020-05-21 05:47:07 +02:00
|
|
|
tabTrayView = TabTrayView(view.tabLayout, this)
|
|
|
|
|
|
|
|
tabLayout.setOnClickListener { dismissAllowingStateLoss() }
|
|
|
|
|
2020-05-21 05:48:57 +02:00
|
|
|
view.tabLayout.setOnApplyWindowInsetsListener { v, insets ->
|
|
|
|
v.updatePadding(
|
|
|
|
left = insets.systemWindowInsetLeft,
|
|
|
|
right = insets.systemWindowInsetRight
|
|
|
|
)
|
|
|
|
insets
|
|
|
|
}
|
2020-05-21 05:47:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
override fun onTabSelected(tab: Tab) {
|
|
|
|
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun onNewTabTapped(private: Boolean) {
|
|
|
|
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun onTabTrayDismissed() {
|
|
|
|
dismissAllowingStateLoss()
|
2020-05-21 05:20:29 +02:00
|
|
|
}
|
2020-05-21 04:57:47 +02:00
|
|
|
}
|