* For #7352: integrate highlightable browser menu changes * For 7352: invalidate menu when reader mode availability changes * For 7352: removed highlight from reader mode appearance per UXmaster
parent
e22d092f5d
commit
26b7909214
|
@ -14,6 +14,7 @@ import mozilla.components.browser.menu.BrowserMenuBuilder
|
|||
import mozilla.components.browser.menu.BrowserMenuHighlight
|
||||
import mozilla.components.browser.menu.item.BrowserMenuDivider
|
||||
import mozilla.components.browser.menu.item.BrowserMenuHighlightableItem
|
||||
import mozilla.components.browser.menu.item.BrowserMenuHighlightableSwitch
|
||||
import mozilla.components.browser.menu.item.BrowserMenuImageSwitch
|
||||
import mozilla.components.browser.menu.item.BrowserMenuImageText
|
||||
import mozilla.components.browser.menu.item.BrowserMenuItemToolbar
|
||||
|
@ -277,10 +278,15 @@ class DefaultToolbarMenu(
|
|||
onItemTapped.invoke(ToolbarMenu.Item.Quit)
|
||||
}
|
||||
|
||||
private val readerMode = BrowserMenuImageSwitch(
|
||||
private val readerMode = BrowserMenuHighlightableSwitch(
|
||||
label = context.getString(R.string.browser_menu_read),
|
||||
imageResource = R.drawable.ic_readermode,
|
||||
initialState = readerModeStateProvider
|
||||
startImageResource = R.drawable.ic_readermode,
|
||||
initialState = readerModeStateProvider,
|
||||
highlight = BrowserMenuHighlight.LowPriority(
|
||||
label = context.getString(R.string.browser_menu_read),
|
||||
notificationTint = getColor(context, R.color.whats_new_notification_color)
|
||||
),
|
||||
isHighlighted = { true }
|
||||
) { checked ->
|
||||
onItemTapped.invoke(ToolbarMenu.Item.ReaderMode(checked))
|
||||
}
|
||||
|
@ -293,10 +299,15 @@ class DefaultToolbarMenu(
|
|||
onItemTapped.invoke(ToolbarMenu.Item.ReaderModeAppearance)
|
||||
}
|
||||
|
||||
private val openInApp = BrowserMenuImageText(
|
||||
private val openInApp = BrowserMenuHighlightableItem(
|
||||
label = context.getString(R.string.browser_menu_open_app_link),
|
||||
imageResource = R.drawable.ic_app_links,
|
||||
iconTintColorResource = primaryTextColor()
|
||||
startImageResource = R.drawable.ic_app_links,
|
||||
iconTintColorResource = primaryTextColor(),
|
||||
highlight = BrowserMenuHighlight.LowPriority(
|
||||
label = context.getString(R.string.browser_menu_open_app_link),
|
||||
notificationTint = getColor(context, R.color.whats_new_notification_color)
|
||||
),
|
||||
isHighlighted = { true }
|
||||
) {
|
||||
onItemTapped.invoke(ToolbarMenu.Item.OpenInApp)
|
||||
}
|
||||
|
|
|
@ -34,4 +34,8 @@ class MenuPresenter(
|
|||
override fun onWebAppManifestChanged(session: Session, manifest: WebAppManifest?) {
|
||||
menuToolbar.invalidateActions()
|
||||
}
|
||||
|
||||
override fun onReaderableStateUpdated(session: Session, readerable: Boolean) {
|
||||
menuToolbar.invalidateActions()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue