Class DynamicUnitUtils

java.lang.Object
com.pranavpandey.android.dynamic.util.DynamicUnitUtils

public class DynamicUnitUtils extends Object
Helper class to perform unit conversions.
  • 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.