Content Widget

ContentWidget

Class responsible for creating the content widget.

Declared In:
com.synerise.sdk.content.widgets.ContentWidget

Declaration:

public class ContentWidget

Properties:

There are no properties.

Initializers:

There is a constructor.

public ContentWidget(ContentWidgetOptions contentWidgetOptions, ContentWidgetAppearance contentWidgetAppearance)

Methods:

Setter for widget state.

public void setOnContentWidgetListener(OnContentWidgetListener listener)

This method is responsible for returning widgetView.

public View getView()

This method reloads data.

public void load()



ContentWidgetAppearance

Class responsible for configuring the content widget UI.

Declared In:
com.synerise.sdk.content.widgets.model.ContentWidgetAppearance

Declaration:

public class ContentWidgetAppearance

Properties:

Property Type Optional Default Description
layout ContentWidgetBaseLayout no - Content widget layout
itemLayout ContentWidgetBaseItemLayout no - Single item layout

Initializers:

There is a constructor.

public ContentWidgetAppearance(ContentWidgetBaseLayout layout, ContentWidgetBaseItemLayout itemLayout)

Methods:

There are no methods.




ContentWidgetOptions

Class responsible for configuration of the content widget data.

Declared In:
com.synerise.sdk.content.widgets.model.ContentWidgetOptions com.synerise.sdk.content.widgets.model.ContentWidgetRecommendationsOptions

Declaration:

public class ContentWidgetRecommendationsOptions

Properties:

Property Type Optional Default Description
activity Activity no - Activity
slug String no - Slug name
attributes HashMap <String, Object> no - Attribute value
ContentWidgetOptionsAttributeKeyProductId String no - Final flag to add to attributes
mapper OnRecommendationModelMapper no - Mapper responsible for mapping RecommendationResponse
recommendationEventType RecommendationEventType no - Recommendation event type.
  • RECOMMENDATION_VIEW_EVENT sends all products in one event. We highly recommend using this type of event in content widget.
  • RECOMMENDATION_SEEN_EVENT sends each event as a separate event.

Initializers:

There is a constructor.

public ContentWidgetRecommendationsOptions(@NonNull Activity activity, @NonNull String slug, OnRecommendationModelMapper mapper)

Methods:

There are no methods.




ContentWidgetBaseLayout

Class responsible for widget layout configuration.

Declared In:
com.synerise.sdk.content.widgets.layout.ContentWidgetBaseLayout

Declaration:

public abstract class ContentWidgetBaseLayout

Properties:

There are no properties.

Initializers:

There are no constructors.

Inheriting classes

ContentWidgetGridLayout

ContentWidgetHorizontalSliderLayout

Methods:

This method defines the value of the cardview size. Any unit is acceptable, but remember to use the same unit across the whole widget.

public void setCardViewSize(int width, int height)

This method retrieves the preferred width of a gridView.

public float getPreferredWidth()

Setter for preferredWidth of a gridView.

public void setPreferredWidth(float width)



ContentWidgetSliderLayout

Class responsible for slider layout configuration.

Declared In:
com.synerise.sdk.content.widgets.layout.ContentWidgetHorizontalSliderLayout

Declaration:

public class ContentWidgetHorizontalSliderLayout extends ContentWidgetBaseLayout

Properties:

There are no properties.

Initializers:

There is only a default constructor.

Methods:

This method defines the cardview size. Any unit is acceptable, but remember to use the same unit across the whole widget.

public void setCardViewSize(int width, int height)

This method retrieves the preferred width of a gridView.

public float getPreferredWidth()

Setter for the preferredWidth of a gridView.

public void setPreferredWidth(float width)



ContentWidgetGridLayout

Class responsible for grid layout configuration.

Declared In:
com.synerise.sdk.content.widgets.layout.ContentWidgetGridLayout

Declaration:

public class ContentWidgetGridLayout extends ContentWidgetBaseLayout

Properties:

Property Type Optional Default Description
itemsPerRow int no 1 Number of items per row
cardViewVerticalSpacing int no 0 Card view vertical spacing
includeEdgeSpacing Boolean no false Defines if edge spacing is included

