ResourceMethod(@Nullable ClassName typeName, String name, boolean requiresResources, int sdk) { this.typeName = typeName; this.name = name; this.requiresResources = requiresResources; this.sdk = sdk; }
/** * Composition will be null if there was an error loading it. Check logcat for more details. */ void onCompositionLoaded(@Nullable LottieComposition composition); }
/** * Returns the bitmap that has been stored for this image asset if one was explicitly set. */ @Nullable public Bitmap getBitmap() { return bitmap; }
/** * Override this if you haven't set a static value in the constructor or with setValue. * * Return null to resort to the default value. */ @Nullable public T getValue(LottieFrameInfo<T> frameInfo) { return value; }
/** This will be null if the startValue and endValue are the same. */ @Nullable Path getPath() { return path; } }
@Nullable static AnimatableTransform findTransform(List<ContentModel> contentModels) { for (int i = 0; i < contentModels.size(); i++) { ContentModel contentModel = contentModels.get(i); if (contentModel instanceof AnimatableTransform) { return (AnimatableTransform) contentModel; } } return null; }
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_font, container, false); ButterKnife.bind(this, view); textDelegate = new TextDelegate(nameAnimationView); nameAnimationView.setTextDelegate(textDelegate); return view; }
@Nullable static TypefaceStyles fromValue(int value) { for (TypefaceStyles style : values()) { if (style.value == value) { return style; } } return null; } }
@Override public <T> void addValueCallback(T property, @Nullable LottieValueCallback<T> callback) { if (transformAnimation != null) { transformAnimation.applyValueCallback(property, callback); } } }
public static LottieTask<LottieComposition> fromZipStream(final ZipInputStream inputStream, @Nullable final String cacheKey) { return cache(cacheKey, new Callable<LottieResult<LottieComposition>>() { @Override public LottieResult<LottieComposition> call() { return fromZipStreamSync(inputStream, cacheKey); } }); }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); tfRegular = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf"); tfLight = Typeface.createFromAsset(getAssets(), "OpenSans-Light.ttf"); }
/** * Sets the animation from json string. This is the ideal API to use when loading an animation * over the network because you can use the raw response body here and a conversion to a * JSONObject never has to be done. */ public void setAnimationFromJson(String jsonString, @Nullable String cacheKey) { setAnimation(new JsonReader(new StringReader(jsonString)), cacheKey); }
@CallSuper @Override public <T> void addValueCallback(T property, @Nullable LottieValueCallback<T> callback) { transform.applyValueCallback(property, callback); } }
@SuppressWarnings("unchecked") @Override public <T> void addValueCallback(T property, @Nullable LottieValueCallback<T> callback) { if (property == LottieProperty.ELLIPSE_SIZE) { sizeAnimation.setValueCallback((LottieValueCallback<PointF>) callback); } else if (property == LottieProperty.POSITION) { positionAnimation.setValueCallback((LottieValueCallback<PointF>) callback); } } }
/** * Return a LottieComposition for the specified raw json string. * If loading from a file, it is preferable to use the InputStream or rawRes version. */ @WorkerThread public static LottieResult<LottieComposition> fromJsonStringSync(String json, @Nullable String cacheKey) { return fromJsonReaderSync(new JsonReader(new StringReader(json)), cacheKey); }
/** * @see LottieCompositionFactory#fromJsonInputStreamSync(InputStream) */ @Nullable @WorkerThread @Deprecated public static LottieComposition fromInputStreamSync(InputStream stream) { return LottieCompositionFactory.fromJsonInputStreamSync(stream, null).getValue(); }
/** * @see LottieCompositionFactory#fromJsonStringSync(String) */ @Nullable @WorkerThread @Deprecated public static LottieComposition fromJsonSync(String json) { return LottieCompositionFactory.fromJsonStringSync(json, null).getValue(); }
@Override @Nullable public Content toContent(LottieDrawable drawable, BaseLayer layer) { if (!drawable.enableMergePathsForKitKatAndAbove()) { L.warn("Animation contains merge paths but they are disabled."); return null; } return new MergePathsContent(this); }
Id(int value, @Nullable Symbol rSymbol) { this.value = value; if (rSymbol != null) { ClassName className = ClassName.get(rSymbol.packge().getQualifiedName().toString(), R, rSymbol.enclClass().name.toString()); String resourceName = rSymbol.name.toString(); this.code = className.topLevelClassName().equals(ANDROID_R) ? CodeBlock.of("$L.$N", className, resourceName) : CodeBlock.of("$T.$N", className, resourceName); this.qualifed = true; } else { this.code = CodeBlock.of("$L", value); this.qualifed = false; } }
public static void applyTrimPathIfNeeded(Path path, @Nullable TrimPathContent trimPath) { if (trimPath == null || trimPath.isHidden()) { return; } float start = ((FloatKeyframeAnimation) trimPath.getStart()).getFloatValue(); float end = ((FloatKeyframeAnimation) trimPath.getEnd()).getFloatValue(); float offset = ((FloatKeyframeAnimation) trimPath.getOffset()).getFloatValue(); applyTrimPathIfNeeded(path, start / 100f, end / 100f, offset / 360f); }