diff --git a/WordPressUtils/src/main/java/org/wordpress/android/util/DisplayUtils.java b/WordPressUtils/src/main/java/org/wordpress/android/util/DisplayUtils.java index fd4cbb5df5be..40a017e9a336 100644 --- a/WordPressUtils/src/main/java/org/wordpress/android/util/DisplayUtils.java +++ b/WordPressUtils/src/main/java/org/wordpress/android/util/DisplayUtils.java @@ -38,6 +38,12 @@ public static int getDisplayPixelHeight(Context context) { return (size.y); } + public static float spToPx(Context context, float sp){ + DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); + final float scale = displayMetrics.scaledDensity; + return sp * scale; + } + public static int dpToPx(Context context, int dp) { float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics());