Bug 1962168 - part 6 - Update the Origin composable to not use Views anymore r=android-reviewers,tchoh

Differential Revision: https://phabricator.services.mozilla.com/D247465
This commit is contained in:
Mugurell
2025-05-12 10:40:32 +00:00
committed by plingurar@mozilla.com
parent 7df8eafe11
commit 80ac1d6c7c
6 changed files with 162 additions and 231 deletions

View File

@@ -36,6 +36,7 @@ import org.mozilla.samples.toolbar.R
import org.mozilla.samples.toolbar.middleware.PageActionsEndInteractions.RefreshClicked
import org.mozilla.samples.toolbar.middleware.PageOriginInteractions.CopyOptionClicked
import org.mozilla.samples.toolbar.middleware.PageOriginInteractions.PageOriginClicked
import org.mozilla.samples.toolbar.middleware.PageOriginInteractions.PasteOptionClicked
import org.mozilla.samples.toolbar.middleware.SearchSelectorInteractions.BookmarksClicked
import org.mozilla.samples.toolbar.middleware.SearchSelectorInteractions.HistoryClicked
import org.mozilla.samples.toolbar.middleware.SearchSelectorInteractions.SettingsClicked
@@ -65,6 +66,7 @@ private sealed class StartPageInteractions : BrowserToolbarEvent {
private sealed class PageOriginInteractions : BrowserToolbarEvent {
data object PageOriginClicked : PageOriginInteractions()
data object CopyOptionClicked : PageOriginInteractions()
data object PasteOptionClicked : PageOriginInteractions()
}
private sealed class PageActionsEndInteractions : BrowserToolbarEvent {
@@ -214,11 +216,17 @@ internal class BrowserToolbarMiddleware(
onLongClick = BrowserToolbarMenu {
listOf(
BrowserToolbarMenuButton(
iconResource = iconsR.drawable.mozac_ic_copy_24,
iconResource = null,
text = R.string.copy_url_button,
contentDescription = R.string.copy_url_button_description,
onClick = CopyOptionClicked,
),
BrowserToolbarMenuButton(
iconResource = null,
text = R.string.paste_url_button,
contentDescription = R.string.paste_url_button_description,
onClick = PasteOptionClicked,
),
)
},
)

View File

@@ -24,4 +24,6 @@
<string name="toolbar_search_hint">Search or enter address</string>
<string name="copy_url_button">Copy</string>
<string name="copy_url_button_description">Copy the current url</string>
<string name="paste_url_button">Paste</string>
<string name="paste_url_button_description">Paste url from clipboard</string>
</resources>