From 9f550c2116ee1e33f2173e3999a28ca86146ef7c Mon Sep 17 00:00:00 2001 From: Sam Judd Date: Sat, 15 Aug 2015 11:01:25 -0700 Subject: [PATCH] Don't rely on short-circuiting for sdk checks. Fixes #578. --- .../glide/load/engine/cache/MemorySizeCalculator.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/library/src/main/java/com/bumptech/glide/load/engine/cache/MemorySizeCalculator.java b/library/src/main/java/com/bumptech/glide/load/engine/cache/MemorySizeCalculator.java index 3fdd73545e..9024566399 100644 --- a/library/src/main/java/com/bumptech/glide/load/engine/cache/MemorySizeCalculator.java +++ b/library/src/main/java/com/bumptech/glide/load/engine/cache/MemorySizeCalculator.java @@ -92,9 +92,11 @@ private String toMb(int bytes) { @TargetApi(Build.VERSION_CODES.KITKAT) private static boolean isLowMemoryDevice(ActivityManager activityManager) { - final int sdkInt = Build.VERSION.SDK_INT; - return sdkInt < Build.VERSION_CODES.HONEYCOMB - || (sdkInt >= Build.VERSION_CODES.KITKAT && activityManager.isLowRamDevice()); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + return activityManager.isLowRamDevice(); + } else { + return Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB; + } } private static class DisplayMetricsScreenDimensions implements ScreenDimensions {