Skip to content

Commit

Permalink
ASDK-2382: Add language example app (#82)
Browse files Browse the repository at this point in the history
**What**
- Adding the language example app

**Why**
- ASDK-2382


Signed-off-by: Mohsen Mirhoseini <[email protected]>
  • Loading branch information
Mohsen Mirhoseini authored Feb 16, 2024
1 parent f201564 commit 28e4fba
Show file tree
Hide file tree
Showing 39 changed files with 1,069 additions and 26 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/language.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Language CI

concurrency:
group: language:${{ github.head_ref }}
cancel-in-progress: true

on:
pull_request:
branches: [ "main" ]
paths: [ "language/**" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Build with Gradle
run: |
cd language
chmod +x ./gradlew
./gradlew build
71 changes: 45 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Firework Android SDK Examples ![GitHub Release](https://img.shields.io/github/v/release/loopsocial/firework-android-sdk-examples?label=GitHub%20Release)

This repo holds the Firework Android SDK example applications.

**List of example apps:**
Expand Down Expand Up @@ -31,7 +32,7 @@ The view options can be set in 3 different methods:
[View Options example app](view_options)

| Customized View Options | Player screen |
| -------------------------------------------------------- | -------------------------------------------------------- |
|----------------------------------------------------------|----------------------------------------------------------|
| ![View Options Screenshot](view_options/Screenshot1.png) | ![View Options Screenshot](view_options/Screenshot2.png) |

---
Expand Down Expand Up @@ -60,34 +61,35 @@ container on the runtime.

[Feed Resources example app](feed_resources)

In this example app, the `FwVideoFeedView` is initialized with different feedResources: Discovery, Playlist, Channel, Dynamic Content, Channel Hashtags.
In this example app, the `FwVideoFeedView` is initialized with different feedResources: Discovery, Playlist, Channel, Dynamic Content, Channel
Hashtags.

| Discovery Feed | Player screen |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| Discovery Feed | Player screen |
|------------------------------------------------------------------|------------------------------------------------------------------|
| ![discovery Screenshot](feed_resources/DiscoveryScreenshot1.png) | ![discovery Screenshot](feed_resources/DiscoveryScreenshot2.png) |

| Channel Feed | Player screen |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
|--------------------------------------------------------------|--------------------------------------------------------------|
| ![channel Screenshot](feed_resources/ChannelScreenshot1.png) | ![channel Screenshot](feed_resources/ChannelScreenshot2.png) |

| Playlist Feed | Player screen |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| Playlist Feed | Player screen |
|----------------------------------------------------------------|----------------------------------------------------------------|
| ![playlist Screenshot](feed_resources/PlaylistScreenshot1.png) | ![playlist Screenshot](feed_resources/PlaylistScreenshot2.png) |

| Dynamic Feed | Player screen |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
|--------------------------------------------------------------|--------------------------------------------------------------|
| ![dynamic Screenshot](feed_resources/DynamicScreenshot1.png) | ![dynamic Screenshot](feed_resources/DynamicScreenshot2.png) |

| Channel Hashtags Feed | Player screen |
|--------------------------------------------------------------------------------|-------------------------------------------------------------------------------|
| Channel Hashtags Feed | Player screen |
|--------------------------------------------------------------------------------|--------------------------------------------------------------------------------|
| ![channel_hashtags Screenshot](feed_resources/ChannelHashtagsScreenshot1.jpeg) | ![channel_hashtags Screenshot](feed_resources/ChannelHashtagsScreenshot2.jpeg) |

| Sku Feed | Player screen |
|--------------------------------------------------------------------------------|-------------------------------------------------------------------------------|
| Sku Feed | Player screen |
|-------------------------------------------------------|-------------------------------------------------------|
| ![sku Screenshot](feed_resources/SkuScreenshot1.jpeg) | ![sku Screenshot](feed_resources/SkuScreenshot2.jpeg) |

| Single Content Feed | Player screen |
|--------------------------------------------------------------------------------|-------------------------------------------------------------------------------|
| Single Content Feed | Player screen |
|---------------------------------------------------------------------------|---------------------------------------------------------------------------|
| ![Single Content Screenshot](feed_resources/SingleContentScreenshot1.png) | ![Single Element Screenshot](feed_resources/SingleContentScreenshot2.png) |

---
Expand All @@ -100,8 +102,8 @@ You need a feed resource with a Single Host Livestream item.

[Single-Host Livestream example app](single_host_livestream)

| Livestream Feed | Livestream Player | Livestream Features |
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| Livestream Feed | Livestream Player | Livestream Features |
|------------------------------------------------------------------------------|------------------------------------------------------------------------------|------------------------------------------------------------------------------|
| ![single host livestream Screenshot](single_host_livestream/Screenshot1.png) | ![single host livestream Screenshot](single_host_livestream/Screenshot2.png) | ![single host livestream Screenshot](single_host_livestream/Screenshot3.png) |

---
Expand All @@ -114,8 +116,8 @@ You need a feed resource with a Multiple Host Livestream item.

[Multi-Host Livestream example app](multi_host_livestream)

| Livestream Feed | Livestream Player | Livestream Features |
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| Livestream Feed | Livestream Player | Livestream Features |
|----------------------------------------------------------------------------|----------------------------------------------------------------------------|----------------------------------------------------------------------------|
| ![multi host livestream Screenshot](multi_host_livestream/Screenshot1.png) | ![multi host livestream Screenshot](multi_host_livestream/Screenshot2.png) | ![multi host livestream Screenshot](multi_host_livestream/Screenshot3.png) |

---
Expand All @@ -131,12 +133,12 @@ The app has two screens which demonstrate how to setup shopping for "Shopping ca
|--------------------------------------------------|--------------------------------------------------|
| ![shopping Screenshot](shopping/Screenshot1.png) | ![shopping Screenshot](shopping/Screenshot2.png) |


| Shopping cart mode | Shop now mode |
|---------------------------------------------------|---------------------------------------------------|
| ![shopping Screenshot](shopping/Screenshot3.jpeg) | ![shopping Screenshot](shopping/Screenshot4.jpeg) |

---

## Share link example app

[Share link example app](share_link)
Expand All @@ -149,9 +151,12 @@ It contains two activities:

Also, this example demonstrates how to replace the base URL of the shared video with a custom one.

**Note**: [Starting in Android 12 (API level 31)](https://developer.android.com/about/versions/12/behavior-changes-all#web-intent-resolution), a generic web intent resolves to an activity in your app only if your app is approved for the specific domain contained in that web intent. If your app isn't approved for the domain, the web intent resolves to the user's default browser app instead.
**Note**: [Starting in Android 12 (API level 31)](https://developer.android.com/about/versions/12/behavior-changes-all#web-intent-resolution), a
generic web intent resolves to an activity in your app only if your app is approved for the specific domain contained in that web intent. If your app
isn't approved for the domain, the web intent resolves to the user's default browser app instead.

---

## Picture-in-picture example app

In this example app, the `FwVideoFeedView` is initialized with the picture-in-picture feature enabled.
Expand All @@ -164,19 +169,20 @@ The user can switch to the PiP mode if the device supports and this feature is n

[Picture-in-picture example app](picture_in_picture )

| PiP Feed | Player screen in PiP mode |
| ----------------------------------------------------- | ------------------------------------------------------------ |
| PiP Feed | Player screen in PiP mode |
|-------------------------------------------------------|----------------------------------------------------------------------|
| ![pip Screenshot](picture_in_picture/Screenshot1.png) | ![player in pip mode Screenshot](picture_in_picture/Screenshot2.png) |

---

## Jetpack Compose example app

In this example app, the `FwVideoFeedView` is initialized for showing a discovery feed using Jetpack Compose.

[Jetpack Compose example app](compose)

| Discovery Feed | Player screen |
| ------------------------------------------------ | --------------------------------------------- |
|--------------------------------------------------|-----------------------------------------------|
| ![discovery Screenshot](compose/Screenshot1.png) | ![player Screenshot](compose/Screenshot2.png) |

---
Expand All @@ -188,8 +194,21 @@ This component allows to embed pager player directly in the host app's view hier

[Story block example app](story_block)

| Story block | Fullscreen Story Block |
|---------------------------------------------------------|-----------------------------------------------------------|
| ![Story block example app](story_block/Screenshot1.jpeg) | ![Story block example app](story_block/Screenshot2.jpeg) |
| Story block | Fullscreen Story Block |
|----------------------------------------------------------|----------------------------------------------------------|
| ![Story block example app](story_block/Screenshot1.jpeg) | ![Story block example app](story_block/Screenshot2.jpeg) |

---

## Language example app

This example app demonstrates how the host app can change the SDK language.
The SDK Views follow the host app context language so any changes to the host app language will be applied to SDK, too.

[Language example app](language)

| Language Selector | Supported Languages |
|----------------------------------------------------|-------------------------------------------------------|
| ![Language example app](language/Screenshot1.jpeg) | ![language example app](story_block/Screenshot2.jpeg) |

---
25 changes: 25 additions & 0 deletions language/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# SOURCE: https://github.com/JetBrains/kotlin-playground/blob/master/.editorconfig
root = true


[*]
indent_style = space
indent_size = 4

max_line_length = 150

end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

ij_continuation_indent_size = 4
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true
ij_kotlin_spaces_around_equality_operators = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
46 changes: 46 additions & 0 deletions language/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# SOURCE: https://github.com/github/gitignore/blob/master/Android.gitignore

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Log/OS Files
*.log

# Android Studio generated files and folders
captures/
.externalNativeBuild/
.cxx/
*.apk
*.ap_
*.aab
*.aar
output.json

# IntelliJ
*.iml
.idea/*
!.idea/codeStyles/
!.idea/detekt.xml
misc.xml
deploymentTargetDropDown.xml
render.experimental.xml

# Keystore files
# *.jks
# *.keystore

# Google Services (e.g. APIs or Firebase)
# google-services.json

# Android Profiling
*.hprof

# Windows thumbnail db
Thumbs.db

# OSX files
.DS_Store
Binary file added language/Screenshot1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added language/Screenshot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions language/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
83 changes: 83 additions & 0 deletions language/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("org.jlleitschuh.gradle.ktlint")
id("io.gitlab.arturbosch.detekt")
}

android {
namespace = "com.firework.example.language"

compileSdk = 34

defaultConfig {
applicationId = "com.firework.example.language"

minSdk = 21
targetSdk = 34

versionCode = 1
versionName = "1.0.0"
}

buildTypes {
defaultConfig {
buildConfigField("String", "FW_CLIENT_ID", "\"f6d6ec1275217f178cdff91363825cb390e038c1168f64f6efa23cb95ec6b325\"")
buildConfigField("String", "FW_CHANNEL_ID", "\"o8l83w\"")
buildConfigField("String", "FW_PLAYLIST_ID", "\"g4lA0g\"")
}
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
allWarningsAsErrors = true
jvmTarget = JavaVersion.VERSION_17.toString()
}

lint {
abortOnError = true
ignoreWarnings = false
warningsAsErrors = true

disable.apply {
add("AppBundleLocaleChanges")
}
}

buildFeatures {
viewBinding = true
}
}

detekt {
allRules = true
config = files("$rootDir/config/detekt/detekt-config.yml")
baseline = file("detekt-baseline.xml")
buildUponDefaultConfig = true
}

dependencies {
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")

implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.6.10"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")

// Glide
implementation("com.github.bumptech.glide:glide:4.16.0")

// Firework SDK
val fireworkBomVersion = "2024.02.07"
implementation(platform("com.firework:firework-bom:$fireworkBomVersion"))
implementation("com.firework:sdk")
implementation("com.firework.external.imageloading:glide") // Glide (optional image loader)
// implementation("com.firework.external.imageloading:picasso") // Picasso (optional image loader)
}
21 changes: 21 additions & 0 deletions language/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Loading

0 comments on commit 28e4fba

Please sign in to comment.