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:
committed by
plingurar@mozilla.com
parent
998d23730d
commit
4eb4001853
@@ -43,6 +43,7 @@ fun ActionContainer(
|
|||||||
contentDescription = action.contentDescription,
|
contentDescription = action.contentDescription,
|
||||||
tint = action.tint,
|
tint = action.tint,
|
||||||
onClick = action.onClick,
|
onClick = action.onClick,
|
||||||
|
highlighted = action.highlighted,
|
||||||
onLongClick = action.onLongClick,
|
onLongClick = action.onLongClick,
|
||||||
onInteraction = { onInteraction(it) },
|
onInteraction = { onInteraction(it) },
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ sealed class Action {
|
|||||||
* @property icon The icon resource to be displayed for the action button.
|
* @property icon The icon resource to be displayed for the action button.
|
||||||
* @property contentDescription The content description for the action button.
|
* @property contentDescription The content description for the action button.
|
||||||
* @property tint The color resource used to tint the icon.
|
* @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 onClick [BrowserToolbarInteraction] describing how to handle this button being clicked.
|
||||||
* @property onLongClick Optional [BrowserToolbarInteraction] describing how to handle this button
|
* @property onLongClick Optional [BrowserToolbarInteraction] describing how to handle this button
|
||||||
* being long clicked.
|
* being long clicked.
|
||||||
@@ -32,6 +33,7 @@ sealed class Action {
|
|||||||
@DrawableRes val icon: Int,
|
@DrawableRes val icon: Int,
|
||||||
@StringRes val contentDescription: Int,
|
@StringRes val contentDescription: Int,
|
||||||
@ColorInt val tint: Int,
|
@ColorInt val tint: Int,
|
||||||
|
val highlighted: Boolean = false,
|
||||||
val onClick: BrowserToolbarInteraction,
|
val onClick: BrowserToolbarInteraction,
|
||||||
val onLongClick: BrowserToolbarInteraction? = null,
|
val onLongClick: BrowserToolbarInteraction? = null,
|
||||||
) : Action()
|
) : Action()
|
||||||
|
|||||||
@@ -43,9 +43,9 @@ import mozilla.components.ui.icons.R
|
|||||||
* @param icon Drawable resource for this button.
|
* @param icon Drawable resource for this button.
|
||||||
* @param tint Color resource used to tint [icon].
|
* @param tint Color resource used to tint [icon].
|
||||||
* @param contentDescription Text used by accessibility services to describe what this button does.
|
* @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 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.
|
* @param onInteraction Callback for handling [BrowserToolbarEvent]s on user interactions.
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
@@ -54,9 +54,9 @@ fun ActionButton(
|
|||||||
@DrawableRes icon: Int,
|
@DrawableRes icon: Int,
|
||||||
@ColorInt tint: Int,
|
@ColorInt tint: Int,
|
||||||
@StringRes contentDescription: Int,
|
@StringRes contentDescription: Int,
|
||||||
|
highlighted: Boolean = false,
|
||||||
onClick: BrowserToolbarInteraction,
|
onClick: BrowserToolbarInteraction,
|
||||||
onLongClick: BrowserToolbarInteraction? = null,
|
onLongClick: BrowserToolbarInteraction? = null,
|
||||||
highlighted: Boolean = false,
|
|
||||||
onInteraction: (BrowserToolbarEvent) -> Unit,
|
onInteraction: (BrowserToolbarEvent) -> Unit,
|
||||||
) {
|
) {
|
||||||
val onClickMenu = key(onClick) { onClick.buildMenu(onInteraction) }
|
val onClickMenu = key(onClick) { onClick.buildMenu(onInteraction) }
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ internal class BrowserToolbarMiddleware(
|
|||||||
dependencies.context,
|
dependencies.context,
|
||||||
R.color.generic_button_tint,
|
R.color.generic_button_tint,
|
||||||
),
|
),
|
||||||
|
highlighted = true,
|
||||||
onClick = SecurityIndicatorClicked,
|
onClick = SecurityIndicatorClicked,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user