Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Firework Android SDK to 6.13.0 #92

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compose/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ dependencies {
debugImplementation("androidx.compose.ui:ui-test-manifest")

// Firework SDK
val fireworkBomVersion = "2024.06.06"
val fireworkBomVersion = "2024.07.16"
implementation(platform("com.firework:firework-bom:$fireworkBomVersion"))
implementation("com.firework:sdk")
implementation("com.firework.external.imageloading:glide") // Glide (optional image loader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,27 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.viewinterop.AndroidView
import com.firework.common.PlayerMode
import com.firework.common.cta.CtaDelay
import com.firework.common.cta.CtaDelayUnit
import com.firework.common.cta.CtaStyle
import com.firework.common.feed.FeedLayout
import com.firework.common.feed.FeedResource
import com.firework.common.feed.FeedTitlePosition
import com.firework.common.widget.ActionButton
import com.firework.common.widget.Shape
import com.firework.common.widget.WidgetImage
import com.firework.videofeed.fwVideoFeedView
import com.firework.videofeed.viewOptions
import com.firework.viewoptions.actionButtonOptions
import com.firework.viewoptions.baseOptions
import com.firework.viewoptions.ctaOptions
import com.firework.viewoptions.layoutOptions
import com.firework.viewoptions.pipButtonOptions
import com.firework.viewoptions.playerOptions
import com.firework.viewoptions.playerUiOptions
import com.firework.viewoptions.titleOptions

class MainActivity : ComponentActivity() {
Expand All @@ -44,6 +55,7 @@ private fun VideoFeed() {
val feedTitleTextColor = MaterialTheme.colorScheme.onPrimary.hashCode()
val feedTitleBackgroundColor = MaterialTheme.colorScheme.primary.hashCode()
val backgroundColor = MaterialTheme.colorScheme.background.hashCode()
val secondaryColor = MaterialTheme.colorScheme.secondary.toArgb()

AndroidView(factory = { context ->
fwVideoFeedView(context) {
Expand All @@ -69,10 +81,43 @@ private fun VideoFeed() {
feedTitleTextSize(context.spToPx(14f))
feedTitleTextNumberOfLines(1)
}
ctaOptions {
ctaDelay(CtaDelay(0.2f, CtaDelayUnit.PERCENTAGE))
ctaStyle(
CtaStyle(
shape = Shape.SHAPE_OVAL,
backgroundColor = secondaryColor,
textColor = feedTitleTextColor,
fontSize = context.spToPx(18f).toFloat(),
),
)
}
playerOptions {
playerMode(PlayerMode.FIT_MODE)
showShareButton(true)
autoPlayOnComplete(true)
playerUiOptions {
pipButtonOptions {
icon(WidgetImage(R.drawable.ic_pip))
}
}
actionButtonOptions {
actionButton(
ActionButton(
backgroundColor = secondaryColor,
dividingLineColor = backgroundColor,
shape = Shape.SHAPE_OVAL,
textColor = feedTitleTextColor,
),
)
cancelButton(
ActionButton(
backgroundColor = secondaryColor,
shape = Shape.SHAPE_OVAL,
textColor = feedTitleTextColor,
),
)
}
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions compose/app/src/main/res/drawable/ic_pip.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#FFFFFF"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M19,11h-8v6h8v-6zM23,19L23,4.98C23,3.88 22.1,3 21,3L3,3c-1.1,0 -2,0.88 -2,1.98L1,19c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2zM21,19.02L3,19.02L3,4.97h18v14.05z" />
</vector>
2 changes: 1 addition & 1 deletion feed_integration/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ dependencies {
implementation("com.github.bumptech.glide:glide:4.16.0")

// Firework SDK
val fireworkBomVersion = "2024.06.06"
val fireworkBomVersion = "2024.07.16"
implementation(platform("com.firework:firework-bom:$fireworkBomVersion"))
implementation("com.firework:sdk")
implementation("com.firework.external.imageloading:glide") // Glide (optional image loader)
Expand Down
2 changes: 1 addition & 1 deletion feed_resources/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ dependencies {
implementation("com.github.bumptech.glide:glide:4.16.0")

// Firework SDK
val fireworkBomVersion = "2024.06.06"
val fireworkBomVersion = "2024.07.16"
implementation(platform("com.firework:firework-bom:$fireworkBomVersion"))
implementation("com.firework:sdk")
implementation("com.firework.external.imageloading:glide") // Glide (optional image loader)
Expand Down
2 changes: 1 addition & 1 deletion language/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ dependencies {
implementation("com.github.bumptech.glide:glide:4.16.0")

// Firework SDK
val fireworkBomVersion = "2024.06.06"
val fireworkBomVersion = "2024.07.16"
implementation(platform("com.firework:firework-bom:$fireworkBomVersion"))
implementation("com.firework:sdk")
implementation("com.firework.external.imageloading:glide") // Glide (optional image loader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ class LocaleStorage(context: Context) {
fun getLocale(): Locale {
val defaultLocaleLanguage: String = Locale.getDefault().language.toString()
val localeValue: String = sharedPreferences.getString(LOCALE_KEY, defaultLocaleLanguage) ?: defaultLocaleLanguage
if (localeValue.contains("_")) {
val locales = localeValue.split("_")
if (locales.size > 1) {
return Locale(locales[0], locales[1])
}
}
return Locale(localeValue)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ class MainActivity : AppCompatActivity() {
val adapter: ArrayAdapter<LocaleItem> = ArrayAdapter(this, android.R.layout.simple_spinner_item, supportedLocaleItems)
languageSpinner.adapter = adapter
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
languageSpinner.setSelection(adapter.getPosition(supportedLocaleItems.firstOrNull { it.locale == localeStorage.getLocale() }), false)
languageSpinner.setSelection(adapter.getPosition(supportedLocaleItems.firstOrNull {
it.locale.toString().equals(localeStorage.getLocale().toString(), true)
}), false)

languageSpinner.onItemSelectedListener =
object : AdapterView.OnItemSelectedListener {
Expand Down Expand Up @@ -108,11 +110,20 @@ class MainActivity : AppCompatActivity() {
listOf(
LocaleItem("English", Locale("en")),
LocaleItem("Arabic", Locale("ar")),
LocaleItem("Spanish", Locale("es")),
LocaleItem("Persian", Locale("fa")),
LocaleItem("Arabic (Saudi Arabia)", Locale("ar", "SA")),
LocaleItem("Arabic (United Arab Emirates)", Locale("ar", "AE")),
LocaleItem("German", Locale("de")),
LocaleItem("Italian", Locale("it")),
LocaleItem("Japanese", Locale("ja")),
LocaleItem("Polish", Locale("pl")),
LocaleItem("Portuguese", Locale("pt")),
LocaleItem("Portuguese (Brazil)", Locale("pt", "BR")),
LocaleItem("Russian", Locale("ru")),
LocaleItem("Spanish", Locale("es")),
LocaleItem("Spanish (Mexico)", Locale("es", "MX")),
LocaleItem("Spanish (Colombia)", Locale("es", "CO")),
LocaleItem("Vietnamese", Locale("vi")),
LocaleItem("Thailand", Locale("th")),
LocaleItem("Persian", Locale("fa")),
)
}
}
2 changes: 1 addition & 1 deletion multi_host_livestream/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ dependencies {
implementation("com.github.bumptech.glide:glide:4.16.0")

// Firework SDK
val fireworkBomVersion = "2024.06.06"
val fireworkBomVersion = "2024.07.16"
implementation(platform("com.firework:firework-bom:$fireworkBomVersion"))
implementation("com.firework:sdk")
implementation("com.firework.external.imageloading:glide") // Glide (optional image loader)
Expand Down
2 changes: 1 addition & 1 deletion picture_in_picture/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ dependencies {
implementation("com.github.bumptech.glide:glide:4.16.0")

// Firework SDK
val fireworkBomVersion = "2024.06.06"
val fireworkBomVersion = "2024.07.16"
implementation(platform("com.firework:firework-bom:$fireworkBomVersion"))
implementation("com.firework:sdk")
implementation("com.firework.external.imageloading:glide") // Glide (optional image loader)
Expand Down
2 changes: 1 addition & 1 deletion share_link/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ dependencies {
implementation("com.github.bumptech.glide:glide:4.16.0")

// Firework SDK
val fireworkBomVersion = "2024.06.06"
val fireworkBomVersion = "2024.07.16"
implementation(platform("com.firework:firework-bom:$fireworkBomVersion"))
implementation("com.firework:sdk")
implementation("com.firework.external.imageloading:glide") // Glide (optional image loader)
Expand Down
2 changes: 1 addition & 1 deletion shopping/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ dependencies {
implementation("com.github.bumptech.glide:glide:4.16.0")

// Firework SDK
val fireworkBomVersion = "2024.06.06"
val fireworkBomVersion = "2024.07.16"
implementation(platform("com.firework:firework-bom:$fireworkBomVersion"))
implementation("com.firework:sdk")
implementation("com.firework.external.imageloading:glide") // Glide (optional image loader)
Expand Down
2 changes: 1 addition & 1 deletion single_host_livestream/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ dependencies {
implementation("com.github.bumptech.glide:glide:4.16.0")

// Firework SDK
val fireworkBomVersion = "2024.06.06"
val fireworkBomVersion = "2024.07.16"
implementation(platform("com.firework:firework-bom:$fireworkBomVersion"))
implementation("com.firework:sdk")
implementation("com.firework.external.imageloading:glide") // Glide (optional image loader)
Expand Down
2 changes: 1 addition & 1 deletion story_block/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ dependencies {
implementation("com.github.bumptech.glide:glide:4.16.0")

// Firework SDK
val fireworkBomVersion = "2024.06.06"
val fireworkBomVersion = "2024.07.16"
implementation(platform("com.firework:firework-bom:$fireworkBomVersion"))
implementation("com.firework:sdk")
implementation("com.firework.external.imageloading:glide") // Glide (optional image loader)
Expand Down
2 changes: 1 addition & 1 deletion view_options/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ dependencies {
implementation("com.github.bumptech.glide:glide:4.16.0")

// Firework SDK
val fireworkBomVersion = "2024.06.06"
val fireworkBomVersion = "2024.07.16"
implementation(platform("com.firework:firework-bom:$fireworkBomVersion"))
implementation("com.firework:sdk")
implementation("com.firework.external.imageloading:glide") // Glide (optional image loader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,25 @@ import com.firework.common.PlayerMode
import com.firework.common.ad.AdBadgeTextType
import com.firework.common.cta.CtaDelay
import com.firework.common.cta.CtaDelayUnit
import com.firework.common.cta.CtaStyle
import com.firework.common.feed.FeedLayout
import com.firework.common.feed.FeedResource
import com.firework.common.feed.FeedTitlePosition
import com.firework.common.widget.ActionButton
import com.firework.common.widget.Shape
import com.firework.common.widget.WidgetImage
import com.firework.example.viewoptions.databinding.ActivityMainBinding
import com.firework.videofeed.FwVideoFeedView
import com.firework.viewoptions.ViewOptions
import com.firework.viewoptions.actionButtonOptions
import com.firework.viewoptions.adBadgeOptions
import com.firework.viewoptions.adOptions
import com.firework.viewoptions.baseOptions
import com.firework.viewoptions.ctaOptions
import com.firework.viewoptions.layoutOptions
import com.firework.viewoptions.pipButtonOptions
import com.firework.viewoptions.playerOptions
import com.firework.viewoptions.playerUiOptions
import com.firework.viewoptions.titleOptions
import com.firework.viewoptions.viewOptions

Expand Down Expand Up @@ -90,6 +97,14 @@ class MainActivity : AppCompatActivity() {

ctaOptions {
ctaDelay(CtaDelay(0.2f, CtaDelayUnit.PERCENTAGE))
ctaStyle(
CtaStyle(
shape = Shape.SHAPE_OVAL,
backgroundColor = getContextCompatColor(R.color.purple_200),
textColor = getContextCompatColor(R.color.cyan),
fontSize = spToPx(18f).toFloat(),
),
)
}

layoutOptions {
Expand All @@ -113,6 +128,28 @@ class MainActivity : AppCompatActivity() {
showMuteButton(true)
showPlayPauseButtonInReplay(true)
showShareButton(true)
playerUiOptions {
pipButtonOptions {
icon(WidgetImage(R.drawable.ic_pip))
}
}
actionButtonOptions {
actionButton(
ActionButton(
backgroundColor = getContextCompatColor(R.color.purple_200),
dividingLineColor = getContextCompatColor(R.color.cyan),
shape = Shape.SHAPE_OVAL,
textColor = getContextCompatColor(R.color.black),
),
)
cancelButton(
ActionButton(
backgroundColor = getContextCompatColor(R.color.teal_200),
shape = Shape.SHAPE_OVAL,
textColor = getContextCompatColor(R.color.purple_200),
),
)
}
}

titleOptions {
Expand Down
10 changes: 10 additions & 0 deletions view_options/app/src/main/res/drawable/ic_pip.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#FFFFFF"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M19,11h-8v6h8v-6zM23,19L23,4.98C23,3.88 22.1,3 21,3L3,3c-1.1,0 -2,0.88 -2,1.98L1,19c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2zM21,19.02L3,19.02L3,4.97h18v14.05z" />
</vector>
Loading