android-components / mozilla.components.concept.awesomebar / AwesomeBar / Suggestion

Suggestion

data class Suggestion (source)

A Suggestion to be displayed by an AwesomeBar implementation.

Types

Chip

data class Chip

Chips are compact actions that are shown as part of a suggestion. For example a Suggestion from a search engine may offer multiple search suggestion chips for different search terms.

Flag

enum class Flag

Flags can be added by a SuggestionProvider to help the AwesomeBar implementation decide how to display a specific Suggestion. For example an AwesomeBar could display a bookmark star icon next to Suggestions that contain the BOOKMARK flag.

Constructors

<init>

Suggestion(id: String = UUID.randomUUID().toString(), title: String? = null, description: String? = null, icon: (width: Int, height: Int) -> Bitmap? = { _, _ -> null }, chips: List<Chip> = emptyList(), flags: Set<Flag> = emptySet(), onSuggestionClicked: () -> Unit = null, onChipClicked: (Chip) -> Unit = null)

A Suggestion to be displayed by an AwesomeBar implementation.

Properties

chips

val chips: List<Chip>

A list of Chip instances to be displayed.

description

val description: String?

A user-readable description for the Suggestion.

flags

val flags: Set<Flag>

A set of Flag values for this Suggestion.

icon

val icon: (width: Int, height: Int) -> Bitmap?

A lambda that can be invoked by the AwesomeBar implementation to receive an icon Bitmap for this Suggestion. The AwesomeBar will pass in its desired width and height for the Bitmap.

id

val id: String

A unique ID identifying this Suggestion. A stable ID but different data indicates to the AwesomeBar that this is the same Suggestion with new data. This will affect how the AwesomeBar animates showing the new suggestion.

onChipClicked

val onChipClicked: (Chip) -> Unit

A callback to be executed when a Chip was clicked by the user.

onSuggestionClicked

val onSuggestionClicked: () -> Unit

A callback to be executed when the Suggestion was clicked by the user.

title

val title: String?

A user-readable title for the Suggestion.