1
0
Fork 0
fenix/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayDialogFragment.kt

58 lines
2.0 KiB
Kotlin
Raw Normal View History

/* 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
import androidx.appcompat.app.AppCompatDialogFragment
2020-05-21 05:20:29 +02:00
import androidx.core.view.updatePadding
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.*
import mozilla.components.concept.tabstray.Tab
2020-05-21 05:20:29 +02:00
import org.mozilla.fenix.R
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 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)
tabTrayView = TabTrayView(view.tabLayout, this)
tabLayout.setOnClickListener { dismissAllowingStateLoss() }
view.tabLayout.setOnApplyWindowInsetsListener { v, insets ->
v.updatePadding(
left = insets.systemWindowInsetLeft,
right = insets.systemWindowInsetRight
)
insets
}
}
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
}
}