Bug 1948677 - part 2 - Allow integrators to configure highlighting toolbar buttons r=android-reviewers,tchoh

Differential Revision: https://phabricator.services.mozilla.com/D245757
This commit is contained in:
Mugurell
2025-05-07 15:34:13 +00:00
committed by plingurar@mozilla.com
parent 998d23730d
commit 4eb4001853
4 changed files with 7 additions and 3 deletions

View File

@@ -43,6 +43,7 @@ fun ActionContainer(
contentDescription = action.contentDescription,
tint = action.tint,
onClick = action.onClick,
highlighted = action.highlighted,
onLongClick = action.onLongClick,
onInteraction = { onInteraction(it) },
)

View File

@@ -24,6 +24,7 @@ sealed class Action {
* @property icon The icon resource to be displayed for the action button.
* @property contentDescription The content description for the action button.
* @property tint The color resource used to tint the icon.
* @property highlighted Whether or not to highlight this button.
* @property onClick [BrowserToolbarInteraction] describing how to handle this button being clicked.
* @property onLongClick Optional [BrowserToolbarInteraction] describing how to handle this button
* being long clicked.
@@ -32,6 +33,7 @@ sealed class Action {
@DrawableRes val icon: Int,
@StringRes val contentDescription: Int,
@ColorInt val tint: Int,
val highlighted: Boolean = false,
val onClick: BrowserToolbarInteraction,
val onLongClick: BrowserToolbarInteraction? = null,
) : Action()

View File

@@ -43,9 +43,9 @@ import mozilla.components.ui.icons.R
* @param icon Drawable resource for this button.
* @param tint Color resource used to tint [icon].
* @param contentDescription Text used by accessibility services to describe what this button does.
* @property onClick [BrowserToolbarInteraction] describing how to handle this button being clicked.
* @param onLongClick Optional [BrowserToolbarInteraction] describing how to handle this button being long clicked.
* @param highlighted Whether or not to highlight this button.
* @param onClick [BrowserToolbarInteraction] describing how to handle this button being clicked.
* @param onLongClick Optional [BrowserToolbarInteraction] describing how to handle this button being long clicked.
* @param onInteraction Callback for handling [BrowserToolbarEvent]s on user interactions.
*/
@Composable
@@ -54,9 +54,9 @@ fun ActionButton(
@DrawableRes icon: Int,
@ColorInt tint: Int,
@StringRes contentDescription: Int,
highlighted: Boolean = false,
onClick: BrowserToolbarInteraction,
onLongClick: BrowserToolbarInteraction? = null,
highlighted: Boolean = false,
onInteraction: (BrowserToolbarEvent) -> Unit,
) {
val onClickMenu = key(onClick) { onClick.buildMenu(onInteraction) }

View File

@@ -170,6 +170,7 @@ internal class BrowserToolbarMiddleware(
dependencies.context,
R.color.generic_button_tint,
),
highlighted = true,
onClick = SecurityIndicatorClicked,
),
)