Skip to content

Commit

Permalink
Use newer api when avaliable for byte count
Browse files Browse the repository at this point in the history
  • Loading branch information
DHuckaby committed Jan 26, 2014
1 parent 875f724 commit 07740a1
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Build;
import android.support.v4.util.LruCache;
import com.handlerexploit.prime.MemoryCache;

Expand All @@ -17,7 +18,11 @@ public BitmapMemoryLruCache(Resources resources, int maxSize) {

@Override
public int sizeOf(String key, BitmapDrawable value) {
return value.getBitmap().getRowBytes() * value.getBitmap().getHeight();
if (Build.VERSION.SDK_INT >= 11) {
return value.getBitmap().getByteCount();
} else {
return value.getBitmap().getRowBytes() * value.getBitmap().getHeight();
}
}

@Override
Expand Down

0 comments on commit 07740a1

Please sign in to comment.