Skip to content

Commit

Permalink
DEFAULT_CACHE_STRATEGY exposed. This is needed in order to make more …
Browse files Browse the repository at this point in the history
…sophisticated and efficient update for the react-native plugin for Android. (airbnb#691)
  • Loading branch information
dryganets authored and gpeal committed Mar 19, 2018
1 parent 6815d7d commit 9d77268
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lottie/src/main/java/com/airbnb/lottie/LottieAnimationView.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@
* {@link R.attr#lottie_progress}
*/
@SuppressWarnings({"unused", "WeakerAccess"}) public class LottieAnimationView extends AppCompatImageView {

public static final CacheStrategy DEFAULT_CACHE_STRATEGY = CacheStrategy.Weak;

private static final String TAG = LottieAnimationView.class.getSimpleName();


/**
* Caching strategy for compositions that will be reused frequently.
* Weak or Strong indicates the GC reference strength of the composition in the cache.
Expand Down Expand Up @@ -109,10 +113,10 @@ public LottieAnimationView(Context context, AttributeSet attrs, int defStyleAttr

private void init(@Nullable AttributeSet attrs) {
TypedArray ta = getContext().obtainStyledAttributes(attrs, R.styleable.LottieAnimationView);
int cacheStrategy = ta.getInt(
int cacheStrategyOrdinal = ta.getInt(
R.styleable.LottieAnimationView_lottie_cacheStrategy,
CacheStrategy.Weak.ordinal());
defaultCacheStrategy = CacheStrategy.values()[cacheStrategy];
DEFAULT_CACHE_STRATEGY.ordinal());
this.defaultCacheStrategy = CacheStrategy.values()[cacheStrategyOrdinal];
if (!isInEditMode()) {
boolean hasRawRes = ta.hasValue(R.styleable.LottieAnimationView_lottie_rawRes);
boolean hasFileName = ta.hasValue(R.styleable.LottieAnimationView_lottie_fileName);
Expand Down

0 comments on commit 9d77268

Please sign in to comment.