Builder


class Builder
kotlin.Any
   ↳ android.service.personalcontext.embedded.VisualizerViewAction.Builder

Builder for creating VisualizerViewAction instances.

At most one action (egress, attribution, or feedback) can be configured. Any action can also optionally close the session when triggered.

Summary

Public constructors

Creates a new Builder that defaults to not closing the visualization session on trigger.

Public methods
VisualizerViewAction

Builds a new VisualizerViewAction from this builder's configuration.

VisualizerViewAction.Builder

Configures an action that starts attribution for the given insight when triggered.

VisualizerViewAction.Builder

Configures an action to egress an insight to the client app.

VisualizerViewAction.Builder

Configures an action to launch the feedback activity when triggered, providing the specified FeedbackRequest.

VisualizerViewAction.Builder
setShouldCloseSessionOnTriggered(shouldCloseSessionOnTriggered: Boolean)

Sets whether triggering this action should end the visualization session, causing the visualization to stop displaying.

Public constructors

Builder

Builder()

Creates a new Builder that defaults to not closing the visualization session on trigger.

Public methods

build

fun build(): VisualizerViewAction

Builds a new VisualizerViewAction from this builder's configuration.

Return
VisualizerViewAction This value cannot be null.
Exceptions
java.lang.IllegalStateException if more than one action (egress, attribution, or feedback) is set, or if no actions and no session closure have been configured.

setAttributionInsight

fun setAttributionInsight(insight: ContextInsight): VisualizerViewAction.Builder

Configures an action that starts attribution for the given insight when triggered.

This action also reports an insight event to the understander's android.service.personalcontext.understander.ContextUnderstanderService#onHandleEvent method with event type InsightEvent.EVENT_USER_ATTRIBUTION_REQUESTED when triggered.

Parameters
insight ContextInsight: The ContextInsight for attribution.
This value cannot be null.
Return
VisualizerViewAction.Builder this Builder instance.
This value cannot be null.

setEgressInsight

fun setEgressInsight(insight: ContextInsight): VisualizerViewAction.Builder

Configures an action to egress an insight to the client app.

This action will also report an insight event to the understander's android.service.personalcontext.understander.ContextUnderstanderService#onHandleEvent method with event type InsightEvent.EVENT_USER_EGRESS_REQUESTED when triggered.

Parameters
insight ContextInsight: The ContextInsight to egress.
This value cannot be null.
Return
VisualizerViewAction.Builder this Builder instance.
This value cannot be null.

setFeedbackRequest

fun setFeedbackRequest(feedbackRequest: FeedbackRequest): VisualizerViewAction.Builder

Configures an action to launch the feedback activity when triggered, providing the specified FeedbackRequest.

The visualization session will use the feedback activity provided in same UnderstandResult that the session was part of, using UnderstandResult.Builder.setFeedbackActivity. If a feedback activity was not provided, this action will not have any effect.

Parameters
feedbackRequest FeedbackRequest: The FeedbackRequest containing feedback details.
This value cannot be null.
Return
VisualizerViewAction.Builder this Builder instance.
This value cannot be null.

setShouldCloseSessionOnTriggered

fun setShouldCloseSessionOnTriggered(shouldCloseSessionOnTriggered: Boolean): VisualizerViewAction.Builder

Sets whether triggering this action should end the visualization session, causing the visualization to stop displaying.

The visualizer session will receive the InsightVisualizerSession.close(int) callback with reason InsightVisualizerSession.CLOSE_REASON_USER_BUTTON_PRESS when this action is triggered.

Return
VisualizerViewAction.Builder this Builder instance.
This value cannot be null.