[components] For https://github.com/mozilla-mobile/android-components/issues/6324 Allow customization of display url in toolbar
This commit is contained in:
@@ -42,6 +42,8 @@ dependencies {
|
||||
|
||||
implementation project(':support-ktx')
|
||||
|
||||
implementation project(':support-utils')
|
||||
|
||||
implementation Dependencies.kotlin_stdlib
|
||||
implementation Dependencies.kotlin_coroutines
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import mozilla.components.feature.toolbar.ToolbarAutocompleteFeature
|
||||
import mozilla.components.support.ktx.android.content.res.resolveAttribute
|
||||
import mozilla.components.support.ktx.android.view.hideKeyboard
|
||||
import mozilla.components.ui.tabcounter.TabCounter
|
||||
import mozilla.components.support.utils.URLStringUtils
|
||||
|
||||
/**
|
||||
* This sample application shows how to use and customize the browser-toolbar component.
|
||||
@@ -304,6 +305,10 @@ class ToolbarActivity : AppCompatActivity() {
|
||||
hint = 0x1E15141a.toInt()
|
||||
)
|
||||
|
||||
toolbar.display.urlFormatter = { url ->
|
||||
URLStringUtils.toDisplayUrl(url)
|
||||
}
|
||||
|
||||
toolbar.display.setUrlBackground(getDrawable(R.drawable.fenix_url_background))
|
||||
toolbar.display.hint = "Search or enter address"
|
||||
toolbar.display.setOnUrlLongClickListener {
|
||||
|
||||
Reference in New Issue
Block a user