Merge pull request #1190 from mfietz/memory_management

Glide memory management
This commit is contained in:
Tom Hennen 2015-09-09 18:37:27 -04:00
commit 2555df3bd2
1 changed files with 18 additions and 0 deletions

View File

@ -1,5 +1,6 @@
package de.danoeh.antennapod.activity;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
@ -9,6 +10,7 @@ import android.content.res.Configuration;
import android.database.DataSetObserver;
import android.media.AudioManager;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
@ -27,6 +29,8 @@ import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import com.bumptech.glide.Glide;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.Validate;
@ -482,6 +486,20 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
}
}
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public void onTrimMemory(int level) {
super.onTrimMemory(level);
Glide.get(this).trimMemory(level);
}
@Override
public void onLowMemory() {
super.onLowMemory();
Glide.get(this).clearMemory();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (drawerToggle.onOptionsItemSelected(item)) {