Initializers:

Constructor with the preferred width of a grid layout.

public ContentWidgetGridLayout(float prefferedWidth)

Methods:

This method defines the cardview size. Any unit is acceptable, but remember to use the same unit across the whole widget.

public void setCardViewSize(int width, int height)

This method retrieves the preferred width of a gridView.

public float getPreferredWidth()

Setter for the preferredWidth of a gridView.

public void setPreferredWidth(float width)



ContentWidgetBaseItemLayout

Class responsible for card layout configuration.

Declared In:
com.synerise.sdk.content.widgets.layout.ContentWidgetBaseItemLayout

Declaration:

public abstract class ContentWidgetBaseItemLayout

Inheriting classes

ContentWidgetBasicProductItemLayout

Properties:

Property Type Optional Default Description
cardViewCornerRadius float no 0 Card view corner radius
cardViewElevation float no 0 Card view elevation

Initializers:

There is only a default constructor.

Methods:

There are no methods.



ContentWidgetBasicProductItemLayout

Class responsible for the configuration of item layout.

Declared In:
com.synerise.sdk.content.widgets.layout.ContentWidgetBasicProductItemLayout

Declaration:

public class ContentWidgetBasicProductItemLayout extends ContentWidgetBaseItemLayout

Properties:

Parameter Type Default Description
imageHeightToCardHeightRatio Double 0.6 Image height. A ratio of 0.6 means that the image height equals 60% of the entire height of an item
imageWidthToCardWidthRatio Double 1 Image width. 1 means that the image width is equal to the width of the item
imageScaleType ImageView.ScaleType ImageView.ScaleType.CENTER_INSIDE Scaling type of the image
imageMargin int 0 General margin of the image
itemLabelStyle Typeface - Typeface of the label
itemLabelSize int 12 Size of the label
itemLabelColor int #000 Label text color
itemLabelMarginLeft int 0 Left margin of the label text
itemLabelMarginRight int 0 Right margin of the label text
itemLabelMarginBottom int 0 Bottom margin of the label text
itemLabelMarginTop int 0 Top margin of the label text
cardViewCornerRadius Float 0 Corner radius of the cardView
cardViewElevation Float 0 Elevation of the cardView
itemTitleStyle Typeface - Typeface of the product title
itemTitleSize int 12 Size of the title
itemTitleColor int #000 Color of the title text
itemTitleMarginLeft int 0 Left margin of the title text
itemTitleMarginRight int 0 Right margin of the title text
itemTitleMarginBottom int 0 Bottom margin of the title text
itemTitleMarginTop int 0 Top margin of the title text
itemTitleMaxLines int 1 Maximum displayed lines of the title text
itemSubTitleStyle Typeface - Typeface of the product subtitle
itemTitleSize int 12 Size of the title
itemSubTitleColor int #000 Color of the subtitle text
itemSubTitleMarginLeft int 0 Left margin of the subtitle text
itemSubTitleMarginRight int 0 Right margin of the subtitle text
itemSubTitleMarginBottom int 0 Bottom margin of the subtitle text
itemSubTitleMarginTop int 0 Top margin of the subtitle text
isItemSubTitleVisible Boolean false Flag indicating visibility of subtitle
itemSubTitleGravity int Gravity.LEFT Flag indicating gravity of subtitle
itemSubTitleMaxLines int 1 Maximum displayed lines of the subtitle text
itemProductIdentifier Typeface - Typeface of the product identifier
itemIdentifierSize int 12 Size of the identifier
itemIdentifierColor int #000 Color of the identifier text
itemIdentifierMarginLeft int 0 Left margin of the identifier text
itemIdentifierMarginRight int 0 Right margin of the identifier text
itemIdentifierMarginBottom int 0 Bottom margin of the identifier text
itemIdentifierMarginTop int 0 Top margin of the identifier text
isItemIdentifierVisible Boolean false Flag indicating visibility of identifier
itemIdentifierGravity int Gravity.LEFT Flag indicating gravity of identifier
itemIdentifierMaxLines int 1 Maximum displayed lines of the identifier text
itemLoyaltyPointsStyle Typeface - Typeface of the loyalty points
itemLoyaltyPointsSize int 12 Size of the loyalty points
itemLoyaltyPointsColor int #000 Color of the loyalty points text
itemLoyaltyPointsMarginLeft int 0 Left margin of the loyalty points text
itemLoyaltyPointsMarginRight int 0 Right margin of the loyalty points text
itemLoyaltyPointsMarginBottom int 0 Bottom margin of the loyalty points text
itemLoyaltyPointsMarginTop int 0 Top margin of the loyalty points text
isItemLoyaltyPointsVisible Boolean false Flag indicating visibility of loyalty points
itemLoyaltyPointsHorizontalPosition HorizontalPosition HorizontalPosition.LEFT Flag indicating position of loyaltyPoints
itemLoyaltyPointsLabel String “Loyalty points” Label for loyalty points field
itemLoyaltyPointsLabelStyle Typeface - Typeface of the loyalty points label
itemLoyaltyPointsLabelSize int 12 Size of the loyalty points label
itemLoyaltyPointsLabelColor int #000 Color of the loyalty points label text
itemLoyaltyPointsLabelMarginLeft int 0 Left margin of the loyalty points label text
itemLoyaltyPointsLabelMarginRight int 0 Right margin of the loyalty points label text
itemLoyaltyPointsLabelMarginBottom int 0 Bottom margin of the loyalty points label text
itemLoyaltyPointsLabelMarginTop int 0 Top margin of the loyalty points label text
itemPriceStyle Typeface - Typeface of the price
itemPriceSize int 12 Size of the price text
itemPriceColor int #000 Color of the price text
itemPriceMarginLeft int 0 Left margin of the price text
itemPriceMarginRight int 0 Right margin of the price text
itemPriceMarginTop int 0 Top margin of the price text
itemPriceMarginBottom int 0 Bottom margin of the price text
itemPriceCurrencyHorizontalPosition HorizontalPosition HorizontalPosition.RIGHT Flag indicating position of currency
itemPriceHorizontalPosition HorizontalPosition 0 Bottom margin of the price text
itemSalePriceStyle Typeface - Typeface of the sale price
itemSalePriceSize int 12 Size of the sale price
itemSalePriceColor int #000 Color of the sale price text
itemSalePriceGravity int Gravity.LEFT Gravity of the sale price text
itemSalePriceMarginLeft int 0 Left margin of the sale price text
itemSalePriceMarginRight int 0 Right margin of the sale price text
itemSalePriceMarginTop int 0 Top margin of the sale price text
itemSalePriceMarginBottom int 0 Bottom margin of the sale price text
itemSalePriceOrientation int LinearLayout.HORIZONTAL Orientation of the sale price text
isItemSalePriceVisible Boolean false Flag determining whether to show the sale price or not
itemDiscountPercentageLabelStyle Typeface - Typeface of discount percentage label
itemDiscountPercentageLabelColor int #000 Color of discount percentage label
itemDiscountPercentageLabelSize int 12 Size of the discount percentage label text
itemDiscountPercentageLabelMarginLeft int 0 Left margin of the discount percentage label text
itemDiscountPercentageLabelMarginRight int 0 Right margin of the discount percentage label text
itemDiscountPercentageLabelMarginTop int 0 Top margin of the discount percentage label text
itemDiscountPercentageLabelMarginBottom int 0 Bottom margin of the discount percentage label text
isItemDiscountPercentageLabelVisible Boolean false Flag determining whether to show the discount percentage label or not
itemActionButton ImageButtonCustomAction - Object which stores all information about the ActionButton
itemBadge ContentWidgetBadge - Object which stores all information about the Badge
imageButtonCustomActionGravity int Gravity.TOP Gravity of the actionButton

