Set Up Storyly Bar
UI Customizations
This guide shows you how to customize the story experience of your users. These customizations apply to both storyly bar and story view.
Warning
If you are planning to do some of the customizations in the layout XML file, then the following part should be added as a layout attribute:
xmlns:app="http://schemas.android.com/apk/res-auto"
Before you begin
It is advised to apply these customizations after
StorylyInit
if you are planning to do the customizations programmatically.
Storyly Bar Customizations
This section shows supported customizations on the Storyly bar.
Story Group Text Styling
This styling changes the visibility, font, text size, color and number of lines of Story Group Text. Each of the properties can be specified from the layout XML file or from attributes section of design view one by one.
app:storyGroupTextIsVisible="boolean"
app:storyGroupTextColorSeen="@android:color/<color>"
or
app:storyGroupTextColorSeen="#808080"
app:storyGroupTextColorNotSeen="@android:color/<color>"
or
app:storyGroupTextColorNotSeen="#000000"
app:storyGroupTextTypeface="@font/your_font>"
app:storyGroupTextSize="dimension"
app:storyGroupTextMinLines="integer"
app:storyGroupTextMaxLines="integer"
<!--Overrides min and max lines-->
app:storyGroupTextLines="integer"
If you want to set programmatically, you can use setStoryGroupTextStyling function. Please check API Reference for StoryGroupTextStyling.
storylyView.setStoryGroupTextStyling(storyGroupTextStyling: StoryGroupTextStyling) {
storylyView.setStoryGroupTextStyling(StoryGroupTextStyling storyGroupTextStyling)
Warning
If you are planning to do ui customization, do not mix programmatical changes with xml or attributes section of design view. Prefer to use programmatical approach if you want incremental updates on story group text.
Story Group Icon Background Color
This attribute changes the background color of the story group icon that is shown to the user as skeleton view till the stories are loaded. This attribute can be specified programmatically, from the layout XML file or from attributes section of design view.
In order to set this attribute, use one of the following methods:
storylyView.setStoryGroupIconBackgroundColor(color: Int)
storylyView.setStoryGroupIconBackgroundColor(Int color)
app:storyGroupIconBackgroundColor="@android:color/<color>"
or
app:storyGroupIconBackgroundColor="#RGBA"
In order to set this attribute from the design view, find and fill the storyGroupIconBackgroundColor
attribute.
Story Group Icon Border Seen State Color
This attribute changes the border color of the story group icons that are seen by the user. The border consists of color gradients. This attribute can be specified programmatically, from the layout XML file or from attributes section of design view.
Warning
At least 2 colors must be defined in order to use this attribute. If a single color is requested, a same color code can be used twice.
In order to set this attribute, use one of the following methods:
storylyView.setStoryGroupIconBorderColorSeen(colors: Array<Int>)
storylyView.setStoryGroupIconBorderColorSeen(Integer[] color)
<!--First define an array of color code items as a resource:-->
<array name="seen">
<item>#FFDBDBDB</item>
<item>#FFDBDBDB</item>
</array>
<!--Then give the name of the array as reference as a StorylyView attribute:-->
app:storyGroupIconBorderColorSeen="@<location>/seen"
In order to set this attribute from the design view, find and fill the storyGroupIconBorderColorSeen
attribute as an array of color codes.
Story Group Icon Border Not Seen State Color
This attribute changes the border color of the story group icons that are unseen by the user. The border consists of color gradients. This attribute can be specified programmatically, from the layout XML file or from attributes section of design view.
Warning
At least 2 colors must be defined in order to use this attribute. If a single color is requested, a same color code can be used twice.
In order to set this attribute, use one of the following methods:
storylyView.setStoryGroupIconBorderColorNotSeen(colors: Array<Int>)
storylyView.setStoryGroupIconBorderColorNotSeen(Integer[] color)
<!--First define an array of color code items as a resource:-->
<array name="notSeen">
<item>#FFFED169</item>
<item>#FFFA7C20</item>
<item>#FFC9287B</item>
<item>#FF962EC2</item>
<item>#FFFED169 </item>
</array>
<!--Then give the name of the array as reference as a StorylyView attribute:-->
app:storyGroupIconBorderColorNotSeen="@<location>/notSeen"
In order to set this attribute from the design view, find and fill the storyGroupIconBorderColorNotSeen
attribute as an array of color codes.
Story Group Pin Icon Color
If any of the story groups are selected as pinned groups from the dashboard, a little star icon will appear along with the story group icon. This attribute changes the background color of this pin icon. This attribute can be specified programmatically, from the layout XML file or from attributes section of design view.
In order to set this attribute, use one of the following methods:
storylyView.setStoryGroupPinIconColor(color: Int)
storylyView.setStoryGroupPinIconColor(Int color)
app:storyGroupPinIconColor="@android:color/<color>"
or
app:storyGroupPinIconColor="#RGBA"
In order to set this attribute from the design view, find and fill the storyGroupPinIconColor
attribute.
Story Group Ivod Icon Color
If any of the story groups are selected as the IVod group type from the dashboard, a little camera icon will appear along with the story group icon. This attribute changes the background color of this Ivod icon. This attribute can be specified programmatically, from the layout XML file or from attributes section of design view.
In order to set this attribute, use one of the following methods:
storylyView.setStoryGroupIVodIconColor(color: Int)
storylyView.setStoryGroupIVodIconColor(Int color)
app:storyGroupIVodIconColor="@android:color/<color>"
or
app:storyGroupIVodIconColor="#RGBA"
In order to set this attribute from the design view, find and fill the storyGroupIVodIconColor
attribute.
Story Group Size
This attribute changes the size of the story group. This attribute can be specified programmatically, from the layout XML file or from attributes section of design view. Currently, supported sizes are small
, large
and custom
sizes. The default story group size is large
.
In order to set this attribute, use one of the following methods:
storylyView.setStoryGroupSize(size: StoryGroupSize)
storylyView.setStoryGroupSize(StoryGroupSize size)
<!--Supported sizes are small, large and custom-->
app:storyGroupSize="small"
or
app:storyGroupSize="large"
or
app:storyGroupSize="custom"
In order to set this attribute from the design view, find and fill the storyGroupSize
attribute.
Tip
If you set your story group size as
custom
, you can change a few measures of the story groups such as icon height, icon width, icon corner radius. Check the Custom Size Story Group Icon Styling.
Custom Size Story Group Icon Styling
This styling changes the shape of the story group icons, their corners, and the distance between each other. You can create square, circle, and oval-shaped icons using these attributes. This styling can be specified programmatically, from the layout XML file or from attributes section of design view. You should set a StoryGroupIconStyling
instance, which consists of the following variables: height, width, cornerRadius.
Warning
This section is effective if you set your story group size as
custom
. If you set any other size and use this attribute, your changes will not take effect.
In order to set this attribute, use one of the following methods:
storylyView.setStoryGroupIconStyling(storyGroupIconStyling: StoryGroupIconStyling)
storylyView.setStoryGroupIconStyling(StoryGroupIconStyling storyGroupIconStyling)
app:storyGroupIconHeight="" (should be set as dp, default values is: "80dp")
app:storyGroupIconWidth="" (should be set as dp, default values is: "80dp")
app:storyGroupIconCornerRadius="" (should be set as dp, default values is: "40dp")
In order to set these attributes from design view, find and fill the storyGroupIconHeight
, storyGroupIconWidth
, and storyGroupIconCornerRadius
attributes.
Warning
If you are not planning to use XML attributes, then you should set pixel values for the variables of StoryGroupIconStyling.
Story Group List Styling
This styling changes the orientation of Story Groups, number of rows/columns (sections), horizontal and vertical distance between the Story Groups and edge paddings of the first and last Story Groups.
In order to set these attributes, use one of the following methods:
storylyView.setStoryGroupListStyling(StoryGroupListStyling(orientation = StoryGroupListOrientation.Horizontal | StoryGroupListOrientation.Vertical))
storylyView.setStoryGroupListStyling(StoryGroupListStyling(sections = Int))
storylyView.setStoryGroupListStyling(StoryGroupListStyling(horizontalEdgePadding = Float))
storylyView.setStoryGroupListStyling(StoryGroupListStyling(verticalEdgePadding = Float))
storylyView.setStoryGroupListStyling(StoryGroupListStyling(horizontalPaddingBetweenItems = Float))
storylyView.setStoryGroupListStyling(StoryGroupListStyling(verticalPaddingBetweenItems = Float))
Tip
Orientation: This is set as .Horizontal by default, if you'd like to have a vertical, grid-like view of Story Groups, you can set it as .Vertical.
Sections: Based on the orientation, it's the row count of Story Groups for horizontal orientation or column count of Story Groups for vertical orientation.
Horizontal Edge Padding: Edge padding value of the first and last Story Groups for horizontal orientation.
Vertical Edge Padding: Edge padding value of the first and last Story Groups for vertical orientation.
Horizontal Padding Between Items: Horizontal padding value between Story Groups.
Vertical Padding Between Items: Vertical padding value between Story Groups.
Warning
You should set pixel values for the variables of
StoryGroupListStyling
.
Story Group Thematic Icon Image
This feature lets you use different story groups images for different labels. If you set dark mode images for your story groups from the Storyly dashboard, you can set a dark label to show these dark mode icons. This attribute can be specified programmatically, from the layout XML file or from attributes section of design view.
Warning
If you use the following methods to set the label without setting dark mode images from the dashboard, default group images will be used. If you already set the dark mode images but send a string label other than
dark
, again default group images will be used.
In order to set this attribute, use one of the following methods:
storylyView.setStoryGroupIconImageThematicLabel(label: String)
storylyView.setStoryGroupIconImageThematicLabel(String label)
app:storyGroupIconImageThematicLabel="dark"
In order to set this attribute from the design view, find and fill the storyGroupIconImageThematicLabel
attribute.
Story Group Animation
This attribute adds an animation to the Story Group cover.
storylyView.setStoryGroupAnimation(StoryGroupAnimation.borderAnimation | StoryGroupAnimation.disabled)
storyGroupAnimation="borderAnimation | disabled"
Warning
Story Group Animation is enabled by default. To disable it, you need to set it as
disabled
.


Warning
- Story Group animation applies to all Story Groups.
- Story Group animation is not available for Custom Story Group Styling.
Storyly Layout Direction
This attribute changes the layout direction of the Storyly Bar. Storyly Bar can either be LTR (Left to right) or RTL (Right to left). If your UI is bidirectional and it changes depending on the device or app language you can use this attribute.
setStorylyLayoutDirection(StorylyLayoutDirection.LTR | StorylyLayoutDirection.RTL)
storylyLayoutDirection=“ltr | rtl”
Warning
Storyly will use the LTR layout if the
StorylyLayoutDirection
is not set.
Warning
To declare your app is willing to support right-to-left (RTL) layout, you need to set android:supportsRtl="true" in your app.
Story View Customizations
This section shows supported customizations on story view.
Storyly View Header Text Color
This attribute changes the header text color of the story view. This attribute can be specified programmatically, from the layout XML file or from attributes section of design view.
In order to set this attribute, use one of the following methods:
storylyView.setStoryItemTextColor(color: Int)
storylyView.setStoryItemTextColor(Int color)
app:storyItemTextColor="@android:color/<color>"
or
app:storyItemTextColor="#RGBA"
In order to set this attribute from the design view, find and fill the storyItemTextColor
attribute.
Storyly View Header Icon Border Color
This attribute changes the header icon border color of the story view. The border consists of color gradients. This attribute can be specified programmatically, from the layout XML file or from attributes section of design view.
Warning
At least 2 colors must be defined in order to use this attribute. If a single color is requested, a same color code can be used twice.
In order to set this attribute, use one of the following methods:
storylyView.setStoryItemIconBorderColor(colors: Array<Int>)
storylyView.setStoryItemIconBorderColor(Integer[] color)
<!--First define an array of color code items as a resource:-->
<array name="storyItemBorderColors">
<item>#FFDBDBDB</item>
<item>#FFDBDBDB</item>
</array>
<!--Then give the name of the array as reference as a StorylyView attribute:-->
app:storyItemIconBorderColor="@<location>/storyItemBorderColors"
In order to set this attribute from the design view, find and fill the storyItemIconBorderColor
attribute as an array of color codes.
Storyly View Progress Bar Color
This attribute changes the progress bar colors, two colors, of the story view. The first defined color is the color of the background bars and the second one is the color of the foreground bars while watching the stories. This attribute can be specified programmatically, from the layout XML file or from attributes section of design view.
Warning
Only 2 colors must be defined in order to use this attribute.
In order to set this attribute, use one of the following methods:
storylyView.setStoryItemProgressBarColor(colors: Array<Int>)
storylyView.setStoryItemProgressBarColor(Integer[] color)
<!--First define an array of color code items as a resource:-->
<array name="progressBarColors">
<item>#CCCCCCCC</item>
<item>#FFFFFFFF</item>
</array>
<!--Then give the name of the array as reference as a StorylyView attribute:-->
app:storyItemProgressBarColor="@<location>/progressBarColors"
In order to set this attribute from the design view, find and fill the storyItemProgressBarColor
attribute as an array of color codes.
Storyly View Header Icon and Text Visibility
This styling changes the visibility of story group text. This attribute can be specified programmatically, from the layout XML file or from attributes section of design view.
In order to set this attribute, use one of the following methods:
storylyView.setStoryHeaderStyling(storyHeaderStyling: StoryHeaderStyling)
storylyView.setStoryHeaderStyling(StoryHeaderStyling storyHeaderStyling)
<!--Takes a boolean true or false, default is true-->
app:storyHeaderIconIsVisible=""
app:storyHeaderTextIsVisible=""
In order to set these attributes from design view, find and fill the storyHeaderIconIsVisible
and storyHeaderTextIsVisible
attributes.
Storyly View Header Close and Share Icon Styling
This styling changes the visibility and icon of story header close icon and share icon.
This attributes can be specified programmatically with StoryHeaderStyling, from the layout XML file or from attributes section of design view.
In order to set this attribute, use one of the following methods:
storylyView.setStoryHeaderStyling(storyHeaderStyling: StoryHeaderStyling)
storylyView.setStoryHeaderStyling(StoryHeaderStyling storyHeaderStyling)
<!--Takes a boolean true or false, default is true-->
app:storyHeaderCloseButtonIsVisible=""
<!--Takes a drawable, if not set use default drawables-->
app:storyHeaderCloseButtonIcon=""
app:storyHeaderShareButtonIcon=""
In order to set these attributes from design view, find and fill the storyHeaderCloseButtonIsVisible
, storyHeaderCloseButtonIcon
and storyHeaderShareButtonIcon
attributes.
Storyly View Header Text Typeface
This attribute changes the typeface of the story view header text. This attribute can only be specified programmatically.
In order to set this attribute, use one of the following methods:
storylyView.setStoryItemTextTypeface(typeface: Typeface)
storylyView.setStoryItemTextTypeface(Typeface typeface)
Storyly View Loading View
This customization changes the default loading view to the desired custom loading view. In order to change this view, you need to prepare your own loading view, which must inherit from StorylyLoadingView
. You can see an example class in the following code snippet:
class LoadingView(view: View, context: Context) : StorylyLoadingView(context) {
init {
addView(view)
}
override fun show() {
this.external_loading.visibility = View.VISIBLE
}
override fun hide() {
this.external_loading.visibility = View.GONE
}
}
class LoadingView extends StorylyLoadingView {
private View view;
public LoadingView(View view, Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.view = view;
addView(view);
}
@Override
public void hide() {
this.view.setVisibility(INVISIBLE);
}
@Override
public void show() {
this.view.setVisibility(VISIBLE);
}
}
After you create your custom loading view, set it by using the following methods:
storylyView.storylyLoadingView = <your instance of StorylyLoadingView subclass>
storyly_view.setStorylyLoadingView(StorylyLoadingView storylyLoadingView);
Storyly View Interactive Font
This attribute changes the typeface of all text view's font in interactive components. This attribute can only be specified programmatically.
In order to set this attribute, use one of the following methods:
storylyView.setStoryInteractiveTextTypeface(typeface: Typeface)
storylyView.setStoryInteractiveTextTypeface(Typeface typeface)
Warning
Storyly will use Typeface.Default if custom font is not set.
Warning
Storyly will arrange font size for each text view in interactive components so that custom font size arrangement is not possible.
Custom Story Group Styling
Warning
This section is valid if you are using Storyly SDK version 1.16.0 or higher.
This guide shows you how to customize the story group view's style. Storyly provides three different pre-defined story group styles; Small
, Large
and Custom
. However, if you want to use different style other than these pre-defined ones or if pre-defined ones do not satisfy your expectations then you should follow this section.
Warning
If you are using pre-defined sizes and want to apply only some customizations, follow UI Customizations section.
Story Group View Factory
You need to set storyGroupViewFactory
field of StorylyView
as a start point of the setup. You need to create a class that is subclass of StoryGroupViewFactory
and implement createView
function.
// Assume we have a StorylyView instance called storylyView
storylyView.storyGroupViewFactory = SampleViewFactory(context)
class SampleViewFactory(val context: Context): StoryGroupViewFactory() {
override fun createView(): StoryGroupView {
return SampleView(context)
}
}
StoryGroupViewFactory
calls createView
function whenever a new view is required. It will request an instance of your view for each of the story groups while creating the StorylyView
. Therefore, each story group is associated with different instances of your view. Note that, Storyly SDK uses RecyclerView to show lists so that a new view is not required for each time, recycled views will be used.
Story Group View
StoryGroupView
class is used to represent the view that will be shown as a single story group. In order to use your own custom view, your view should be subclass of StoryGroupView
class and implement its functions;
class SampleView(context: Context) : StoryGroupView(context) {
private val sampleViewBinding: SampleViewBinding = SampleViewBinding.inflate(LayoutInflater.from(context))
init {
addView(sampleViewBinding.root)
layoutParams = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)
}
override fun populateView(storyGroup: StoryGroup?) {
// Handle populating view with Storyly related data
// ie, sampleViewBinding.sampleText.text = storyGroup?.title
}
}
populateView
function is called when your view is about to be shown. Its storyGroup
parameter has all of the information that you provided in Storyly dashboard for your story groups. You can find the details of the StoryGroup
below:
data class StoryGroup(
val id: Int,
val title: String,
val iconUrl: String,
val thematicIconUrls: Map<String, String>?,
val coverUrl: String?,
val index: Int,
val seen: Boolean,
val stories: List<Story>,
val pinned: Boolean,
val type: StoryGroupType
)
Tip
You can find the explanation of each field from the API Reference section.
Tip
Please check the this github page for implemented samples.
Warning Additional data
Do not forget to use additional fields of the
storyGroup
parameter of thepopulateView
function. For instance, if you want to show pinned groups, you can usepinned
field of the object or if you want to show IVOD(Interactive VideOnDemand) groups, you can use thetype
field of the object.
Summary
To sum up, in order to use your own custom group style, you need to follow the steps below:
- Create your own custom style in XML or programmatically.
- Use this style in a class that is subclass of
StoryGroupView
by inflating the XML and adding its view or by adding views programmatically. - Override
populateView
function in the previous class you defined and by using the data instoryGroup
parameter, fill your UI components. - Create a subclass of
StoryGroupViewFactory
in order to serve as your factory. - Override
createView
function in the previous class you defined and return a new instance of yourStoryGroupView
subclass. - Create a new instance of
StoryGroupViewFactory
subclass and setstoryGroupViewFactory
variable of the StorylyView with this instance.
Updated 8 days ago