Created
January 10, 2018 08:33
-
-
Save saurabharora90/219ec8f926755607d80a7b41d8ea7a6e to your computer and use it in GitHub Desktop.
Performance at Viki
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:drawable="@color/gray"/> | |
</selector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static @DrawableRes int getPlaceHolder(Context context, @DrawableRes int actualPlaceholder) { | |
if(isLowRamDevice(context)) | |
return R.drawable.low_ram_placeholder; | |
else | |
return actualPlaceholder; | |
} | |
public static boolean isLowRamDevice(Context context) { | |
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); | |
return activityManager != null && ActivityManagerCompat.isLowRamDevice(activityManager); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment