mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/7352: integrate highlightable browser menu changes (https://github.com/mozilla-mobile/fenix/pull/7353)
* For https://github.com/mozilla-mobile/fenix/issues/7352: integrate highlightable browser menu changes * For 7352: invalidate menu when reader mode availability changes * For 7352: removed highlight from reader mode appearance per UX
This commit is contained in:
parent
78a599b06e
commit
691676a27b
@ -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
Block a user