Bug 1948633 - part 3 - Render pageOrigin from the state r=android-reviewers,android-l10n-reviewers,delphine,tchoh

Because of a Jetpack Compose bug which prevents properly anchoring
Dropdowns to the bottom of the screen in order to support showing
the long press menu from a bottom toolbar I had to use a View for
the origin instead of a Composable.

Implementation is to change after Google fixes the Compose bug.

Differential Revision: https://phabricator.services.mozilla.com/D245953
This commit is contained in:
Mugurell
2025-04-23 17:55:46 +00:00
parent aea8745dac
commit b7c528df3b
11 changed files with 527 additions and 35 deletions

View File

@@ -24,14 +24,12 @@ import mozilla.components.lib.state.ext.observeAsState
* @param onTextEdit Invoked when the user edits the text in the toolbar in "edit" mode.
* @param onTextCommit Invoked when the user has finished editing the URL and wants
* to commit the entered text.
* @param onDisplayToolbarClick Invoked when the user clicks on the URL in "display" mode.
* @param colors The color scheme the browser toolbar will use for the UI.
*/
@Suppress("MagicNumber")
@Composable
fun BrowserToolbar(
store: BrowserToolbarStore,
onDisplayToolbarClick: () -> Unit,
onTextEdit: (String) -> Unit,
onTextCommit: (String) -> Unit,
colors: BrowserToolbarColors = BrowserToolbarDefaults.colors(),
@@ -57,16 +55,13 @@ fun BrowserToolbar(
)
} else {
BrowserDisplayToolbar(
url = url.takeIf { it.isNotEmpty() } ?: uiState.displayState.hint,
pageOrigin = uiState.displayState.pageOrigin,
colors = colors.displayToolbarColors,
progressBarConfig = progressBarConfig,
browserActionsStart = uiState.displayState.browserActionsStart,
pageActionsStart = uiState.displayState.pageActionsStart,
pageActions = uiState.displayState.pageActions,
browserActions = uiState.displayState.browserActions,
onUrlClicked = {
onDisplayToolbarClick()
},
onInteraction = { store.dispatch(it) },
)
}