VisualizerViewAction.Builder


public static final class VisualizerViewAction.Builder
extends Object

java.lang.Object
   ↳ 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

Builder()

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

Public methods

VisualizerViewAction build()

Builds a new VisualizerViewAction from this builder's configuration.

VisualizerViewAction.Builder setAttributionInsight(ContextInsight insight)

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

VisualizerViewAction.Builder setEgressInsight(ContextInsight insight)

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

VisualizerViewAction.Builder setFeedbackRequest(FeedbackRequest feedbackRequest)

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

VisualizerViewAction.Builder setShouldCloseSessionOnTriggered(boolean shouldCloseSessionOnTriggered)

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

Inherited methods

Public constructors

Builder

Added in version 37.2
public Builder ()

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

Public methods

build

Added in version 37.2
public VisualizerViewAction build ()

Builds a new VisualizerViewAction from this builder's configuration.

Returns
VisualizerViewAction This value cannot be null.

Throws
IllegalStateException if more than one action (egress, attribution, or feedback) is set, or if no actions and no session closure have been configured.

setAttributionInsight

Added in version 37.2
public VisualizerViewAction.Builder setAttributionInsight (ContextInsight insight)

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

This action also reports an insight event to the understander's ContextUnderstanderService.onHandleEvent(String, InsightEvent) method with event type InsightEvent.EVENT_USER_ATTRIBUTION_REQUESTED when triggered.

Parameters
insight ContextInsight: The ContextInsight for attribution.
This value cannot be null.

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

setEgressInsight

Added in version 37.2
public VisualizerViewAction.Builder setEgressInsight (ContextInsight insight)

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

This action will also report an insight event to the understander's ContextUnderstanderService.onHandleEvent(String, InsightEvent) method with event type InsightEvent.EVENT_USER_EGRESS_REQUESTED when triggered.

Parameters
insight ContextInsight: The ContextInsight to egress.
This value cannot be null.

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

setFeedbackRequest

Added in version 37.2
public VisualizerViewAction.Builder setFeedbackRequest (FeedbackRequest feedbackRequest)

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.

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

setShouldCloseSessionOnTriggered

Added in version 37.2
public VisualizerViewAction.Builder setShouldCloseSessionOnTriggered (boolean shouldCloseSessionOnTriggered)

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.

Parameters
shouldCloseSessionOnTriggered boolean

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