android-components / mozilla.components.browser.awesomebar.layout / SuggestionLayout


interface SuggestionLayout (source)

A SuggestionLayout implementation defines how the suggestions of the BrowserAwesomeBar are getting layout. By default BrowserAwesomeBar uses DefaultSuggestionLayout. However a consumer can provide its own implementation in order to create a customized look & feel.


Name Summary
createViewHolder abstract fun createViewHolder(awesomeBar: BrowserAwesomeBar, view: <ERROR CLASS>, layoutId: Int): SuggestionViewHolder
Creates and returns a SuggestionViewHolder instance for the provided View. The BrowserAwesomeBar will call SuggestionViewHolder.bind once this view holder should display the data of a specific AwesomeBar.Suggestion.
getLayoutResource abstract fun getLayoutResource(suggestion: Suggestion): Int
Returns a layout resource ID to be used for this suggestion. The BrowserAwesomeBar implementation will take care of inflating the layout or re-using instances as needed.

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.


Name Summary
DefaultSuggestionLayout class DefaultSuggestionLayout : SuggestionLayout
Default implementation of SuggestionLayout to be used by BrowserAwesomeBar.