-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
**What** Create storyblock example app **Why** - ASDK-1397 **How** Create app with single screen which hosts the Storyblock. **Screenshots** <!-- Before and After screenshots if it is a UI change --> | Collapsed | Fullscreen | |-----------|-----------| |  |  |
- Loading branch information
1 parent
bef0856
commit 6564836
Showing
36 changed files
with
814 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Story Block CI | ||
|
||
concurrency: | ||
group: story_block:${{ github.head_ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
pull_request: | ||
branches: [ "main" ] | ||
paths: [ "story_block/**" ] | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
cache: gradle | ||
|
||
- name: Build with Gradle | ||
run: | | ||
cd story_block | ||
chmod +x ./gradlew | ||
./gradlew build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
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.storyblock" | ||
|
||
compileSdk = 33 | ||
|
||
defaultConfig { | ||
applicationId = "com.firework.example.storyblock" | ||
|
||
minSdk = 21 | ||
targetSdk = 33 | ||
|
||
versionCode = 1 | ||
versionName = "1.0.0" | ||
} | ||
|
||
buildTypes { | ||
defaultConfig { | ||
buildConfigField("String", "FW_CLIENT_ID", "\"f6d6ec1275217f178cdff91363825cb390e038c1168f64f6efa23cb95ec6b325\"") | ||
buildConfigField("String", "FW_CHANNEL_ID", "\"7RXwK8k\"") | ||
buildConfigField("String", "FW_PLAYLIST_ID", "\"g4lA0g\"") | ||
} | ||
release { | ||
isMinifyEnabled = false | ||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") | ||
} | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
kotlinOptions { | ||
allWarningsAsErrors = true | ||
jvmTarget = JavaVersion.VERSION_1_8.toString() | ||
} | ||
|
||
lint { | ||
abortOnError = true | ||
ignoreWarnings = false | ||
warningsAsErrors = true | ||
} | ||
|
||
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("com.google.android.material:material:1.8.0") | ||
|
||
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.13.2") | ||
|
||
// Firework SDK | ||
val fireworkSdkVersion = "6.1.0" | ||
implementation("com.firework:sdk:$fireworkSdkVersion") | ||
|
||
// Glide (optional image loader) | ||
implementation("com.firework.external.imageloading:glide:$fireworkSdkVersion") | ||
|
||
// Picasso (optional image loader) | ||
// implementation("com.firework.external.imageloading:picasso:$fireworkSdkVersion") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> | ||
|
||
<application | ||
android:name="com.firework.example.storyblock.ExampleApplication" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.FireworkExample"> | ||
|
||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
</application> | ||
|
||
</manifest> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions
34
story_block/app/src/main/java/com/firework/example/storyblock/ExampleApplication.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.firework.example.storyblock | ||
|
||
import android.app.Application | ||
import android.util.Log | ||
import com.firework.example.storyblock.BuildConfig.FW_CLIENT_ID | ||
import com.firework.imageloading.glide.GlideImageLoaderFactory | ||
import com.firework.sdk.FireworkSdk | ||
import com.firework.sdk.FireworkSdkConfig | ||
|
||
class ExampleApplication : Application() { | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
|
||
// build Firework Android SDK v6 configuration | ||
val config = FireworkSdkConfig.Builder(this) | ||
.checksumRequired(false) | ||
.clientId(FW_CLIENT_ID) // Client OAUTH Id | ||
.userId("example app user ID") // User Id in your eco-system | ||
.imageLoader(GlideImageLoaderFactory.createInstance()) // glide, picasso, or your implementation | ||
.build() | ||
|
||
// initialize Firework Android SDK v6 | ||
FireworkSdk.init( | ||
fireworkSdkConfig = config, | ||
onSuccess = { | ||
Log.i("FireworkSDK", "Firework SDK initialized successfully") | ||
}, | ||
onError = { initError -> | ||
Log.e("FireworkSDK", "Error initializing Firework - $initError") | ||
}, | ||
) | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
story_block/app/src/main/java/com/firework/example/storyblock/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.firework.example.storyblock | ||
|
||
import android.os.Bundle | ||
import android.util.Log | ||
import androidx.appcompat.app.AppCompatActivity | ||
import com.firework.common.PlayerMode | ||
import com.firework.common.feed.FeedResource | ||
import com.firework.example.storyblock.databinding.ActivityMainBinding | ||
import com.firework.viewoptions.baseOptions | ||
import com.firework.viewoptions.playerOptions | ||
import com.firework.viewoptions.viewOptions | ||
|
||
class MainActivity : AppCompatActivity() { | ||
private lateinit var binding: ActivityMainBinding | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = ActivityMainBinding.inflate(layoutInflater) | ||
|
||
setContentView(binding.root) | ||
|
||
binding.storyBlock.init( | ||
supportFragmentManager, | ||
lifecycle, | ||
viewOptions { | ||
baseOptions { | ||
feedResource(FeedResource.Discovery) | ||
} | ||
playerOptions { | ||
playerMode(PlayerMode.FIT_MODE) | ||
} | ||
}, | ||
binding.storyBlockContainer, | ||
) | ||
binding.storyBlock.setOnErrorListener { | ||
Log.i("StoryBlock-Fragment", it.toString()) | ||
} | ||
binding.btnPlay.setOnClickListener { | ||
binding.storyBlock.play() | ||
} | ||
|
||
binding.btnPause.setOnClickListener { | ||
binding.storyBlock.pause() | ||
} | ||
binding.storyBlock.setFeedLoadListener { | ||
Log.i("StoryBlock", it.toString()) | ||
} | ||
} | ||
} |
Oops, something went wrong.