Android Style

Currently, some styles can't be configured through JS codes on the Android side. But these styles can be configured through res/values/styles.xml, as shown below.

Configure style for video feed

<!--Configure the radius of thumbnails-->
<style name="FWFeedViewImageStyle" >
  <item name="android:radius">12dp</item>
</style>

<!--Configure the style of video feed title-->
<style name="FWFeedViewCaptionStyle">
  <item name="android:textColor">#ffffffff</item>
  <item name="android:textSize">14sp</item>
  <item name="android:gravity">top</item>
  <item name="android:paddingLeft">8dp</item>
  <item name="android:paddingRight">8dp</item>
  <item name="android:background">#80000000</item>
</style>
  
<!--Configure the style of play button on the thumbnails-->
<style name="FWPlayButtonStyle" >
  <item name="android:layout_width">40dp</item>
  <item name="android:layout_height">40dp</item>
  <item name="android:src">@drawable/fw_play_icon</item>
</style>

<!--Configure the style of the ad badge on the thumbnails-->
<style name="FwAdBadgeOnFeedStyle">
  <item name="android:background">@null</item>
  <item name="android:textColor">@android:color/white</item>
  <item name="android:textSize">@dimen/fw_font_size_14</item>
</style>

Custom layout

Android SDK provides custom attributes to style the VideoFeed item. If you want complete control over the UI, you can provide a custom layout that will be used for displaying the VideoFeed item.

  1. Firstly, you can create a custom layout file(e.g. fw_feed_custom_layout.xml) and put it in the res/layout. Such as:

<!--fw_feed_custom_layout.xml-->
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
  android:layout_height="match_parent"
  xmlns:app="http://schemas.android.com/apk/res-auto">

  <androidx.constraintlayout.widget.ConstraintLayout
    android:layout_width="wrap_content"
    android:layout_height="match_parent">

    <com.loopnow.fireworklibrary.views.FireworkImageView
      android:id="@+id/thumbnail"
      android:layout_width="0dp"
      android:layout_height="match_parent"
      android:adjustViewBounds="true"
      android:scaleType="centerCrop"
      app:layout_constraintDimensionRatio="1:1"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="parent"/>

  </androidx.constraintlayout.widget.ConstraintLayout>

  <TextView
    android:id="@+id/caption"
    android:padding="12dp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal|bottom"
    android:visibility="gone"
    android:textColor="#ffffffff" />

  <TextView
    android:id="@+id/thumbnail_ad_badge"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:visibility="gone" />

</FrameLayout>

2. set the layout name to the VideoFeed. Such as:

<VideoFeed
  style={{ height: 200 }}
  source="discover"
  videoFeedConfiguration={{
    title: { hidden: false },
    titlePosition: 'nested',
    customLayoutName: 'fw_feed_custom_layout'
  }}
/>

Configure the style of player

<!--Configure the background color of CTA button-->
<style name="FWCtaButtonBgStyle">
  <item name="android:background">@drawable/fw_cta_bg_primary</item>
</style>

<!--Configure the style of CTA button-->
<style name="FWCtaButtonLabelStyle">
  <item name="android:textSize">14sp</item>
  <item name="android:textColor">#ffff6622</item>
</style>

<!--Configure the style of Add to cart button-->
<style name="FWAddToCartButtonStyle">
  <item name="android:background">@drawable/fw_add_to_cart_button</item>
  <item name="android:textColor">#ffffffff</item>
  <item name="android:textSize">16sp</item>
</style>

<!--Configure the style of the ad badge on the player-->
<style name="FwAdBadgeOnPlayerStyle" >
  <item name="android:background">@null</item>
  <item name="android:textColor">@android:color/white</item>
  <item name="android:textSize">@dimen/fw_font_size_16</item>
</style>

Last updated