Example usage for android.content ComponentCallbacks2 TRIM_MEMORY_MODERATE

List of usage examples for android.content ComponentCallbacks2 TRIM_MEMORY_MODERATE

Introduction

In this page you can find the example usage for android.content ComponentCallbacks2 TRIM_MEMORY_MODERATE.

Prototype

int TRIM_MEMORY_MODERATE

To view the source code for android.content ComponentCallbacks2 TRIM_MEMORY_MODERATE.

Click Source Link

Document

Level for #onTrimMemory(int) : the process is around the middle of the background LRU list; freeing memory can help the system keep other processes running later in the list for better overall performance.

Usage

From source file:Main.java

public static String getTrimLevelName(int level) {
    switch (level) {
    case ComponentCallbacks2.TRIM_MEMORY_COMPLETE:
        return "COMPLETE";
    case ComponentCallbacks2.TRIM_MEMORY_MODERATE:
        return "MODERATE";
    case ComponentCallbacks2.TRIM_MEMORY_BACKGROUND:
        return "BACKGROUND";
    case ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN:
        return "UI_HIDDEN";
    case ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL:
        return "RUNNING_CRITICAL";
    case ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW:
        return "RUNNING_LOW";
    case ComponentCallbacks2.TRIM_MEMORY_RUNNING_MODERATE:
        return "RUNNING_MODERATE";
    default://  w  w w  .j a  v  a 2 s. c om
        return "UNKNOWN";
    }
}

From source file:com.DGSD.Teexter.Utils.ContactPhotoManager.java

@Override
public void onTrimMemory(int level) {
    if (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE) {
        // Clear the caches. Note all pending requests will be removed too.
        clear();//from www  .  ja  v a  2  s.c o  m
    }
}

From source file:com.ape.transfer.util.FileIconLoader.java

@Override
public void onTrimMemory(int level) {
    if (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE) {
        // Clear the caches.  Note all pending requests will be removed too.
        clear();/*from  ww  w  .j  ava  2 s.  co  m*/
    }
}

From source file:github.popeen.dsub.service.DownloadService.java

@Override
public void onTrimMemory(int level) {
    ImageLoader imageLoader = SubsonicActivity.getStaticImageLoader(this);
    if (imageLoader != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        Log.i(TAG, "Memory Trim Level: " + level);
        if (level < ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) {
            if (level >= ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL) {
                imageLoader.onLowMemory(0.75f);
            } else if (level >= ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW) {
                imageLoader.onLowMemory(0.50f);
            } else if (level >= ComponentCallbacks2.TRIM_MEMORY_RUNNING_MODERATE) {
                imageLoader.onLowMemory(0.25f);
            }/*from   w  ww . j  a v  a  2  s .  c  o m*/
        } else if (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE) {
            imageLoader.onLowMemory(0.25f);
        } else if (level >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE) {
            imageLoader.onLowMemory(0.75f);
        }
    }
}

From source file:com.android.contacts.common.ContactPhotoManager.java

@Override
public void onTrimMemory(int level) {
    if (DEBUG)/*from w  ww  .  ja va  2  s.c o m*/
        Log.d(TAG, "onTrimMemory: " + level);
    if (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE) {
        // Clear the caches.  Note all pending requests will be removed too.
        clear();
    }
}

From source file:com.android.launcher2.Launcher.java

@Override
public void onTrimMemory(int level) {
    super.onTrimMemory(level);
    if (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE) {
        mAppsCustomizeTabHost.onTrimMemory();
    }/*from   ww  w .j a  v a2s.c o  m*/
}