2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00
* 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:
Severin Rudie 2019-12-27 12:15:21 -08:00 committed by GitHub
parent 78a599b06e
commit 691676a27b
2 changed files with 21 additions and 6 deletions

View File

@ -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)
}

View File

@ -34,4 +34,8 @@ class MenuPresenter(
override fun onWebAppManifestChanged(session: Session, manifest: WebAppManifest?) {
menuToolbar.invalidateActions()
}
override fun onReaderableStateUpdated(session: Session, readerable: Boolean) {
menuToolbar.invalidateActions()
}
}