You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lottie is supported and developed on nights and weekends. Issues from Lottie sponsors will be prioritized.
If you don't use this template, your issue will be closed. Delete this text once completed.
Is your feature request related to a problem? Please describe.
Currently if an animation is shared across Android and iOS the text layers are intercepted by their respective libraries differently. Android (TextDelegate) can only replace text with text that is named X, whereas iOS (AnimationTextProvider) will be able to look at either the Keypath and the text, by default (DictionaryTextProvider) will look for matching KeyPath that is named X. This creates a bit of a disconnect but prevents duplicate text among layers in an animation as well for android. Consider the following example set of layers
layer_1 with text "READ IT" // Let's say in context it's a commanding statement
layer_2 with text "READ IT" // Let's say in context it's a statement representing the past
By default the layers would be named the same as the text they contained. However this is just default. In the case where a content author would want to disambiguate the layers they can rename them. In this case, Android would not be able to replace the text on layer1 and layer2 independently. They would both be replaced with the same exact string. If TextDelegate were to be using to localize the text, it might be incorrect as text here could mean different things depending on context.
Describe the solution you'd like
I proposed #1931 as a possible solution. It merely exposes the KeyPath's name to the interface of TextDelegate to make an implementation possible that would address the above example.
Describe alternatives you've considered
We could also generate multiple animations that are organized specifically for Android vs iOS but that may defeat the overall purpose of the portable animation format. It's the current solution that we are going with but it's not ideal and very error prone.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered:
greggiacovelli
changed the title
Lottie TextDelegate cannot conditionally replace by layer like iOS AnimationTextProvider can
Add Keypath to TextDelegate in order to have same cross platform behavior iOS AnimationTextProvider
Oct 29, 2021
greggiacovelli
changed the title
Add Keypath to TextDelegate in order to have same cross platform behavior iOS AnimationTextProvider
Add Keypath to TextDelegate in order to have same cross platform behavior as iOS AnimationTextProvider.
Oct 29, 2021
greggiacovelli
added a commit
to greggiacovelli/lottie-android
that referenced
this issue
Nov 2, 2021
…Name (#1931)
If multiple text layers have the same text, it is impossible to disambiguate which one you are setting the text for. This commit adds a second overload for TextDelegate.getText that lets you receive the layerName in addition to the text.
Fixex #1932
Lottie is supported and developed on nights and weekends. Issues from Lottie sponsors will be prioritized.
If you don't use this template, your issue will be closed. Delete this text once completed.
Is your feature request related to a problem? Please describe.
Currently if an animation is shared across Android and iOS the text layers are intercepted by their respective libraries differently. Android (TextDelegate) can only replace text with
text
that is named X, whereas iOS (AnimationTextProvider) will be able to look at either theKeypath
and thetext
, by default (DictionaryTextProvider) will look for matching KeyPath that is named X. This creates a bit of a disconnect but prevents duplicate text among layers in an animation as well for android. Consider the following example set of layersBy default the layers would be named the same as the text they contained. However this is just default. In the case where a content author would want to disambiguate the layers they can rename them. In this case, Android would not be able to replace the text on layer1 and layer2 independently. They would both be replaced with the same exact string. If TextDelegate were to be using to localize the text, it might be incorrect as text here could mean different things depending on context.
Describe the solution you'd like
I proposed #1931 as a possible solution. It merely exposes the
KeyPath
's name to the interface ofTextDelegate
to make an implementation possible that would address the above example.Describe alternatives you've considered
We could also generate multiple animations that are organized specifically for Android vs iOS but that may defeat the overall purpose of the portable animation format. It's the current solution that we are going with but it's not ideal and very error prone.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: