private static void putInterpolator(int hash, WeakReference<Interpolator> interpolator) { // This must be synchronized because get and put isn't thread safe because // SparseArrayCompat has to create new sized arrays sometimes. synchronized (KeyframeParser.class) { pathInterpolatorCache.put(hash, interpolator); } }
private static SparseArrayCompat<WeakReference<Interpolator>> pathInterpolatorCache() { if (pathInterpolatorCache == null) { pathInterpolatorCache = new SparseArrayCompat<>(); } return pathInterpolatorCache; }
public void clear() { cache.evictAll(); } }
@SuppressWarnings("SameParameterValue") private LottieComposition createComposition(int startFrame, int endFrame) { LottieComposition composition = new LottieComposition(); composition.init(new Rect(), startFrame, endFrame, 1000, new ArrayList<Layer>(), new LongSparseArray<Layer>(0), new HashMap<String, List<Layer>>(0), new HashMap<String, LottieImageAsset>(0), new SparseArrayCompat<FontCharacter>(0), new HashMap<String, Font>(0)); return composition; }
@Nullable public LottieComposition get(@Nullable String cacheKey) { if (cacheKey == null) { return null; } return cache.get(cacheKey); }
public void put(@Nullable String cacheKey, LottieComposition composition) { if (cacheKey == null) { return; } cache.put(cacheKey, composition); }
@RestrictTo(RestrictTo.Scope.LIBRARY) public Layer layerModelForId(long id) { return layerMap.get(id); }
/** * Get the {@link AdapterDelegate} associated with the given view type integer * * @param viewType The view type integer we want to retrieve the associated * delegate for. * @return The {@link AdapterDelegate} associated with the view type param if it exists, * the fallback delegate otherwise if it is set or returns <code>null</code> if no delegate is * associated to this viewType (and no fallback has been set). */ @Nullable public AdapterDelegate<T> getDelegateForViewType(int viewType) { return delegates.get(viewType, fallbackDelegate); }
public void put(EpoxyViewHolder holder) { holders.put(holder.getItemId(), holder); }
@Override public boolean hasNext() { return position < holders.size(); }
public boolean useTextGlyphs() { return textDelegate == null && composition.getCharacters().size() > 0; }
@Override public EpoxyViewHolder next() { if (!hasNext()) { throw new NoSuchElementException(); } return holders.valueAt(position++); }
public void remove(EpoxyViewHolder holder) { holders.remove(holder.getItemId()); }
/** * Removes the adapterDelegate for the given view types. * * @param viewType The Viewtype * @return self */ public AdapterDelegatesManager<T> removeDelegate(int viewType) { delegates.remove(viewType); return this; }
private LottieComposition createComposition(int startFrame, int endFrame) { LottieComposition composition = new LottieComposition(); composition.init(new Rect(), startFrame, endFrame, 1000, new ArrayList<Layer>(), new LongSparseArray<Layer>(0), new HashMap<String, List<Layer>>(0), new HashMap<String, LottieImageAsset>(0), new SparseArrayCompat<FontCharacter>(0), new HashMap<String, Font>(0)); return composition; }
@Nullable public EpoxyViewHolder get(EpoxyViewHolder holder) { return holders.get(holder.getItemId()); }
@Nullable private static WeakReference<Interpolator> getInterpolator(int hash) { // This must be synchronized because get and put isn't thread safe because // SparseArrayCompat has to create new sized arrays sometimes. synchronized (KeyframeParser.class) { return pathInterpolatorCache().get(hash); } }
private static void parseChars( JsonReader reader, LottieComposition composition, SparseArrayCompat<FontCharacter> characters) throws IOException { reader.beginArray(); while (reader.hasNext()) { FontCharacter character = FontCharacterParser.parse(reader, composition); characters.put(character.hashCode(), character); } reader.endArray(); } }
public int size() { return holders.size(); }
@Nullable public EpoxyViewHolder getHolderForModel(EpoxyModel<?> model) { return holders.get(model.id()); }