Package ai.nexconn.chatui.utils.common
Class ChatUIUtils
-
- All Implemented Interfaces:
public class ChatUIUtils
-
-
Field Summary
Fields Modifier and Type Field Description public static intscreenWidthpublic static intscreenHeightpublic static intscreenMinpublic static intscreenMaxpublic static floatdensitypublic static floatscaleDensitypublic static floatxdpipublic static floatydpipublic static intdensityDpipublic static intdialogWidthpublic static intstatusbarheightpublic static intnavbarheight
-
Constructor Summary
Constructors Constructor Description ChatUIUtils()
-
Method Summary
Modifier and Type Method Description static intdip2px(float dipValue)static intpx2dip(float pxValue)static intgetDialogWidth()static voidinit(Context context)static voidGetInfo(Context context)static intgetStatusBarHeight(Context context)static intgetScreenWidth()static intgetScreenHeight()static intgetNavBarHeight(Context context)static DrawablegetDrawable(Context context, String resource)static UrigetUriFromDrawableRes(Context context, int id)static BitmapgetResizedBitmap(Context context, Uri uri, int widthLimit, int heightLimit)static intgetVideoDuration(Context context, String videoPath)Gets the duration of a video file in milliseconds static Stringmd5(Object object)MD5 hash static StringgetAppName(Context context)Gets the application name static booleanisDestroy(Activity activity)static booleanisLocationServiceEnabled(Context context)Checks whether location services are enabled. static booleanphoneIsInUse(Context context)Checks whether a phone call is currently in progress static booleancheckMicAvailable(Context context)static intgetSaveKeyBoardHeight(Context context, int orientation)static voidsaveKeyboardHeight(Context context, int orientation, int height)static booleancheckSDKVersionAndTargetIsTIRAMISU(Context context)static booleancheckSDKVersionAndTargetIsUDC(Context context)Note: this check must be called before checkSDKVersionAndTargetIsTIRAMISU. static voidfixAndroid8ActivityCrash(Activity activity)-
-
Method Detail
-
dip2px
static int dip2px(float dipValue)
-
px2dip
static int px2dip(float pxValue)
-
getDialogWidth
static int getDialogWidth()
-
init
static void init(Context context)
-
GetInfo
static void GetInfo(Context context)
-
getStatusBarHeight
static int getStatusBarHeight(Context context)
-
getScreenWidth
static int getScreenWidth()
-
getScreenHeight
static int getScreenHeight()
-
getNavBarHeight
static int getNavBarHeight(Context context)
-
getDrawable
static Drawable getDrawable(Context context, String resource)
-
getUriFromDrawableRes
static Uri getUriFromDrawableRes(Context context, int id)
-
getResizedBitmap
static Bitmap getResizedBitmap(Context context, Uri uri, int widthLimit, int heightLimit)
-
getVideoDuration
static int getVideoDuration(Context context, String videoPath)
Gets the duration of a video file in milliseconds
-
md5
static String md5(Object object)
MD5 hash
-
getAppName
@Deprecated() static String getAppName(Context context)
Gets the application name
-
isDestroy
static boolean isDestroy(Activity activity)
-
isLocationServiceEnabled
static boolean isLocationServiceEnabled(Context context)
Checks whether location services are enabled. The check method varies across different Android versions.
-
phoneIsInUse
static boolean phoneIsInUse(Context context)
Checks whether a phone call is currently in progress
-
checkMicAvailable
static boolean checkMicAvailable(Context context)
-
getSaveKeyBoardHeight
static int getSaveKeyBoardHeight(Context context, int orientation)
-
saveKeyboardHeight
static void saveKeyboardHeight(Context context, int orientation, int height)
-
checkSDKVersionAndTargetIsTIRAMISU
static boolean checkSDKVersionAndTargetIsTIRAMISU(Context context)
-
checkSDKVersionAndTargetIsUDC
static boolean checkSDKVersionAndTargetIsUDC(Context context)
Note: this check must be called before checkSDKVersionAndTargetIsTIRAMISU.
- Parameters:
context- context- Returns:
true if both the system version and targetSdkVersion are >= 34
-
fixAndroid8ActivityCrash
static void fixAndroid8ActivityCrash(Activity activity)
-
-
-
-