-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Provide a second overload to TextDelegate.getText that provides layerName #1931
Provide a second overload to TextDelegate.getText that provides layerName #1931
Conversation
…re consistent with iOS
… more consistent with iOS
b3bc8bb
to
52e1a29
Compare
@@ -245,7 +246,7 @@ private void drawTextWithFont( | |||
String text = documentData.text; | |||
TextDelegate textDelegate = lottieDrawable.getTextDelegate(); | |||
if (textDelegate != null) { | |||
text = textDelegate.getTextInternal(text); | |||
text = textDelegate.getTextInternal(getName(), text); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a key path name. This is the layerName. Key path would be the fully qualified list of elements up to the root composition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that, if I am understanding this is similar to iOS though looking at the implementation. It is only the layer name. Please let me know what would be best
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For more context, this is what I am referring to.
CompositionLayer {
init(layer: LayerModel, size: CGSize) {
...
self.keypathName = layer.name
...
}
}
I didn't think this was the true keypath either, but just a string representing the layer name, I was just trying to use consistent naming between the codebases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@greggiacovelli Interesting. It does seem like iOS is using the name slightly inconsistently. For the same of consistency within the Android library, I'd prefer layerName
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok will do. Thanks for the guidance and I will append the PR in a bit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in 2099504
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
In the iOS version of lottie, the AnimationTextProvider can look up text with the context of the keypath and the text within the layer. This doesn't seem to be possible in the Android version.
Closes #1932
Given the following example though there doesn't seem to be a way to address the following pseudo animation the same way across platforms.
The default implementations aside (DictionaryTextProvider and TextDelegate), if an implementation was needed to disambiguate strings that were duplicated inside an animation, this would not be possible in the Android library today simply because
getText(String input)
is all that is provided. This just expands getText to also have access to thekeyPath
.I am not sure if this has already been covered so please refer me to such past decisions if this is an inappropriate pull request.