Skip to content

Latest commit

 

History

History
 
 

utilcode

Download

Gradle:

implementation 'com.blankj:utilcode:1.19.0'

How to use

// init it in the function of onCreate in ur Application
Utils.init(application);

Proguard

U needn't do anything, because I add consumerProguardFiles 'proguard-rules.pro' in build.gradle.

APIs

isActivityExists
startActivity
startActivityForResult
startActivities
startHomeActivity
getActivityList
getLauncherActivity
getTopActivity
isActivityExistsInStack
finishActivity
finishToActivity
finishOtherActivities
finishAllActivities
finishAllActivitiesExceptNewest
registerAppStatusChangedListener
unregisterAppStatusChangedListener
installApp
installAppSilent
uninstallApp
uninstallAppSilent
isAppInstalled
isAppRoot
isAppDebug
isAppSystem
isAppForeground
launchApp
relaunchApp
launchAppDetailsSettings
exitApp
getAppIcon
getAppPackageName
getAppName
getAppPath
getAppVersionName
getAppVersionCode
getAppSignature
getAppSignatureSHA1
getAppInfo
getAppsInfo
getStatusBarHeight
setStatusBarVisibility
isStatusBarVisible
setStatusBarLightMode
addMarginTopEqualStatusBarHeight
subtractMarginTopEqualStatusBarHeight
setStatusBarColor
setStatusBarAlpha
setStatusBarColor4Drawer
setStatusBarAlpha4Drawer
getActionBarHeight
setNotificationBarVisibility
getNavBarHeight
setNavBarVisibility
setNavBarImmersive
setNavBarColor
getNavBarColor
isNavBarVisible
getInstance
Instance.put
Instance.getBytes
Instance.getString
Instance.getJSONObject
Instance.getJSONArray
Instance.getBitmap
Instance.getDrawable
Instance.getParcelable
Instance.getSerializable
Instance.getCacheSize
Instance.getCacheCount
Instance.remove
Instance.clear
getInstance
Instance.put
Instance.getBytes
Instance.getString
Instance.getJSONObject
Instance.getJSONArray
Instance.getBitmap
Instance.getDrawable
Instance.getParcelable
Instance.getSerializable
Instance.getCacheDiskSize
Instance.getCacheDiskCount
Instance.getCacheMemoryCount
Instance.remove
Instance.clear
getInstance
Instance.put
Instance.get
Instance.getCacheCount
Instance.remove
Instance.clear
cleanInternalCache
cleanInternalFiles
cleanInternalDbs
cleanInternalDbByName
cleanInternalSp
cleanExternalCache
cleanCustomDir
closeIO
closeIOQuietly
bytes2Bits, bits2Bytes
bytes2Chars, chars2Bytes
bytes2HexString, hexString2Bytes
memorySize2Byte, byte2MemorySize
byte2FitMemorySize
timeSpan2Millis, millis2TimeSpan
millis2FitTimeSpan
input2OutputStream, output2InputStream
inputStream2Bytes, bytes2InputStream
outputStream2Bytes, bytes2OutputStream
inputStream2String, string2InputStream
outputStream2String, string2OutputStream
bitmap2Bytes, bytes2Bitmap
drawable2Bitmap, bitmap2Drawable
drawable2Bytes, bytes2Drawable
view2Bitmap
dp2px, px2dp
sp2px, px2sp
init
isDeviceRooted
getSDKVersionName
getSDKVersionCode
getAndroidID
getMacAddress
getManufacturer
getModel
getABIs
shutdown
reboot
reboot2Recovery
reboot2Bootloader
urlEncode
urlDecode
base64Encode
base64Encode2String
base64Decode
htmlEncode
htmlDecode
encryptMD2, encryptMD2ToString
encryptMD5, encryptMD5ToString
encryptMD5File, encryptMD5File2String
encryptSHA1, encryptSHA1ToString
encryptSHA224, encryptSHA224ToString
encryptSHA256, encryptSHA256ToString
encryptSHA384, encryptSHA384ToString
encryptSHA512, encryptSHA512ToString
encryptHmacMD5, encryptHmacMD5ToString
encryptHmacSHA1, encryptHmacSHA1ToString
encryptHmacSHA224, encryptHmacSHA224ToString
encryptHmacSHA256, encryptHmacSHA256ToString
encryptHmacSHA384, encryptHmacSHA384ToString
encryptHmacSHA512, encryptHmacSHA512ToString
encryptDES, encryptDES2HexString, encryptDES2Base64
decryptDES, decryptHexStringDES, decryptBase64DES
encrypt3DES, encrypt3DES2HexString, encrypt3DES2Base64
decrypt3DES, decryptHexString3DES, decryptBase64_3DES
encryptAES, encryptAES2HexString, encryptAES2Base64
decryptAES, decryptHexStringAES, decryptBase64AES
encryptRSA, encryptRSA2HexString, encryptRSA2Base64
decryptRSA, decryptHexStringRSA, decryptBase64RSA
writeFileFromIS
writeFileFromBytesByStream
writeFileFromBytesByChannel
writeFileFromBytesByMap
writeFileFromString
readFile2List
readFile2String
readFile2BytesByStream
readFile2BytesByChannel
readFile2BytesByMap
setBufferSize
getFileByPath
isFileExists
rename
isDir
isFile
createOrExistsDir
createOrExistsFile
createFileByDeleteOldFile
copyDir
copyFile
moveDir
moveFile
deleteDir
deleteFile
deleteAllInDir
deleteFilesInDir
deleteFilesInDirWithFilter
listFilesInDir
listFilesInDirWithFilter
getFileLastModified
getFileCharsetSimple
getFileLines
getDirSize
getFileSize
getDirLength
getFileLength
getFileMD5
getFileMD5ToString
getDirName
getFileName
getFileNameNoExtension
getFileExtension
add
show
hide
showHide
replace
pop
popTo
popAll
remove
removeTo
removeAll
getTop
getTopInStack
getTopShow
getTopShowInStack
getFragments
getFragmentsInStack
getAllFragments
getAllFragmentsInStack
findFragment
dispatchBackPress
setBackgroundColor
setBackgroundResource
setBackground
bitmap2Bytes, bytes2Bitmap
drawable2Bitmap, bitmap2Drawable
drawable2Bytes, bytes2Drawable
view2Bitmap
getBitmap
scale
clip
skew
rotate
getRotateDegree
toRound
toRoundCorner
addCornerBorder
addCircleBorder
addReflection
addTextWatermark
addImageWatermark
toAlpha
toGray
fastBlur
renderScriptBlur
stackBlur
save
isImage
getImageType
compressByScale
compressByQuality
compressBySampleSize
isIntentAvailable
getInstallAppIntent
getUninstallAppIntent
getLaunchAppIntent
getLaunchAppDetailsSettingsIntent
getShareTextIntent
getShareImageIntent
getComponentIntent
getShutdownIntent
getCaptureIntent
showSoftInput
hideSoftInput
toggleSoftInput
isSoftInputVisible
registerSoftInputChangedListener
unregisterSoftInputChangedListener
fixAndroidBug5497
fixSoftInputLeaks
clickBlankArea2HideSoftInput
getConfig
Config.setLogSwitch
Config.setConsoleSwitch
Config.setGlobalTag
Config.setLogHeadSwitch
Config.setLog2FileSwitch
Config.setDir
Config.setFilePrefix
Config.setBorderSwitch
Config.setSingleTagSwitch
Config.setConsoleFilter
Config.setFileFilter
Config.setStackDeep
Config.setStackOffset
Config.setSaveDays
Config.addFormatter
log
v
vTag
d
dTag
i
iTag
w
wTag
e
eTag
a
aTag
file
json
xml
openWirelessSettings
isConnected
isAvailableByPing
getMobileDataEnabled
setMobileDataEnabled
isMobileData
is4G
getWifiEnabled
setWifiEnabled
isWifiConnected
isWifiAvailable
getNetworkOperatorName
getNetworkType
getIPAddress
getDomainAddress
getIpAddressByWifi
getGatewayByWifi
getNetMaskByWifi
getServerAddressByWifi
isEmpty
isNotEmpty
equals
requireNonNull
getOrDefault
hashCode
getPermissions
isGranted
launchAppDetailsSettings
permission
rationale
callback
theme
request
isPhone
getDeviceId
getSerial
getIMEI
getMEID
getIMSI
getPhoneType
isSimCardReady
getSimOperatorName
getSimOperatorByMnc
getPhoneStatus
dial
call
sendSms
sendSmsSilent
getForegroundProcessName
killAllBackgroundProcesses
killBackgroundProcesses
isMainProcess
getCurrentProcessName
reflect
newInstance
field
method
get
isMobileSimple
isMobileExact
isTel
isIDCard15
isIDCard18
isEmail
isURL
isZh
isUsername
isDate
isIP
isMatch
getMatches
getSplits
getReplaceFirst
getReplaceAll
copyFileFromAssets
readAssets2String
readAssets2List
copyFileFromRaw
readRaw2String
readRaw2List
getScreenWidth
getScreenHeight
getScreenDensity
getScreenDensityDpi
setFullScreen
setNonFullScreen
toggleFullScreen
isFullScreen
setLandscape
setPortrait
isLandscape
isPortrait
getScreenRotation
screenShot
isScreenLock
setSleepDuration
getSleepDuration
isTablet
adaptScreen4VerticalSlide
adaptScreen4HorizontalSlide
cancelAdaptScreen
isAdaptScreen
isSDCardEnableByEnvironment
getSDCardPathByEnvironment
isSDCardEnable
getSDCardPaths
getAllRunningServices
startService
stopService
bindService
unbindService
isServiceRunning
execCmd
dp2px, px2dp
sp2px, px2sp
applyDimension
forceGetViewSize
measureView
getMeasuredWidth
getMeasuredHeight
with
setMessage
setMessageColor
setBgColor
setBgResource
setDuration
setAction
setBottomMargin
show
showSuccess
showWarning
showError
dismiss
getView
addView
setFlag
setForegroundColor
setBackgroundColor
setLineHeight
setQuoteColor
setLeadingMargin
setBullet
setFontSize
setFontProportion
setFontXProportion
setStrikethrough
setUnderline
setSuperscript
setSubscript
setBold
setItalic
setBoldItalic
setFontFamily
setTypeface
setAlign
setClickSpan
setUrl
setBlur
setShader
setShadow
setSpans
append
appendLine
appendImage
appendSpace
create
getInstance
Instance.put
Instance.getString
Instance.getInt
Instance.getLong
Instance.getFloat
Instance.getBoolean
Instance.getAll
Instance.contains
Instance.remove
Instance.clear
isEmpty
isTrimEmpty
isSpace
equals
equalsIgnoreCase
null2Length0
length
upperFirstLetter
lowerFirstLetter
reverse
toDBC
toSBC
isMainThread
getFixedPool
getSinglePool
getCachedPool
getIoPool
getCpuPool
executeByFixed
executeByFixedWithDelay
executeByFixedAtFixRate
executeBySingle
executeBySingleWithDelay
executeBySingleAtFixRate
executeByCached
executeByCachedWithDelay
executeByCachedAtFixRate
executeByIo
executeByIoWithDelay
executeByIoAtFixRate
executeByCpu
executeByCpuWithDelay
executeByCpuAtFixRate
executeByCustom
executeByCustomWithDelay
executeByCustomAtFixRate
cancel
millis2String
string2Millis
string2Date
date2String
date2Millis
millis2Date
getTimeSpan
getFitTimeSpan
getNowMills
getNowString
getNowDate
getTimeSpanByNow
getFitTimeSpanByNow
getFriendlyTimeSpanByNow
getMillis
getString
getDate
getMillisByNow
getStringByNow
getDateByNow
isToday
isLeapYear
getChineseWeek
getUSWeek
getValueByCalendarField
getChineseZodiac
getZodiac
setGravity
setBgColor
setBgResource
setMsgColor
setMsgTextSize
showShort
showLong
showCustomShort
showCustomLong
cancel
file2Uri
uri2File
zipFiles
zipFile
unzipFile
unzipFileByKeyword
getFilesPath
getComments