Content widget callbacks
Content widget callback
A callback to handle Content Widget actions.
Declared in
com.synerise.sdk.content.widgets.listener.OnContentWidgetListener
Load widget
The following method is called after a widget is loaded.
- void onLoad(ContentWidget contentWidget);
Parameter | Type | Description |
---|---|---|
contentWidget |
ContentWidget |
The widget instance that called the callback method |
Error when loading
The following method is called when an error occurs while loading.
- void onLoadingError(ContentWidget contentWidget, ApiError apiError);
Parameter | Type | Description |
---|---|---|
contentWidget |
ContentWidget |
The widget instance that called the callback method |
apiError |
ApiError |
The error that occurred |
Widget item clicked
The following method is called when the customer clicks a widget’s item.
- void onClickActionReceive(ContentWidget contentWidget, BaseModel model);
Parameter | Type | Description |
---|---|---|
contentWidget |
ContentWidget |
The widget instance that called the callback method |
model |
BaseModel |
The model’s object that was clicked |
Widget state change
The following method is called when the widget’s loading state changes.
- void onLoading(ContentWidget contentWidget, boolean isLoading);
Parameter | Type | Description |
---|---|---|
contentWidget |
ContentWidget |
The widget instance that called the callback method |
isLoading |
Boolean |
Widget’s loading state |
Widget size change
The following method is called when the widget’s size changes.
- void onSizeChange(ContentWidget contentWidget, ViewGroup.LayoutParams size);
Parameter | Type | Description |
---|---|---|
contentWidget |
ContentWidget |
The widget instance that called the callback method |
size |
ViewGroup.LayoutParams |
Widget’s new size |
OnRecommendationModelMapper
A callback to handle model mapping.
DeclaredIn
com.synerise.sdk.content.widgets.listener.OnRecommendationModelMapper
onRecommendationMapping
The following method is called when Synerise SDK gets a RecommendationResponse
. The SDK passes a hashmap.
- ContentWidgetRecommendationDataModel onRecommendationMapping(HashMap<String, Object> data);
Parameter | Type | Description |
---|---|---|
data |
Recommendation | Raw recommendation that should be mapped |
return |
ContentWidgetRecommendationDataModel | Recommendation model compatible with ContentWidget |