Skip to content
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

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open

Conversation

jbeta51
Copy link
Owner

@jbeta51 jbeta51 commented Jun 6, 2024

No description provided.

* 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) {
Copy link
Owner Author

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.

Copy link
Owner Author

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();
Copy link

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.

Copy link
Owner Author

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);
Copy link

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?

Copy link
Owner Author

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)) {
Copy link

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?

Copy link
Owner Author

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants