revert of D2699721
Reviewed By: lexs Differential Revision: D2700660 fb-gh-sync-id: c59fc46e03146af9a1a6ce836070924d6bcfaba6
This commit is contained in:
parent
01983c2f0a
commit
af1475fc4c
|
@ -11,9 +11,7 @@ package com.facebook.react.modules.fresco;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import android.content.ComponentCallbacks2;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
|
||||||
import com.facebook.cache.common.CacheKey;
|
import com.facebook.cache.common.CacheKey;
|
||||||
|
@ -39,7 +37,7 @@ import com.squareup.okhttp.OkHttpClient;
|
||||||
* <p>Does not expose any methods to JavaScript code. For initialization and cleanup only.
|
* <p>Does not expose any methods to JavaScript code. For initialization and cleanup only.
|
||||||
*/
|
*/
|
||||||
public class FrescoModule extends ReactContextBaseJavaModule implements
|
public class FrescoModule extends ReactContextBaseJavaModule implements
|
||||||
ModuleDataCleaner.Cleanable, ComponentCallbacks2 {
|
ModuleDataCleaner.Cleanable {
|
||||||
|
|
||||||
@Nullable private RequestListener mRequestListener;
|
@Nullable private RequestListener mRequestListener;
|
||||||
@Nullable private DiskCacheConfig mDiskCacheConfig;
|
@Nullable private DiskCacheConfig mDiskCacheConfig;
|
||||||
|
@ -90,14 +88,6 @@ public class FrescoModule extends ReactContextBaseJavaModule implements
|
||||||
|
|
||||||
ImagePipelineConfig config = builder.build();
|
ImagePipelineConfig config = builder.build();
|
||||||
Fresco.initialize(context, config);
|
Fresco.initialize(context, config);
|
||||||
|
|
||||||
getReactApplicationContext().getApplicationContext().registerComponentCallbacks(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCatalystInstanceDestroy() {
|
|
||||||
getReactApplicationContext().getApplicationContext().unregisterComponentCallbacks(this);
|
|
||||||
clearMemoryCaches();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -115,26 +105,6 @@ public class FrescoModule extends ReactContextBaseJavaModule implements
|
||||||
imagePipelineFactory.getSmallImageDiskStorageCache().clearAll();
|
imagePipelineFactory.getSmallImageDiskStorageCache().clearAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTrimMemory(int level) {
|
|
||||||
if (level >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE ||
|
|
||||||
level == ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL) {
|
|
||||||
clearMemoryCaches();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLowMemory() {
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clearMemoryCaches() {
|
|
||||||
Fresco.getImagePipeline().clearMemoryCaches();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class FrescoHandler implements SoLoaderShim.Handler {
|
private static class FrescoHandler implements SoLoaderShim.Handler {
|
||||||
@Override
|
@Override
|
||||||
public void loadLibrary(String libraryName) {
|
public void loadLibrary(String libraryName) {
|
||||||
|
|
Loading…
Reference in New Issue