Skip to content

fix: 🐛 Updated setTextSlot function#135

Merged
afsalz merged 4 commits into
mainfrom
fix/set-text-slot
Jul 3, 2026
Merged

fix: 🐛 Updated setTextSlot function#135
afsalz merged 4 commits into
mainfrom
fix/set-text-slot

Conversation

@afsalz

@afsalz afsalz commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Add typed text slot support

Adds two setTextSlot overloads so callers can update a text slot either
with just a string or with full styling:

  • setTextSlot(slotId, text: String) — reads the slot's current document,
    swaps only the text, and writes it back (returns false if the slot has
    no value). Fixes setTextSlot text can not show #133, where setting a string previously wiped the
    document's font/size/color.
  • setTextSlot(slotId, document: TextDocument) — sets the full document.

Also adds a TextDocument type (text, font, size, colors, etc.) and the
nativeGetSlotStr binding to read the current slot value.

Related PR -> LottieFiles/dotlottie-rs#586

@changeset-bot

changeset-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: de66739

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@afsalz
afsalz marked this pull request as draft June 30, 2026 23:52
@afsalz
afsalz marked this pull request as ready for review July 1, 2026 07:08
@afsalz
afsalz requested review from samuelOsborne and theashraf July 1, 2026 08:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds typed text-slot support so callers can update text slots without wiping existing styling, addressing Issue #133 by reading the current slot document, swapping only the text, and writing the full document back.

Changes:

  • Added TextDocument model with JSON (de)serialization for Lottie text-slot payloads.
  • Added nativeGetSlotStr JNI binding and C++ implementation to read the current slot JSON.
  • Introduced setTextSlot(slotId, document: TextDocument) overloads through the player, drawable, widgets, and Compose controller; updated setTextSlot(slotId, text: String) to preserve styling by round-tripping the document.
  • Bumped bundled native dlplayer version and library version.

Reviewed changes

Copilot reviewed 10 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
dotlottie/src/main/kotlin/com/lottiefiles/dotlottie/core/jni/DotLottiePlayer.kt Adds JNI declaration for nativeGetSlotStr.
dotlottie/src/main/kotlin/com/dotlottie/dlplayer/TextDocument.kt Introduces typed text-document representation and JSON conversion helpers.
dotlottie/src/main/kotlin/com/dotlottie/dlplayer/DotLottiePlayer.kt Updates setTextSlot(String) to preserve styling; adds setTextSlot(TextDocument) and slot-document read helper.
dotlottie/src/main/java/com/lottiefiles/dotlottie/core/widget/DotLottieGLAnimation.kt Exposes setTextSlot(slotId, TextDocument) for GL widget users.
dotlottie/src/main/java/com/lottiefiles/dotlottie/core/widget/DotLottieAnimation.kt Exposes setTextSlot(slotId, TextDocument) for widget users.
dotlottie/src/main/java/com/lottiefiles/dotlottie/core/drawable/DotLottieDrawable.kt Adds drawable-level setTextSlot(TextDocument) with frame scheduling.
dotlottie/src/main/java/com/lottiefiles/dotlottie/core/compose/runtime/DotLottieController.kt Exposes setTextSlot(slotId, TextDocument) for Compose runtime users.
dotlottie/src/main/cpp/version.txt Updates the embedded dlplayer version reference.
dotlottie/src/main/cpp/jni_bridge.cpp Implements and registers nativeGetSlotStr.
dotlottie/build.gradle.kts Bumps library version to 0.15.0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread dotlottie/src/main/kotlin/com/dotlottie/dlplayer/DotLottiePlayer.kt
Comment thread dotlottie/src/main/kotlin/com/dotlottie/dlplayer/TextDocument.kt
Comment thread dotlottie/src/main/cpp/jni_bridge.cpp
@afsalz
afsalz removed the request for review from samuelOsborne July 3, 2026 07:20
@afsalz
afsalz merged commit 7e4fa83 into main Jul 3, 2026
2 checks passed
@afsalz
afsalz deleted the fix/set-text-slot branch July 3, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setTextSlot text can not show

3 participants