Miscellaneous classes

ContentWidget class


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)

Method responsible for returning widgetView.

public View getView()

Method to reload data.

public void load()

ContentWidgetAppearance class


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.


ContentWidgetBaseItemLayout class


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.

ContentWidgetBaseLayout class


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

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

public void setCardViewSize(int width, int height)

Returns the preferred width of a gridView.

public float getPreferredWidth()

Setter for preferredWidth of a gridView.

public void setPreferredWidth(float width)

ContentWidgetBasicProductItemLayout class


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)

ContentWidgetGridLayout class


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

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

public void setCardViewSize(int width, int height)

Returns the preferred width of a gridView.

public float getPreferredWidth()

Setter for the preferredWidth of a gridView.

public void setPreferredWidth(float width)

ContentWidgetOptions class


Class responsible for configuration of the data content widget.

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

Initializers

There is a constructor.

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

Methods

There are no methods.


ContentWidgetSliderLayout class


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

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

public void setCardViewSize(int width, int height)

Returns the preferred width of a gridView.

public float getPreferredWidth()

Setter for the preferredWidth of a gridView.

public void setPreferredWidth(float width)

ContentWidgetRecommendationDataModel class


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: priceCurrency should be in ISO format.

Methods

Get item name.

public String getName()

Get URL of the item’s image.

public String getImage()

Get item’s price.

public String getPrice()

Get item’s sale price.

public String getSalePrice()

Get currency of the price.

public String getPriceCurrency()

Get badge model.

public ContentWidgetBadgeDataModel getBadgeDataModel()

Get label.

public String getLabel()

Set badge model.

public void setBadgeDataModel(ContentWidgetBadgeDataModel badge)

Set label.

public void setLabel(String label)

ContentWidgetBadgeDataModel class


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

Get badge text.

public String getText()

Get badge color.

public int getColor()

Get badge text color.

public int getTextColor()

ApiError class


Class responsible for managing errors.

Declared In

com.synerise.sdk.error.ApiError

Declaration

public class ApiError

Properties

Property Type Optional Default Description
errorBody ApiErrorBody no - API Error Body
httpErrorCategory HttpErrorCategory no - HTTP error category
errorType ErrorType no - Error type
httpCode int no - HTTP error code
throwable Throwable no - Android throwable
Note: All of the properties above are accessible by using getters.

Initializers

There are no initializers.

Methods

Prints stack trace on original Throwable instance.

public void printStackTrace()

ApiErrorBody class


Class responsible for providing the API error body.

Declared In

com.synerise.sdk.error.ApiErrorBody

Declaration

public class ApiErrorBody implements Serializable

Properties

Property Type Optional Default Description
error String no - String representation of the returned HTTP status code
message String no - Error message
path String no - Endpoint path in which the error has occurred
status int no - Error’s HTTP status code
errorCauses List<ApiErrorCause> yes - Optional list of error causes, mostly occurs when 400 http code is returned
Note: All of the properties above are accessible by using getters.

Initializers

There are no initializers.

Methods

There are only getters.


ApiErrorCause class


Class responsible for providing the API error cause.

Declared In

com.synerise.sdk.error.ApiErrorCause

Declaration

public class ApiErrorCause implements Serializable

Properties

Property Type Optional Default Description
field String yes - Main error cause, for example the field which failed validation
message String yes - Error message
code int no - Unique error cause code
rejectedValue String yes - Optional rejected value
Note: All of the properties above are accessible by using getters.

Initializers

There are no initializers.

Methods

There are only getters.


ErrorType enum


This enum contains values for error types.

Declared In

com.synerise.sdk.error.ErrorType

Declaration

public enum ErrorType

Values

Property Description
HTTP_ERROR HTTP error
NETWORK_ERROR Network error
NO_TOKEN No token
UNKNOWN Unknown error type

Methods

There are no methods.

HttpErrorCategory enum


This enum contains values for HTTP error categories.

Declared In

com.synerise.sdk.error.HttpErrorCategory

Declaration

public enum HttpErrorCategory

Values

Property Value Description
BAD_REQUEST 400 Bad request
UNAUTHORIZED 401 Unauthorized (no token, wrong token)
FORBIDDEN 403 Forbidden (insufficient permissions)
NOT_FOUND 404 Resource not found
RANGE_NOT_SATISFIABLE 416 Range not satisfiable
SERVER_ERROR 500-599 Server error
UNKNOWN -1 Unknown error

Methods

Get HTTP error category.

public static HttpErrorCategory getHttpErrorCategory(int code)

😕

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