Skip to content

Latest commit

 

History

History
1478 lines (1320 loc) · 41.6 KB

README.md

File metadata and controls

1478 lines (1320 loc) · 41.6 KB

Download

Gradle:

// if u use AndroidX, use the following
implementation 'com.blankj:utilcodex:1.31.1'

// Not in maintenance
implementation 'com.blankj:utilcode:1.30.7'

APIs

addActivityLifecycleCallbacks
removeActivityLifecycleCallbacks
getAliveActivityByContext
getActivityByContext
isActivityExists
startActivity
startActivityForResult
startActivities
startHomeActivity
getActivityList
getLauncherActivity
getMainActivities
getTopActivity
isActivityAlive
isActivityExistsInStack
finishActivity
finishToActivity
finishOtherActivities
finishAllActivities
finishAllActivitiesExceptNewest
adaptWidth
adaptHeight
closeAdapt
pt2Px
px2Pt
getApi
registerAppStatusChangedListener
unregisterAppStatusChangedListener
installApp
uninstallApp
isAppInstalled
isAppRoot
isAppDebug
isAppSystem
isAppForeground
isAppRunning
launchApp
relaunchApp
launchAppDetailsSettings
exitApp
getAppIcon
getAppPackageName
getAppName
getAppPath
getAppVersionName
getAppVersionCode
getAppMinSdkVersion
getAppTargetSdkVersion
getAppSignatures
getAppSignaturesSHA1
getAppSignaturesSHA256
getAppSignaturesMD5
getAppInfo
getAppsInfo
getApkInfo
newArray
newLongArray
newIntArray
newShortArray
newCharArray
newByteArray
newDoubleArray
newFloatArray
newBooleanArray
isEmpty
getLength
isSameLength
get
set
equals
reverse
copy
subArray
add
remove
removeElement
indexOf
lastIndexOf
contains
toPrimitive
toObject
asList
asUnmodifiableList
asArrayList
asLinkedList
sort
forAllDo
toString
getStatusBarHeight
setStatusBarVisibility
isStatusBarVisible
setStatusBarLightMode
isStatusBarLightMode
addMarginTopEqualStatusBarHeight
subtractMarginTopEqualStatusBarHeight
setStatusBarColor
setStatusBarColor4Drawer
transparentStatusBar
getActionBarHeight
setNotificationBarVisibility
getNavBarHeight
setNavBarVisibility
isNavBarVisible
setNavBarColor
getNavBarColor
isSupportNavBar
setNavBarLightMode
isNavBarLightMode
transparentNavBar
isAutoBrightnessEnabled
setAutoBrightnessEnabled
getBrightness
setBrightness
setWindowBrightness
getWindowBrightness
register
unregister
post
postSticky
removeSticky
toString_
setDefaultCacheDiskUtils
put
getBytes
getString
getJSONObject
getJSONArray
getBitmap
getDrawable
getParcelable
getSerializable
getCacheSize
getCacheCount
remove
clear
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
setDefaultCacheDoubleUtils
put
getBytes
getString
getJSONObject
getJSONArray
getBitmap
getDrawable
getParcelable
getSerializable
getCacheDiskSize
getCacheDiskCount
getCacheMemoryCount
remove
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
setDefaultCacheMemoryUtils
put
get
getCacheCount
remove
clear
getInstance
Instance.put
Instance.get
Instance.getCacheCount
Instance.remove
Instance.clear
cleanInternalCache
cleanInternalFiles
cleanInternalDbs
cleanInternalDbByName
cleanInternalSp
cleanExternalCache
cleanCustomDir
applyPressedViewScale
applyPressedViewAlpha
applyPressedBgAlpha
applyPressedBgDark
applySingleDebouncing
applyGlobalDebouncing
expandClickArea
back2HomeFriendly
ClickUtils#OnDebouncingClickListener
ClickUtils#OnMultiClickListener
copyText
getText
copyUri
getUri
copyIntent
getIntent
addChangedListener
removeChangedListener
deepClone
closeIO
closeIOQuietly
newUnmodifiableList[NotNull]: 新建只读[非空]链表
newArrayList[NotNull]       : 新建数组型[非空]链表
newLinkedList[NotNull]      : 新建指针型[非空]链表
newHashSet[NotNull]         : 新建哈希[非空]集合
newTreeSet[NotNull]         : 新建有序[非空]集合
newSynchronizedCollection
newUnmodifiableCollection
union
intersection
disjunction
subtract
containsAny
getCardinalityMap
isSubCollection
isProperSubCollection
isEqualCollection
cardinality
find
forAllDo
filter
select
selectRejected
transform
collect
countMatches
exists
addIgnoreNull
addAll
get
size
sizeIsEmpty
isEmpty
isNotEmpty
retainAll
removeAll
toString
getColor
setAlphaComponent
setRedComponent
setGreenComponent
setBlueComponent
string2Int
int2RgbString
int2ArgbString
getRandomColor
isLightColor
int2HexString, hexString2Int
bytes2Bits, bits2Bytes
bytes2Chars, chars2Bytes
bytes2HexString, hexString2Bytes
bytes2String, string2Bytes
bytes2JSONObject, jsonObject2Bytes
bytes2JSONArray, jsonArray2Bytes
bytes2Parcelable, parcelable2Bytes
bytes2Object, serializable2Bytes
bytes2Bitmap, bitmap2Bytes
memorySize2Byte, byte2MemorySize
byte2FitMemorySize
timeSpan2Millis, millis2TimeSpan
millis2FitTimeSpan
input2OutputStream, output2InputStream
inputStream2Bytes, bytes2InputStream
outputStream2Bytes, bytes2OutputStream
inputStream2String, string2InputStream
outputStream2String, string2OutputStream
inputStream2Lines
drawable2Bitmap, bitmap2Drawable
drawable2Bytes, bytes2Drawable
view2Bitmap
dp2px, px2dp
sp2px, px2sp
init
CrashInfo.addExtraHead
CrashInfo.getThrowable
CrashInfo.toString
isValid
isDeviceRooted
isAdbEnabled
getSDKVersionName
getSDKVersionCode
getAndroidID
getMacAddress
getManufacturer
getModel
getABIs
isTablet
isEmulator
isDevelopmentSettingsEnabled
getUniqueDeviceId
isSameDevice
isFlashlightEnable
isFlashlightOn
setFlashlightStatus
destroy
urlEncode
urlDecode
base64Encode
base64Encode2String
base64Decode
htmlEncode
htmlDecode
binaryEncode
binaryDecode
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
rc4
writeFileFromIS
writeFileFromBytesByStream
writeFileFromBytesByChannel
writeFileFromBytesByMap
writeFileFromString
readFile2List
readFile2String
readFile2BytesByStream
readFile2BytesByChannel
readFile2BytesByMap
setBufferSize
getFileByPath
isFileExists
rename
isDir
isFile
createOrExistsDir
createOrExistsFile
createFileByDeleteOldFile
copy
move
delete
deleteAllInDir
deleteFilesInDir
deleteFilesInDirWithFilter
listFilesInDir
listFilesInDirWithFilter
getFileLastModified
getFileCharsetSimple
getFileLines
getSize
getLength
getFileMD5
getFileMD5ToString
getDirName
getFileName
getFileNameNoExtension
getFileExtension
notifySystemToScan
getFsTotalSize
getFsAvailableSize
add
show
hide
showHide
replace
pop
popTo
popAll
remove
removeTo
removeAll
getTop
getTopInStack
getTopShow
getTopShowInStack
getFragments
getFragmentsInStack
getAllFragments
getAllFragmentsInStack
findFragment
dispatchBackPress
setBackgroundColor
setBackgroundResource
setBackground
setGsonDelegate
setGson
getGson
toJson
fromJson
getListType
getSetType
getMapType
getArrayType
getType
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
save2Album
isImage
getImageType
compressByScale
compressByQuality
compressBySampleSize
getSize
isIntentAvailable
getInstallAppIntent
getUninstallAppIntent
getLaunchAppIntent
getLaunchAppDetailsSettingsIntent
getShareTextIntent
getShareImageIntent
getShareTextImageIntent
getComponentIntent
getShutdownIntent
getCaptureIntent
showSoftInput
hideSoftInput
toggleSoftInput
isSoftInputVisible
registerSoftInputChangedListener
unregisterSoftInputChangedListener
fixAndroidBug5497
fixSoftInputLeaks
clickBlankArea2HideSoftInput
applySystemLanguage
applyLanguage
isAppliedLanguage
getAppliedLanguage
getContextLanguage
getAppContextLanguage
getSystemLanguage
updateAppContextLanguage
attachBaseContext
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
Config.setFileWriter
Config.setOnConsoleOutputListener
Config.setOnFileOutputListener
Config.addFileExtraHead
log
v
vTag
d
dTag
i
iTag
w
wTag
e
eTag
a
aTag
file
json
xml
getCurrentLogFilePath
getLogFiles
newUnmodifiableMap
newHashMap
newLinkedHashMap
newTreeMap
newHashTable
isEmpty
isNotEmpty
size
forAllDo
transform
toString
getMetaDataInApp
getMetaDataInActivity
getMetaDataInService
getMetaDataInReceiver
openWirelessSettings
isConnected
isAvailable[Async]                      : 判断网络是否可用
isAvailableByPing[Async]                : 用 ping 判断网络是否可用
isAvailableByDns[Async]                 : 用 DNS 判断网络是否可用
getMobileDataEnabled
isMobileData
is4G
getWifiEnabled
setWifiEnabled
isWifiConnected
isWifiAvailable[Async]                  : 判断 wifi 数据是否可用
getNetworkOperatorName
getNetworkType
getIPAddress[Async]                     : 获取 IP 地址
getDomainAddress[Async]                 : 获取域名 IP 地址
getIpAddressByWifi
getGatewayByWifi
getNetMaskByWifi
getServerAddressByWifi
registerNetworkStatusChangedListener
isRegisteredNetworkStatusChangedListener
unregisterNetworkStatusChangedListener
getWifiScanResult
addOnWifiChangedConsumer
removeOnWifiChangedConsumer
areNotificationsEnabled
notify
cancel
cancelAll
setNotificationBarVisibility
format
float2Double
isEmpty
isNotEmpty
equals
compare
requireNonNull(s)
getOrDefault
toString
hashCode(s)
join
getRootPath
getDataPath
getDownloadCachePath
getInternalAppDataPath
getInternalAppCodeCacheDir
getInternalAppCachePath
getInternalAppDbsPath
getInternalAppDbPath
getInternalAppFilesPath
getInternalAppSpPath
getInternalAppNoBackupFilesPath
getExternalStoragePath
getExternalMusicPath
getExternalPodcastsPath
getExternalRingtonesPath
getExternalAlarmsPath
getExternalNotificationsPath
getExternalPicturesPath
getExternalMoviesPath
getExternalDownloadsPath
getExternalDcimPath
getExternalDocumentsPath
getExternalAppDataPath
getExternalAppCachePath
getExternalAppFilesPath
getExternalAppMusicPath
getExternalAppPodcastsPath
getExternalAppRingtonesPath
getExternalAppAlarmsPath
getExternalAppNotificationsPath
getExternalAppPicturesPath
getExternalAppMoviesPath
getExternalAppDownloadPath
getExternalAppDcimPath
getExternalAppDocumentsPath
getExternalAppObbPath
getRootPathExternalFirst
getAppDataPathExternalFirst
getFilesPathExternalFirst
getCachePathExternalFirst
permission
permissionGroup
permission.explain
permission.rationale
permission.callback
permission.theme
permission.request
getPermissions
isGranted
isGrantedWriteSettings
requestWriteSettings
isGrantedDrawOverlays
requestDrawOverlays
launchAppDetailsSettings
isPhone
getDeviceId
getSerial
getIMEI
getMEID
getIMSI
getPhoneType
isSimCardReady
getSimOperatorName
getSimOperatorByMnc
dial
call
sendSms
getForegroundProcessName
killAllBackgroundProcesses
killBackgroundProcesses
isMainProcess
getCurrentProcessName
reflect
newInstance
field
method
get
isMobileSimple
isMobileExact
isTel
isIDCard15
isIDCard18
isIDCard18Exact
isEmail
isURL
isZh
isUsername
isDate
isIP
isMatch
getMatches
getSplits
getReplaceFirst
getReplaceAll
RegexConstants.REGEX_DOUBLE_BYTE_CHAR
RegexConstants.REGEX_BLANK_LINE
RegexConstants.REGEX_QQ_NUM
RegexConstants.REGEX_CHINA_POSTAL_CODE
RegexConstants.REGEX_INTEGER
RegexConstants.REGEX_POSITIVE_INTEGER
RegexConstants.REGEX_NEGATIVE_INTEGER
RegexConstants.REGEX_NOT_NEGATIVE_INTEGER
RegexConstants.REGEX_NOT_POSITIVE_INTEGER
RegexConstants.REGEX_FLOAT
RegexConstants.REGEX_POSITIVE_FLOAT
RegexConstants.REGEX_NEGATIVE_FLOAT
RegexConstants.REGEX_NOT_NEGATIVE_FLOAT
RegexConstants.REGEX_NOT_POSITIVE_FLOAT
getDrawable
getIdByName
getStringIdByName
getColorIdByName
getDimenIdByName
getDrawableIdByName
getMipmapIdByName
getLayoutIdByName
getStyleIdByName
getAnimIdByName
getMenuIdByName
copyFileFromAssets
readAssets2String
readAssets2List
copyFileFromRaw
readRaw2String
readRaw2List
isHuawei
isVivo
isXiaomi
isOppo
isLeeco
is360
isZte
isOneplus
isNubia
isCoolpad
isLg
isGoogle
isSamsung
isMeizu
isLenovo
isSmartisan
isHtc
isSony
isGionee
isMotorola
getRomInfo
getScreenWidth
getScreenHeight
getAppScreenWidth
getAppScreenHeight
getScreenDensity
getScreenDensityDpi
setFullScreen
setNonFullScreen
toggleFullScreen
isFullScreen
setLandscape
setPortrait
isLandscape
isPortrait
getScreenRotation
screenShot
isScreenLock
setSleepDuration
getSleepDuration
isSDCardEnableByEnvironment
getSDCardPathByEnvironment
getSDCardInfo
getMountedSDCardPath
getExternalTotalSize
getExternalAvailableSize
getInternalTotalSize
getInternalAvailableSize
getAllRunningServices
startService
stopService
bindService
unbindService
isServiceRunning
apply
execCmd[Async]: 执行命令
dp2px, px2dp
sp2px, px2sp
applyDimension
forceGetViewSize
measureView
getMeasuredWidth
getMeasuredHeight
with
setMessage
setMessageColor
setBgColor
setBgResource
setDuration
setAction
setBottomMargin
show
showSuccess
showWarning
showError
dismiss
getView
addView
with
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
setDefaultSPUtils
put
getString
getInt
getLong
getFloat
getBoolean
getAll
contains
remove
clear
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
getString
getStringArray
format
isMainThread
getMainHandler
runOnUiThread
runOnUiThreadDelayed
getFixedPool
getSinglePool
getCachedPool
getIoPool
getCpuPool
executeByFixed
executeByFixedWithDelay
executeByFixedAtFixRate
executeBySingle
executeBySingleWithDelay
executeBySingleAtFixRate
executeByCached
executeByCachedWithDelay
executeByCachedAtFixRate
executeByIo
executeByIoWithDelay
executeByIoAtFixRate
executeByCpu
executeByCpuWithDelay
executeByCpuAtFixRate
executeByCustom
executeByCustomWithDelay
executeByCustomAtFixRate
cancel
setDeliver
getSafeDateFormat
millis2String
string2Millis
string2Date
date2String
date2Millis
millis2Date
getTimeSpan
getFitTimeSpan
getNowMills
getNowString
getNowDate
getTimeSpanByNow
getFitTimeSpanByNow
getFriendlyTimeSpanByNow
getMillis
getString
getDate
getMillisByNow
getStringByNow
getDateByNow
isToday
isLeapYear
getChineseWeek
getUSWeek
isAm
isPm
getValueByCalendarField
getChineseZodiac
getZodiac
make
make.setMode
make.setGravity
make.setBgColor
make.setBgResource
make.setTextColor
make.setTextSize
make.setDurationIsLong
make.setLeftIcon
make.setTopIcon
make.setRightIcon
make.setBottomIcon
make.setNotUseSystemToast
make.show
getDefaultMaker
showShort
showLong
cancel
setOnTouchListener
send
addListener
removeListener
res2Uri
file2Uri
uri2File
uri2FileNoCacheCopy
uri2Bytes
start
start
vibrate
cancel
setViewEnabled
runOnUiThread
runOnUiThreadDelayed
isLayoutRtl
fixScrollViewTopping
layoutId2View
getVolume
setVolume
getMaxVolume
getMinVolume
zipFiles
zipFile
unzipFile
unzipFileByKeyword
getFilesPath
getComments