Class DynamicUnitUtils
java.lang.Object
com.pranavpandey.android.dynamic.util.DynamicUnitUtils
Helper class to perform unit conversions.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
convertDpToPixels
(float dp) Converts DP into pixels.static float
convertDpToSp
(float dp) Converts DP into SP.static int
convertPixelsToDp
(float pixels) Converts pixels into DP.static float
convertPixelsToSp
(float pixels) Converts pixels into SP.static float
convertSpToPixels
(float sp) Converts SP into pixels.
-
Constructor Details
-
DynamicUnitUtils
public DynamicUnitUtils()
-
-
Method Details
-
convertDpToPixels
public static int convertDpToPixels(float dp) Converts DP into pixels.- Parameters:
dp
- The value in DP to be converted into pixels.- Returns:
- The converted value in pixels.
-
convertPixelsToDp
public static int convertPixelsToDp(float pixels) Converts pixels into DP.- Parameters:
pixels
- The value in pixels to be converted into DP.- Returns:
- The converted value in DP.
-
convertSpToPixels
public static float convertSpToPixels(float sp) Converts SP into pixels.- Parameters:
sp
- The value in SP to be converted into pixels.- Returns:
- The converted value in pixels.
-
convertPixelsToSp
public static float convertPixelsToSp(float pixels) Converts pixels into SP.- Parameters:
pixels
- The value in pixels to be converted into SP.- Returns:
- The converted value in SP.
-
convertDpToSp
public static float convertDpToSp(float dp) Converts DP into SP.- Parameters:
dp
- The value in DP to be converted into SP.- Returns:
- The converted value in SP.
-