-
@RestrictTo(value = LIBRARY_GROUP) public class Utils
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringTAGpublic static booleansIsGlobalCapturing
-
Method Summary
Modifier and Type Method Description static floatdp2px(Resources res, float dp)Convert dp to px static floatsp2px(Resources res, float sp)Convert sp to px static intgetNavigationBarHeight(View view)Get the height of the navigation bar at the bottom of the mobile phone static voidroundedRectPath(RectF rect, float radius, Path path)static BitmapensureSoftwareBitmap(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 voiddisableHardwareBitmapsInView(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. -
-
Method Detail
-
dp2px
static float dp2px(Resources res, float dp)
Convert dp to px
- Parameters:
res- Resourcesdp- The dp value to be converted
-
sp2px
static float sp2px(Resources res, float sp)
Convert sp to px
- Parameters:
res- Resourcessp- 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
-
roundedRectPath
static void roundedRectPath(RectF rect, float radius, Path path)
-
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.
-
-
-
-