-
public class KeyPathDefines which content to target. The keypath can contain wildcards ('*') with match exactly 1 item. or globstars ('**') which match 0 or more items. or KeyPath.COMPOSITION to represent the root composition layer.
For example, if your content were arranged like this: Gabriel (Shape Layer) Body (Shape Group) Left Hand (Shape) Fill (Fill) Transform (Transform) ... Brandon (Shape Layer) Body (Shape Group) Left Hand (Shape) Fill (Fill) Transform (Transform) ...
You could: Match Gabriel left hand fill: new KeyPath("Gabriel", "Body", "Left Hand", "Fill"); Match Gabriel and Brandon's left hand fill: new KeyPath("*", "Body", Left Hand", "Fill"); Match anything with the name Fill: new KeyPath("**", "Fill"); Target the the root composition layer: KeyPath.COMPOSITION
NOTE: Content that are part of merge paths or repeaters cannot currently be resolved with a KeyPath. This may be fixed in the future.
-
-
Field Summary
Fields Modifier and Type Field Description public final static KeyPathCOMPOSITIONprivate KeyPathElementresolvedElement
-
Method Summary
Modifier and Type Method Description KeyPathElementgetResolvedElement()Returns a KeyPathElement that this has been resolved to. KeyPathaddKey(String key)Returns a new KeyPath with the key added.This is used during keypath resolution. KeyPathresolve(KeyPathElement element)Return a new KeyPath with the element resolved to the specified KeyPathElement. booleanmatches(String key, int depth)Returns whether they key matches at the specified depth. intincrementDepthBy(String key, int depth)For a given key and depth, returns how much the depth should be incremented by whenresolving a keypath to children. booleanfullyResolvesTo(String key, int depth)Returns whether the key at specified depth is fully specific enough to match the full set ofkeys in this keypath. booleanpropagateToChildren(String key, int depth)Returns whether the keypath resolution should propagate to children. StringkeysToString()booleanequals(Object o)inthashCode()StringtoString()-
-
Method Detail
-
getResolvedElement
@RestrictTo(value = RestrictTo.Scope.LIBRARY)@Nullable() KeyPathElement getResolvedElement()
Returns a KeyPathElement that this has been resolved to. KeyPaths get resolved withresolveKeyPath on LottieDrawable or LottieAnimationView.
-
addKey
@CheckResult()@RestrictTo(value = RestrictTo.Scope.LIBRARY) KeyPath addKey(String key)
Returns a new KeyPath with the key added.This is used during keypath resolution. Children normally don't know about all of their parentelements so this is used to keep track of the fully qualified keypath.This returns a key keypath because during resolution, the full keypath element tree is walkedand if this modified the original copy, it would remain after popping back up the element tree.
-
resolve
@RestrictTo(value = RestrictTo.Scope.LIBRARY) KeyPath resolve(KeyPathElement element)
Return a new KeyPath with the element resolved to the specified KeyPathElement.
-
matches
@RestrictTo(value = RestrictTo.Scope.LIBRARY) boolean matches(String key, int depth)
Returns whether they key matches at the specified depth.
-
incrementDepthBy
@RestrictTo(value = RestrictTo.Scope.LIBRARY) int incrementDepthBy(String key, int depth)
For a given key and depth, returns how much the depth should be incremented by whenresolving a keypath to children.
This can be 0 or 2 when there is a globstar and the next key either matches or doesn't matchthe current key.
-
fullyResolvesTo
@RestrictTo(value = RestrictTo.Scope.LIBRARY) boolean fullyResolvesTo(String key, int depth)
Returns whether the key at specified depth is fully specific enough to match the full set ofkeys in this keypath.
-
propagateToChildren
@RestrictTo(value = RestrictTo.Scope.LIBRARY) boolean propagateToChildren(String key, int depth)
Returns whether the keypath resolution should propagate to children. Some keypaths resolveto content other than leaf contents (such as a layer or content group transform) so sometimesthis will return false.
-
keysToString
String keysToString()
-
hashCode
int hashCode()
-
-
-
-