Cleaning up the ResourcesUtils

This commit is contained in:
anthony restaino 2017-06-26 22:47:13 -04:00
parent a6c401624c
commit 3437a7fd7a

View File

@ -4,11 +4,21 @@ import android.content.Context;
import android.support.annotation.DimenRes; import android.support.annotation.DimenRes;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
/**
* Utils related to resources.
*/
public final class ResourceUtils { public final class ResourceUtils {
private ResourceUtils() {} private ResourceUtils() {}
/**
* Returns the dimension in pixels.
*
* @param context the context needed to get the dimension.
* @param res the resource to get.
* @return the dimension value in pixels.
*/
public static int dimen(@NonNull Context context, @DimenRes int res) { public static int dimen(@NonNull Context context, @DimenRes int res) {
return Math.round(context.getResources().getDimension(res)); return context.getResources().getDimensionPixelSize(res);
} }
} }