Skip to content

Commit

Permalink
lottiefiles example
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhirkevich Alexander Y authored and Zhirkevich Alexander Y committed Jul 23, 2024
1 parent c24dbd8 commit 1199cb2
Show file tree
Hide file tree
Showing 10 changed files with 943 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private class NetworkCompositionSpec(
) : LottieCompositionSpec {

override val key: String
get() = "url_${url.hashCode()}"
get() = "url_$url"

private val assetsManager = NetworkAssetsManager(client, request, cacheStrategy)
private val fontManager = NetworkFontManager(client, request, cacheStrategy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package io.github.alexzhirkevich.compottie.internal.animation.expressions
import io.github.alexzhirkevich.compottie.internal.AnimationState
import io.github.alexzhirkevich.compottie.internal.animation.RawProperty

internal val EXPR_DEBUG_PRINT_ENABLED = true
internal val EXPR_DEBUG_PRINT_ENABLED = false

internal fun interface Expression {

Expand Down
13 changes: 10 additions & 3 deletions example/shared/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@

@file:Suppress("DSL_SCOPE_VIOLATION")

plugins {
id("module.android")
id("module.multiplatform")
id("ktorwasm.workaround")
alias(libs.plugins.serialization)
}

kotlin {
Expand All @@ -27,11 +31,14 @@ kotlin {
// implementation("io.github.alexzhirkevich:compottie-network:2.0.0-beta01")
// implementation("io.github.alexzhirkevich:compottie-resources:2.0.0-beta01")

implementation(compose.ui)
implementation(compose.runtime)
implementation("org.jetbrains.androidx.navigation:navigation-compose:2.7.0-alpha07")
implementation("org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-compose:2.8.0")
implementation(compose.material3)
implementation(compose.foundation)
implementation(compose.materialIconsExtended)
implementation(compose.components.resources)
implementation(libs.serialization)
implementation(libs.coil.compose)
implementation(libs.coil.network)
}
androidMain.dependencies {
implementation(libs.ktor.client.okhttp)
Expand Down
5 changes: 3 additions & 2 deletions example/shared/src/commonMain/kotlin/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import io.github.alexzhirkevich.compottie.rememberResourcesAssetsManager
import io.github.alexzhirkevich.compottie.rememberResourcesFontManager
import io.github.alexzhirkevich.shared.generated.resources.ComicNeue
import io.github.alexzhirkevich.shared.generated.resources.Res
import lottiefiles.LottieFilesScreen
import org.jetbrains.compose.resources.ExperimentalResourceApi

private val GRADIENT_ELLIPSE = "gradient_ellipse.json"
Expand Down Expand Up @@ -129,7 +130,7 @@ public suspend fun LottieCompositionSpec.Companion.ResourceString(
public fun App() {

// return LottieFontExample()
return AllExamples()
return LottieFilesScreen()
// return LottieList()

val composition = rememberLottieComposition() {
Expand All @@ -141,7 +142,7 @@ public fun App() {
// LottieCompositionSpec.ResourceString("expr/move_horizontal.json")
// LottieCompositionSpec.ResourceString("expr/wiggle.json")
// LottieCompositionSpec.ResourceString("expr/noise.json")
LottieCompositionSpec.ResourceString(ROBOT)
LottieCompositionSpec.ResourceString(WONDERS)
//
// LottieCompositionSpec.Url(
// "https://assets-v2.lottiefiles.com/a/a63d8606-1166-11ee-a7f8-83d9759dd8ff/hCTtJKM3Tu.lottie"
Expand Down
22 changes: 22 additions & 0 deletions example/shared/src/commonMain/kotlin/lottiefiles/LottieFile.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package lottiefiles

import kotlinx.serialization.Serializable

@Serializable
internal class LottieFile(
val id : String,
val name : String? = null,
val tags : List<String> = emptyList(),
val lottieSource : String? = null,
val jsonSource : String? = null,
// val imageSource : String = "",
val bgColor : String? = null,
val downloadCount : Int = 0,
val user : User = User()
)

@Serializable
internal class User(
val name : String? = null,
val avatarUrl : String? = null
)
Loading

0 comments on commit 1199cb2

Please sign in to comment.