| 4 | import android.graphics.drawable.Drawable; |
| 5 | |
| 6 | public class Compatibility |
| 7 | { |
| 8 | |
| 9 | @SuppressWarnings("deprecation") |
| 10 | public static Drawable getDrawable(Context context, int id) |
| 11 | { |
| 12 | // Context.getDrawable() added in API level 21 |
| 13 | if(android.os.Build.VERSION.SDK_INT >= 21) |
| 14 | return context.getDrawable(id/*, context.getTheme()*/); |
| 15 | else |
| 16 | return context.getResources().getDrawable(id); |
| 17 | } |
| 18 | |
| 19 | @SuppressWarnings("deprecation") |
| 20 | public static int getColor(Context context, int id) |
| 21 | { |
| 22 | // Context.getColor() added in API level 23 |
| 23 | if(android.os.Build.VERSION.SDK_INT >= 23) |
| 24 | return context.getColor(id/*, context.getTheme()*/); |
| 25 | else |
| 26 | return context.getResources().getColor(id); |
| 27 | } |
| 28 | } |
nothing calls this directly
no outgoing calls
no test coverage detected