Clear cache onTrimMemory
This commit is contained in:
1 parent
bf97290e57
commit
37bec12843
1 file changed
+21
@@ -17,6 +17,7 @@
|
||||
package com.hippo.ehviewer;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.ComponentCallbacks2;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -112,6 +113,26 @@ public class EhApplication extends SceneApplication implements Thread.UncaughtEx
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrimMemory(int level) {
|
||||
super.onTrimMemory(level);
|
||||
|
||||
if (level >= ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW) {
|
||||
if (null != mConaco) {
|
||||
mConaco.clearMemoryCache();
|
||||
}
|
||||
if (null != mGalleryDetailCache) {
|
||||
mGalleryDetailCache.evictAll();
|
||||
}
|
||||
if (null != mLargePreviewSetCache) {
|
||||
mLargePreviewSetCache.evictAll();
|
||||
}
|
||||
if (null != mPreviewPagesCache) {
|
||||
mPreviewPagesCache.evictAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void debugNativeMemory() {
|
||||
new Runnable() {
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user