• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.airbnb.lottie.model;
2 
3 import static androidx.annotation.RestrictTo.Scope.LIBRARY;
4 
5 import androidx.annotation.Nullable;
6 import androidx.annotation.RestrictTo;
7 
8 import com.airbnb.lottie.value.LottieValueCallback;
9 
10 import java.util.List;
11 
12 /**
13  * Any item that can be a part of a {@link KeyPath} should implement this.
14  */
15 @RestrictTo(LIBRARY)
16 public interface KeyPathElement {
17 
18   /**
19    * Called recursively during keypath resolution.
20    * <p>
21    * The overridden method should just call:
22    * MiscUtils.resolveKeyPath(keyPath, depth, accumulator, currentPartialKeyPath, this);
23    *
24    * @param keyPath               The full keypath being resolved.
25    * @param depth                 The current depth that this element should be checked at in the keypath.
26    * @param accumulator           A list of fully resolved keypaths. If this element fully matches the
27    *                              keypath then it should add itself to this list.
28    * @param currentPartialKeyPath A keypath that contains all parent element of this one.
29    *                              This element should create a copy of this and append itself
30    *                              with KeyPath#addKey when it adds itself to the accumulator
31    *                              or propagates resolution to its children.
32    */
resolveKeyPath( KeyPath keyPath, int depth, List<KeyPath> accumulator, KeyPath currentPartialKeyPath)33   void resolveKeyPath(
34       KeyPath keyPath, int depth, List<KeyPath> accumulator, KeyPath currentPartialKeyPath);
35 
36   /**
37    * The overridden method should handle appropriate properties and set value callbacks on their
38    * animations.
39    */
addValueCallback(T property, @Nullable LottieValueCallback<T> callback)40   <T> void addValueCallback(T property, @Nullable LottieValueCallback<T> callback);
41 }