Initializers:

There are no initializers.

Methods:

Setter for margins in ItemTitle.

public void setItemTitleMargins(int marginLeft, int marginRight, int marginTop, int marginBottom)

Setter for margins in ItemPrice.

public void setItemPriceMargins(int marginLeft, int marginRight, int marginTop, int marginBottom)

Setter for margins in ItemSalePrice.

public void setItemSalePriceMargins(int marginLeft, int marginRight, int marginTop, int marginBottom)

Setter for margins in ItemLabel.

public void setItemLabelMargins(int marginLeft, int marginRight, int marginTop, int marginBottom)

Setter for margins in ItemDiscountLabel.

public void setItemDiscountLabelMargins(int marginLeft, int marginRight, int marginTop, int marginBottom)

Setter for margins in ItemSubtitle.

public void setItemSubTitleMargins(int marginLeft, int marginRight, int marginTop, int marginBottom)

Setter for margins in ItemIdentifier.

public void setItemIdentifierMargins(int marginLeft, int marginRight, int marginTop, int marginBottom)

Setter for margins in ItemLoyaltyPoints.

public void setItemLoyaltyPointsMargins(int marginLeft, int marginRight, int marginTop, int marginBottom)

Setter for margins in ItemLoyaltyPointsLabel.

public void setItemLoyaltyPointsLabelMargins(int marginLeft, int marginRight, int marginTop, int marginBottom)

Setter for itemAction.

public void setItemAction(ImageButtonCustomAction itemImageButton)

Setter for the badge.

public void setBadge(ContentWidgetBadge badge)


ContentWidgetRecommendationDataModel

Model for recommendations inside a content widget

Declared In:
com.synerise.sdk.content.widgets.dataModel.ContentWidgetRecommendationDataModel

Declaration:

public class ContentWidgetRecommendationDataModel

Properties:

There are no properties.

Initializers:

Constructor:

public ContentWidgetRecommendationDataModel(String name, String image, String price, String salePrice, String priceCurrency)
Note: It’s recommended to send the value of the priceCurrency in ISO format.

Methods:

This method retrieves an item name.

public String getName()

This method retrieves the URL of the item’s image.

public String getImage()

This method retrieves the item’s price.

public String getPrice()

This method retrieves the item’s sale price.

public String getSalePrice()

This method retrieves the currency of the price.

public String getPriceCurrency()

This method retrieves the value of the badge model parameter.

public ContentWidgetBadgeDataModel getBadgeDataModel()

This method retrieves the value of the label parameter.

public String getLabel()

This method defines the value of the badge model parameter.

public void setBadgeDataModel(ContentWidgetBadgeDataModel badge)

This method defines the value of the label parameter.

public void setLabel(String label)



ContentWidgetBadgeDataModel

Model for badges inside content widgets.

Declared In:
com.synerise.sdk.content.widgets.dataModel.ContentWidgetBadgeDataModel

Declaration:

public class ContentWidgetBadgeDataModel

Properties:

There are no properties.

Initializers:

Constructor:

public ContentWidgetBadgeDataModel(String text, int color, int textColor)

Methods:

This method retrieves the value of the badge text.

public String getText()

This method retrieves the badge color.

public int getColor()

This method retrieves the badge text color.

public int getTextColor()



ContentWidgetRecommendationDataModel

Model for recommendations inside a content widget

Declared In:
com.synerise.sdk.content.widgets.dataModel.ContentWidgetRecommendationDataModel

Declaration:

public class ContentWidgetRecommendationDataModel

Properties:

There are no properties.

Initializers:

Constructor:

public ContentWidgetRecommendationDataModel(String name, String image, String price, String salePrice, String priceCurrency)
Note: It’s recommended to send the value of the priceCurrency in ISO format.

Methods:

This method retrieves an item name.

public String getName()

This method retrieves the URL of the item’s image.

public String getImage()

This method retrieves the item’s price.

public String getPrice()

This method retrieves the item’s sale price.

public String getSalePrice()

This method retrieves the currency of the price.

public String getPriceCurrency()

This method retrieves the value of the badge model parameter.

public ContentWidgetBadgeDataModel getBadgeDataModel()

This method retrieves the value of the label parameter.

public String getLabel()

This method defines the value of the badge model parameter.

public void setBadgeDataModel(ContentWidgetBadgeDataModel badge)

This method defines the value of the label parameter.

public void setLabel(String label)

😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker