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

Suggestion

data class Suggestion (source)

A Suggestion to be displayed by an AwesomeBar implementation.

Types

Name Summary
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

Name Summary
<init> Suggestion(provider: SuggestionProvider, id: String = UUID.randomUUID().toString(), title: String? = null, description: String? = null, icon: suspend (width: Int, height: Int) -> Bitmap? = null, chips: List<Chip> = emptyList(), flags: Set<Flag> = emptySet(), onSuggestionClicked: () -> Unit = null, onChipClicked: (Chip) -> Unit = null, score: Int = 0)
A Suggestion to be displayed by an AwesomeBar implementation.

Properties

Name Summary
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: suspend (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 (provider scope) 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.
provider val provider: SuggestionProvider
The provider this suggestion came from.
score val score: Int
A score used to rank suggestions of this provider against each other. A suggestion with a higher score will be shown on top of suggestions with a lower score.
title val title: String?
A user-readable title for the Suggestion.

Functions

Name Summary
areContentsTheSame fun areContentsTheSame(other: Suggestion): Boolean
Returns true if the content of the two suggestions is the same.