2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-17 15:26:23 +00:00
This commit is contained in:
Jeff Boek 2020-06-23 08:50:20 -07:00 committed by GitHub
parent 497d842a06
commit 790c291d0d
2 changed files with 11 additions and 5 deletions

View File

@ -94,6 +94,7 @@ class TabTrayDialogFragment : AppCompatDialogFragment() {
tabTrayView.setTopOffset(isLandscape) tabTrayView.setTopOffset(isLandscape)
if (isLandscape) { if (isLandscape) {
tabTrayView.dismissMenu()
tabTrayView.expand() tabTrayView.expand()
} }
} }

View File

@ -21,6 +21,7 @@ import kotlinx.android.synthetic.main.component_tabstray_fab.view.*
import kotlinx.coroutines.Dispatchers.Main import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import mozilla.components.browser.menu.BrowserMenu
import mozilla.components.browser.menu.BrowserMenuBuilder import mozilla.components.browser.menu.BrowserMenuBuilder
import mozilla.components.browser.menu.item.SimpleBrowserMenuItem import mozilla.components.browser.menu.item.SimpleBrowserMenuItem
import mozilla.components.browser.state.selector.normalTabs import mozilla.components.browser.state.selector.normalTabs
@ -54,7 +55,8 @@ class TabTrayView(
private val behavior = BottomSheetBehavior.from(view.tab_wrapper) private val behavior = BottomSheetBehavior.from(view.tab_wrapper)
private var tabTrayItemMenu: TabTrayItemMenu private val tabTrayItemMenu: TabTrayItemMenu
private var menu: BrowserMenu? = null
private var hasLoaded = false private var hasLoaded = false
@ -149,10 +151,9 @@ class TabTrayView(
} }
view.tab_tray_overflow.setOnClickListener { view.tab_tray_overflow.setOnClickListener {
tabTrayItemMenu.menuBuilder menu = tabTrayItemMenu.menuBuilder.build(container.context)
.build(view.context) menu?.show(it)
.show(anchor = it) ?.also { pu ->
.also { pu ->
(pu.contentView as? CardView)?.setCardBackgroundColor(ContextCompat.getColor( (pu.contentView as? CardView)?.setCardBackgroundColor(ContextCompat.getColor(
view.context, view.context,
R.color.foundation_normal_theme R.color.foundation_normal_theme
@ -241,6 +242,10 @@ class TabTrayView(
behavior.setExpandedOffset(topOffset) behavior.setExpandedOffset(topOffset)
} }
fun dismissMenu() {
menu?.dismiss()
}
companion object { companion object {
private const val DEFAULT_TAB_ID = 0 private const val DEFAULT_TAB_ID = 0
private const val PRIVATE_TAB_ID = 1 private const val PRIVATE_TAB_ID = 1