-
Notifications
You must be signed in to change notification settings - Fork 0
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
move MergePath flag to new FeatureFlag API #2
base: master
Are you sure you want to change the base?
Conversation
Fixes airbnb#2493 Co-authored-by: chaoluo10 <chaoluo10@iflytek.com>
Currently, I am encountering a similar issue to [airbnb#1200](airbnb#1200), but in the case where the asset is a base64 image, it has not been fixed yet.
LottieAnimationView extends AppCompatImageView, therefore the latter is part of the former's ABI.
* Merge paths currently don't work if the the operand shape is entirely contained within the | ||
* first shape. If you need to cut out one shape from another shape, use an even-odd fill type | ||
* instead of using merge paths. | ||
*/ | ||
public void enableMergePathsForKitKatAndAbove(boolean enable) { |
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.
We will probably deprecate this method and incentivise use of the more generic enableFeatureFlag function. I was wondering if we pipe it in through here LottieDrawable, or do we do all of our flag setting through LottieComposition.
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.
Settled on LottieDrawable to allow different drawables different flags.
@@ -142,7 +142,8 @@ private enum OnVisibleAction { | |||
FontAssetDelegate fontAssetDelegate; | |||
@Nullable | |||
TextDelegate textDelegate; | |||
private boolean enableMergePaths; | |||
private LottieFeatureFlags lottieFeatureFlags = LottieFeatureFlags.getInstance(); |
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 agree that this should be on a per-composition basis. However, I think we should create a new instance of the flags rather than having a singleton because you may want a different set of flags on different drawables.
We'll also need to mirror this API for compose but I can help with that once we've settled on something.
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.
Done.
* first shape. If you need to cut out one shape from another shape, use an even-odd fill type | ||
* instead of using merge paths. | ||
*/ | ||
MergePath_19(Build.VERSION_CODES.KITKAT); |
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'd like to avoid underscores in the name if possible. Maybe MergePathsApi19
?
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.
Done.
|
||
@SuppressLint("DefaultLocale") | ||
public void enableFlag(FeatureFlag flag, boolean enable) { | ||
if (Objects.equals(flagValues.get(flag), enable)) { |
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.
Does this avoid autoboxing of a nullable boolean or does it always autobox boolean into Boolean because the equals param is Object?
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.
Ack. It did work to avoid the Boolean Object issues, but I changed to a Set backing (if the flag is present, it is enabled).
No description provided.