File tree 1 file changed +18
-3
lines changed
lottie/src/main/java/com/airbnb/lottie
1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -86,12 +86,27 @@ public static void setMaxCacheSize(int size) {
86
86
LottieCompositionCache .getInstance ().resize (size );
87
87
}
88
88
89
+ /**
90
+ * Like {@link #clearCache(Context, boolean)} but defaults to clearing the network cache.
91
+ *
92
+ * @see #clearCache(Context, boolean)
93
+ */
89
94
public static void clearCache (Context context ) {
95
+ clearCache (context , true );
96
+ }
97
+
98
+ /**
99
+ * Clears any pending animations, animations that are parsed and in-memory, and
100
+ * optionally, any animations loaded from the network that are cached to disk.
101
+ */
102
+ public static void clearCache (Context context , boolean includeNetwork ) {
90
103
taskCache .clear ();
91
104
LottieCompositionCache .getInstance ().clear ();
92
- final NetworkCache networkCache = L .networkCache (context );
93
- if (networkCache != null ) {
94
- networkCache .clear ();
105
+ if (includeNetwork ) {
106
+ final NetworkCache networkCache = L .networkCache (context );
107
+ if (networkCache != null ) {
108
+ networkCache .clear ();
109
+ }
95
110
}
96
111
}
97
112
You can’t perform that action at this time.
0 commit comments