From 3437a7fd7a62c2e398eb31385f111ef2db2952ee Mon Sep 17 00:00:00 2001 From: anthony restaino Date: Mon, 26 Jun 2017 22:47:13 -0400 Subject: [PATCH] Cleaning up the ResourcesUtils --- .../acr/browser/lightning/utils/ResourceUtils.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/acr/browser/lightning/utils/ResourceUtils.java b/app/src/main/java/acr/browser/lightning/utils/ResourceUtils.java index e2e85c8..5892e5c 100644 --- a/app/src/main/java/acr/browser/lightning/utils/ResourceUtils.java +++ b/app/src/main/java/acr/browser/lightning/utils/ResourceUtils.java @@ -4,11 +4,21 @@ import android.content.Context; import android.support.annotation.DimenRes; import android.support.annotation.NonNull; +/** + * Utils related to resources. + */ public final class 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) { - return Math.round(context.getResources().getDimension(res)); + return context.getResources().getDimensionPixelSize(res); } }