/**
 * @author - Nicklass Fransson
 * @contact - nicklass.fransson@gmail.com
 * @date - 12/2/16
 */
package com.astir_trotter.atcustom.util;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.ArrayRes;
import android.support.annotation.BoolRes;
import android.support.annotation.ColorRes;
import android.support.annotation.DimenRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.IntegerRes;
import android.support.annotation.StringRes;

import com.astir_trotter.atcustom.singleton.Cache;


public class ResourceUtils {
    private static final String TAG = ResourceUtils.class.getSimpleName();

    public static String getString(@StringRes int resId) {
        return Cache.getInstance().getContext().getResources().getString(resId);
    }

    public static String[] getStrings(@ArrayRes int resId) {
        return Cache.getInstance().getContext().getResources().getStringArray(resId);
    }

    public static int getInteger(@IntegerRes int resId) {
        return Cache.getInstance().getContext().getResources().getInteger(resId);
    }

    public static int[] getIntegers(@ArrayRes int resId) {
        return Cache.getInstance().getContext().getResources().getIntArray(resId);
    }

    public static boolean getBool(@BoolRes int resId) {
        return Cache.getInstance().getContext().getResources().getBoolean(resId);
    }

    public static int getColor(@ColorRes int resId) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
            return Cache.getInstance().getContext().getColor(resId);
        else
            return Cache.getInstance().getContext().getResources().getColor(resId);
    }

    public static int[] getColors(@ArrayRes int resId) {
        return getIntegers(resId);
    }

    public static int getDimension(Context context, @DimenRes int resId) {
        return context.getResources().getDimensionPixelSize(resId);
    }

    public static Drawable getDrawable(Context context, @DrawableRes int drawableId) {
        return context.getResources().getDrawable(drawableId);
    }
}

@@ -547,16 +547,65 @@
 ringRes;
+%0Aimport android.support.v4.content.ContextCompat;
 %0A%0Aimport
@@ -1564,161 +1564,38 @@
     
-if (Build.VERSION.SDK_INT %3E= Build.VERSION_CODES.M)%0A            return Cache.getInstance().getContext().getColor(resId);%0A        else%0A            return 
+return ContextCompat.getColor(
 Cach
@@ -1626,33 +1626,10 @@
 xt()
-.getResources().getColor(
+, 
 resI

update resource utils