@Test public void testGetColor() throws Throwable { assertEquals("Unthemed color load", ResourcesCompat.getColor(mResources, R.color.text_color, null), 0xFFFF8090); if (Build.VERSION.SDK_INT >= 23) { final Resources.Theme yellowTheme = mResources.newTheme(); yellowTheme.applyStyle(R.style.YellowTheme, true); assertEquals("Themed yellow color load", 0xFFF0B000, ResourcesCompat.getColor(mResources, R.color.simple_themed_selector, yellowTheme)); final Resources.Theme lilacTheme = mResources.newTheme(); lilacTheme.applyStyle(R.style.LilacTheme, true); assertEquals("Themed lilac color load", 0xFFF080F0, ResourcesCompat.getColor(mResources, R.color.simple_themed_selector, lilacTheme)); } }
@ColorInt @SuppressWarnings("deprecation") public static int getColor(@NonNull Resources res, @ColorRes int id, @Nullable Theme theme) throws NotFoundException { if (SDK_INT >= 23) { return res.getColor(id, theme); } else { return res.getColor(id); } }
ResourcesCompat { @ColorInt @SuppressWarnings("deprecation") public static int getColor(@NonNull Resources res, @ColorRes int id, @Nullable Theme theme) throws NotFoundException { if (SDK_INT >= 23) { return res.getColor(id, theme); } else { return res.getColor(id); } } }
ResourcesCompat { @ColorInt @SuppressWarnings("deprecation") public static int getColor(@NonNull Resources res, @ColorRes int id, @Nullable Theme theme) throws NotFoundException { if (SDK_INT >= 23) { return res.getColor(id, theme); } else { return res.getColor(id); } } private  ResourcesCompat(); }
ResourcesCompat { @ColorInt @SuppressWarnings("deprecation") public static int getColor(@NonNull Resources res, @ColorRes int id, @Nullable Theme theme) throws NotFoundException { if (SDK_INT >= 23) { return res.getColor(id, theme); } else { return res.getColor(id); } } private  ResourcesCompat(); @Nullable @SuppressWarnings("deprecation") static Drawable getDrawable(@NonNull Resources res, @DrawableRes int id,
            @Nullable Theme theme); @Nullable @SuppressWarnings("deprecation") static Drawable getDrawableForDensity(@NonNull Resources res, @DrawableRes int id,
            int density, @Nullable Theme theme); @ColorInt @SuppressWarnings("deprecation") static int getColor(@NonNull Resources res, @ColorRes int id, @Nullable Theme theme); @Nullable @SuppressWarnings("deprecation") static ColorStateList getColorStateList(@NonNull Resources res, @ColorRes int id,
            @Nullable Theme theme); @Nullable static Typeface getFont(@NonNull Context context, @FontRes int id); static void getFont(@NonNull Context context, @FontRes int id,
            @NonNull FontCallback fontCallback, @Nullable Handler handler); @RestrictTo(LIBRARY_GROUP) static Typeface getFont(@NonNull Context context, @FontRes int id, TypedValue value,
            int style, @Nullable FontCallback fontCallback); }
ResourcesCompat { @ColorInt @SuppressWarnings("deprecation") public static int getColor(@NonNull Resources res, @ColorRes int id, @Nullable Theme theme) throws NotFoundException { if (SDK_INT >= 23) { return res.getColor(id, theme); } else { return res.getColor(id); } } private  ResourcesCompat(); @Nullable @SuppressWarnings("deprecation") static Drawable getDrawable(@NonNull Resources res, @DrawableRes int id,
            @Nullable Theme theme); @Nullable @SuppressWarnings("deprecation") static Drawable getDrawableForDensity(@NonNull Resources res, @DrawableRes int id,
            int density, @Nullable Theme theme); @ColorInt @SuppressWarnings("deprecation") static int getColor(@NonNull Resources res, @ColorRes int id, @Nullable Theme theme); @Nullable @SuppressWarnings("deprecation") static ColorStateList getColorStateList(@NonNull Resources res, @ColorRes int id,
            @Nullable Theme theme); @Nullable static Typeface getFont(@NonNull Context context, @FontRes int id); static void getFont(@NonNull Context context, @FontRes int id,
            @NonNull FontCallback fontCallback, @Nullable Handler handler); @RestrictTo(LIBRARY_GROUP) static Typeface getFont(@NonNull Context context, @FontRes int id, TypedValue value,
            int style, @Nullable FontCallback fontCallback);  }