Package 

Class Utils

    • Method Summary

      Modifier and Type Method Description
      static float dp2px(Resources res, float dp) Convert dp to px
      static float sp2px(Resources res, float sp) Convert sp to px
      static int getNavigationBarHeight(View view) Get the height of the navigation bar at the bottom of the mobile phone
      static void roundedRectPath(RectF rect, float radius, Path path)
      static Bitmap ensureSoftwareBitmap(Bitmap bitmap) Ensure bitmap is software-compatible for blur processing.Converts hardware bitmaps to software bitmaps to prevent"Software rendering doesn't support hardware bitmaps" error.
      static void disableHardwareBitmapsInView(View view) Recursively disable hardware bitmaps in a view hierarchy.This prevents "Software rendering doesn't support hardware bitmaps" errorswhen views are drawn onto software canvases for blur processing.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • dp2px

         static float dp2px(Resources res, float dp)

        Convert dp to px

        Parameters:
        res - Resources
        dp - The dp value to be converted
      • sp2px

         static float sp2px(Resources res, float sp)

        Convert sp to px

        Parameters:
        res - Resources
        sp - The sp value to be converted
      • getNavigationBarHeight

         static int getNavigationBarHeight(View view)

        Get the height of the navigation bar at the bottom of the mobile phone

        Parameters:
        view - Root View
      • ensureSoftwareBitmap

         static Bitmap ensureSoftwareBitmap(Bitmap bitmap)

        Ensure bitmap is software-compatible for blur processing.Converts hardware bitmaps to software bitmaps to prevent"Software rendering doesn't support hardware bitmaps" error.

        Parameters:
        bitmap - The bitmap to check
      • disableHardwareBitmapsInView

         static void disableHardwareBitmapsInView(View view)

        Recursively disable hardware bitmaps in a view hierarchy.This prevents "Software rendering doesn't support hardware bitmaps" errorswhen views are drawn onto software canvases for blur processing.