We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8a01665 commit ab1f64fCopy full SHA for ab1f64f
WordPressUtils/src/main/java/org/wordpress/android/util/DisplayUtils.java
@@ -38,6 +38,12 @@ public static int getDisplayPixelHeight(Context context) {
38
return (size.y);
39
}
40
41
+ public static float spToPx(Context context, float sp){
42
+ DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
43
+ final float scale = displayMetrics.scaledDensity;
44
+ return sp * scale;
45
+ }
46
+
47
public static int dpToPx(Context context, int dp) {
48
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp,
49
context.getResources().getDisplayMetrics());
0 commit comments