diff --git a/dotlottie/build.gradle.kts b/dotlottie/build.gradle.kts index 0b92cc0..b36fe11 100644 --- a/dotlottie/build.gradle.kts +++ b/dotlottie/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } group = "com.github.LottieFiles" -version = "0.3.0" +version = "0.3.1" android { namespace = "com.lottiefiles.dotlottie.core" diff --git a/dotlottie/src/main/jniLibs/arm64-v8a/libuniffi_dotlottie_player.so b/dotlottie/src/main/jniLibs/arm64-v8a/libuniffi_dotlottie_player.so index 0f7aa14..0392892 100755 Binary files a/dotlottie/src/main/jniLibs/arm64-v8a/libuniffi_dotlottie_player.so and b/dotlottie/src/main/jniLibs/arm64-v8a/libuniffi_dotlottie_player.so differ diff --git a/dotlottie/src/main/jniLibs/armeabi-v7a/libuniffi_dotlottie_player.so b/dotlottie/src/main/jniLibs/armeabi-v7a/libuniffi_dotlottie_player.so index 4af60b5..7edc257 100755 Binary files a/dotlottie/src/main/jniLibs/armeabi-v7a/libuniffi_dotlottie_player.so and b/dotlottie/src/main/jniLibs/armeabi-v7a/libuniffi_dotlottie_player.so differ diff --git a/dotlottie/src/main/jniLibs/x86_64/libuniffi_dotlottie_player.so b/dotlottie/src/main/jniLibs/x86_64/libuniffi_dotlottie_player.so index 44cbe59..4981525 100755 Binary files a/dotlottie/src/main/jniLibs/x86_64/libuniffi_dotlottie_player.so and b/dotlottie/src/main/jniLibs/x86_64/libuniffi_dotlottie_player.so differ diff --git a/dotlottie/src/main/kotlin/com/dotlottie/dlplayer/dotlottie_player.kt b/dotlottie/src/main/kotlin/com/dotlottie/dlplayer/dotlottie_player.kt index 3305087..cb4a233 100644 --- a/dotlottie/src/main/kotlin/com/dotlottie/dlplayer/dotlottie_player.kt +++ b/dotlottie/src/main/kotlin/com/dotlottie/dlplayer/dotlottie_player.kt @@ -1039,6 +1039,11 @@ internal interface UniffiLib : Library { uniffi_out_err: UniffiRustCallStatus, ): Byte + fun uniffi_dotlottie_player_fn_method_dotlottieplayer_segment_duration( + `ptr`: Pointer, + uniffi_out_err: UniffiRustCallStatus, + ): Float + fun uniffi_dotlottie_player_fn_method_dotlottieplayer_set_config( `ptr`: Pointer, `config`: RustBuffer.ByValue, @@ -1051,6 +1056,15 @@ internal interface UniffiLib : Library { uniffi_out_err: UniffiRustCallStatus, ): Byte + fun uniffi_dotlottie_player_fn_method_dotlottieplayer_set_viewport( + `ptr`: Pointer, + `x`: Int, + `y`: Int, + `w`: Int, + `h`: Int, + uniffi_out_err: UniffiRustCallStatus, + ): Byte + fun uniffi_dotlottie_player_fn_method_dotlottieplayer_stop( `ptr`: Pointer, uniffi_out_err: UniffiRustCallStatus, @@ -1415,10 +1429,14 @@ internal interface UniffiLib : Library { fun uniffi_dotlottie_player_checksum_method_dotlottieplayer_seek(): Short + fun uniffi_dotlottie_player_checksum_method_dotlottieplayer_segment_duration(): Short + fun uniffi_dotlottie_player_checksum_method_dotlottieplayer_set_config(): Short fun uniffi_dotlottie_player_checksum_method_dotlottieplayer_set_frame(): Short + fun uniffi_dotlottie_player_checksum_method_dotlottieplayer_set_viewport(): Short + fun uniffi_dotlottie_player_checksum_method_dotlottieplayer_stop(): Short fun uniffi_dotlottie_player_checksum_method_dotlottieplayer_subscribe(): Short @@ -1555,12 +1573,18 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_dotlottie_player_checksum_method_dotlottieplayer_seek() != 60656.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_dotlottie_player_checksum_method_dotlottieplayer_segment_duration() != 38024.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_dotlottie_player_checksum_method_dotlottieplayer_set_config() != 39472.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } if (lib.uniffi_dotlottie_player_checksum_method_dotlottieplayer_set_frame() != 44086.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_dotlottie_player_checksum_method_dotlottieplayer_set_viewport() != 29505.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_dotlottie_player_checksum_method_dotlottieplayer_stop() != 25240.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -1689,6 +1713,29 @@ public object FfiConverterUInt : FfiConverter { } } +public object FfiConverterInt : FfiConverter { + override fun lift(value: Int): Int { + return value + } + + override fun read(buf: ByteBuffer): Int { + return buf.getInt() + } + + override fun lower(value: Int): Int { + return value + } + + override fun allocationSize(value: Int) = 4UL + + override fun write( + value: Int, + buf: ByteBuffer, + ) { + buf.putInt(value) + } +} + public object FfiConverterULong : FfiConverter { override fun lift(value: Long): ULong { return value.toULong() @@ -2078,10 +2125,19 @@ public interface DotLottiePlayerInterface { fun `seek`(`no`: kotlin.Float): kotlin.Boolean + fun `segmentDuration`(): kotlin.Float + fun `setConfig`(`config`: Config) fun `setFrame`(`no`: kotlin.Float): kotlin.Boolean + fun `setViewport`( + `x`: kotlin.Int, + `y`: kotlin.Int, + `w`: kotlin.Int, + `h`: kotlin.Int, + ): kotlin.Boolean + fun `stop`(): kotlin.Boolean fun `subscribe`(`observer`: Observer) @@ -2592,6 +2648,19 @@ open class DotLottiePlayer : Disposable, AutoCloseable, DotLottiePlayerInterface ) } + override fun `segmentDuration`(): kotlin.Float { + return FfiConverterFloat.lift( + callWithPointer { + uniffiRustCall { _status -> + UniffiLib.INSTANCE.uniffi_dotlottie_player_fn_method_dotlottieplayer_segment_duration( + it, + _status, + ) + } + }, + ) + } + override fun `setConfig`(`config`: Config) = callWithPointer { uniffiRustCall { _status -> @@ -2617,6 +2686,28 @@ open class DotLottiePlayer : Disposable, AutoCloseable, DotLottiePlayerInterface ) } + override fun `setViewport`( + `x`: kotlin.Int, + `y`: kotlin.Int, + `w`: kotlin.Int, + `h`: kotlin.Int, + ): kotlin.Boolean { + return FfiConverterBoolean.lift( + callWithPointer { + uniffiRustCall { _status -> + UniffiLib.INSTANCE.uniffi_dotlottie_player_fn_method_dotlottieplayer_set_viewport( + it, + FfiConverterInt.lower(`x`), + FfiConverterInt.lower(`y`), + FfiConverterInt.lower(`w`), + FfiConverterInt.lower(`h`), + _status, + ) + } + }, + ) + } + override fun `stop`(): kotlin.Boolean { return FfiConverterBoolean.lift( callWithPointer { diff --git a/sample-compose/src/main/java/com/lottiefiles/example/MainActivity.kt b/sample-compose/src/main/java/com/lottiefiles/example/MainActivity.kt index a7c421c..1bb9444 100644 --- a/sample-compose/src/main/java/com/lottiefiles/example/MainActivity.kt +++ b/sample-compose/src/main/java/com/lottiefiles/example/MainActivity.kt @@ -130,14 +130,13 @@ fun DefaultAnimationDemo() { autoplay = true, loop = true, eventListeners = listOf(events), -// source = DotLottieSource.Url("https://lottiefiles-mobile-templates.s3.amazonaws.com/ar-stickers/swag_sticker_piggy.lottie"), - source = DotLottieSource.Url("https://lottie.host/5525262b-4e57-4f0a-8103-cfdaa7c8969e/VCYIkooYX8.json"), + source = DotLottieSource.Url("https://lottiefiles-mobile-templates.s3.amazonaws.com/ar-stickers/swag_sticker_piggy.lottie"), +// source = DotLottieSource.Url("https://lottie.host/5525262b-4e57-4f0a-8103-cfdaa7c8969e/VCYIkooYX8.json"), // source = DotLottieSource.Url("https://lottie.host/294b684d-d6b4-4116-ab35-85ef566d4379/VkGHcqcMUI.lottie"), // source = DotLottieSource.Asset("swinging.json"), modifier = Modifier .background(Color.LightGray) .size(200.dp), - controller = dotLottieController ) } }