Skip to main content
Version: 1.1.7

ThumbView

This option allows you to display our custom widget that display stories in an horizontal scrollable view with a Instagram-like UI.

Layout

You first need to add our scaffold view and player view within your Activity/Fragment layout:

<com.joinstoriessdk.androidsdk.ui.StoryScaffoldView
android:id="@+id/story_scaffold"
android:layout_width="0dp"
android:layout_height="144dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<com.joinstoriessdk.androidsdk.ui.player.StoryPlayer
android:id="@+id/story_player"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

Trigger

To start the display of our thumbView widget, you need to call the startThumbView method:

JoinStories.startThumbView(
joinStoriesThumbConfig,
lifecycleScope,
container_view,
story_player,
story_scaffold,
listener
)
ParameterTypeRequiredDescription
joinStoriesThumbConfigJoinStoriesThumbConfigYESThe configuration object, that requires at least the JOIN Stories alias you were given
lifecycleScopeLifecycleCoroutineScopeYESA lifecycle scope bounded to Android component containing the StoryPlayer and the StoryScaffoldView implemented previously
containerViewViewYESThe root view containing the StoryPlayer and the StoryScaffoldView implemented previously. It will only use its bounds to animate the player appearance/disappearance
storyPlayerStoryPlayerYESThe StoryPlayer implemented previously
storyScaffoldViewStoryScaffoldViewYESThe StoryScaffoldView implemented previously
listenerJoinStoriesListenerNOA listener allowing you to be notified when an error occured while fetching stories

Configuration

You can fine tune SDK behavior and UI, by specifying optional values of the JoinStoriesThumbConfig parameter.

Available configuration parameters:

NameTypeDefault ValueDescription
joinAliasStringThe JOIN Stories alias you were given to configure your integration
timeoutLong10Timeout used for the stories fetching network requests (call and read)
typefaceTypefacenullThumb views label custom font (withLabel should be true)
labelColorIntColor. BLACKThumb views label custom text color (withLabel should be true)
thumbViewSpacingInt32Spacing between thumb views
withLabelBooleantrueShow/hide text below each thumb view
loaderInnerViewWidthInt8Spacing between the image and the loader in a thumb view
loaderInnerViewColorIntArrayintArrayOf (Color. TRANSPARENT)Color between the image and the loader in a thumb view
loaderColorsIntArrayintArrayOf (Color. RED , Color. BLUE)Colors of the thumb view loader. A sweep gradient will be applied on it
loaderWidthInt8Width of the thumb view loader
storyViewedIndicatorColorIntColor. GRAYColor of the thumb view indicator displayed when a story has been viewed by the user
storyViewedIndicatorAlphaInt80Alpha of the thumb view indicator displayed when a story has been viewed by the user. Range [0..255]
thumbViewOverlayColorIntColor.parseColor( "#BB4C4C4C")Color of the overlay displayed on the thumb view image when a story was selected by the user and is loading
playerBackgroundColorIntColor.BLACKColor of the player's background, if the player height is smaller than screen dimensions
playerVerticalAnchorPlayerVerticalAnchor.BOTTOMIf the player's height is smaller than screen height, anchor it to the top, bottom or center of the scren
playerShowShareButtonBooleantrueChange the visibility of the share button displayed on the Player view
playerClosingButtonBooleantrueChange the visibility of the close button displayed on the Player view
playerHorizontalMarginsInt0Apply the margin to the left and right of the player view. To maintain ratio, it also changes the height of the player view.
playerCornerRadiusFloat0fApply radius to the 4 corners of the player view
playerProgressBarDefaultColorString?nullChange the background color of the progress bar in the player view. If no value or null is filled, the default color will be used. Format is ##RRGGBB or #RRGGBBAA
playerProgressBarFillColorString?nullChange the fill color of the progress bar in the player view. If no value or null is filled, the default color will be used. Format is ##RRGGBB or #RRGGBBAA
playerProgressBarThicknessInt?nullChange the thickness of the progress bar in the player view. If no value or null is filled, the default thickness will be used.
playerProgressBarRadiusInt?nullChange the radius of the progress bar in the player view. If no value or null is filled, the default thickness will be used. Radius will be applied to the 4 corners.

Multiple widgets

You can implement our thumbView widget multiple times on the same screen, with the same or different join alias.

To do so, you need to implement n StoryScaffoldView within your UI, and call the startThumbView method n times, one for each instance of StoryScaffoldView.