Renderer

@RequiresApi(api = Build.VERSION_CODES.R)
public final class Renderer


Renderer class responsible for rendering the inline suggestion UI.

Summary

Public methods

static @Nullable PendingIntent

Returns a PendingIntent that will be launched on long clicking the UI to show attribution information via a android.app.Dialog.

static @NonNull Bundle

Returns all the supported versions wrapped in a Bundle.

static @Nullable View
render(
    @NonNull Context context,
    @NonNull Slice content,
    @NonNull Bundle styles
)

Public methods

getAttributionIntent

Added in 1.1.0
public static @Nullable PendingIntent getAttributionIntent(@NonNull Slice content)

Returns a PendingIntent that will be launched on long clicking the UI to show attribution information via a android.app.Dialog.

The attribution UI indicates to the user the source of the UI content.

Parameters
@NonNull Slice content

the UI content which contains a PendingIntent representing the attribution information

getSupportedInlineUiVersionsAsBundle

Added in 1.1.0
public static @NonNull Bundle getSupportedInlineUiVersionsAsBundle()

Returns all the supported versions wrapped in a Bundle.

render

Added in 1.1.0
public static @Nullable View render(
    @NonNull Context context,
    @NonNull Slice content,
    @NonNull Bundle styles
)
Parameters
@NonNull Context context

the context used to render the view

@NonNull Slice content

represents the UI content

@NonNull Bundle styles

contains a mapping from UI version to corresponding UI style specification

Returns
@Nullable View

a view rendered based on the provided UI content and the style with corresponding version or null when the UI version indicated by the slice is either unsupported by the Renderer, or not provided in the styles.