🔥 Android developers should collect the following utils
README of Chinese
API
-
ActivityUtils.java→Demo
About Activity→
isActivityExists
startActivity
getLauncherActivity
getTopActivity
-
AppUtils.java→Demo
About App→
isInstallApp
installApp
installAppSilent
uninstallApp
uninstallAppSilent
isAppRoot
launchApp
getAppPackageName
getAppDetailsSettings
getAppName
getAppIcon
getAppPath
getAppVersionName
getAppVersionCode
isSystemApp
isAppDebug
getAppSignature
getAppSignatureSHA1
isAppForeground
getForegroundApp
getAppInfo
getAppsInfo
cleanAppData
-
BarUtils.java
About Bar→
setTransparentStatusBar
hideStatusBar
getStatusBarHeight
isStatusBarExists
getActionBarHeight
showNotificationBar
hideNotificationBar
-
CacheUtils.java→Test
About Cache→
getInstance
put
getBytes
getString
getJSONObject
getJSONArray
getBitmap
getDrawable
getParcelable
getSerializable
getCacheSize
getCacheCount
remove
clear
-
CleanUtils.java→Demo
About Clean→
cleanInternalCache
cleanInternalFiles
cleanInternalDbs
cleanInternalDbByName
cleanInternalSP
cleanExternalCache
cleanCustomCache
-
ClipboardUtils.java
About Clipboard→
copyText
getText
copyUri
getUri
copyIntent
getIntent
-
CloseUtils.java
About Close→
closeIO
closeIOQuietly
-
ConvertUtils.java→Test
About Convert→
bytes2HexString, hexString2Bytes
chars2Bytes, bytes2Chars
memorySize2Byte, byte2MemorySize
byte2FitMemorySize
timeSpan2Millis, millis2TimeSpan
millis2FitTimeSpan
bytes2Bits, bits2Bytes
input2OutputStream, output2InputStream
inputStream2Bytes, bytes2InputStream
outputStream2Bytes, bytes2OutputStream
inputStream2String, string2InputStream
outputStream2String, string2OutputStream
bitmap2Bytes, bytes2Bitmap
drawable2Bitmap, bitmap2Drawable
drawable2Bytes, bytes2Drawable
view2Bitmap
dp2px, px2dp
sp2px, px2sp
-
CrashUtils.java
About Crash→
init
-
DeviceUtils.java→Demo
About Device→
isDeviceRooted
getSDKVersion
getAndroidID
getMacAddress
getManufacturer
getModel
shutdown
reboot
reboot2Recovery
reboot2Bootloader
-
EmptyUtils.java→Test
About Empty→
isEmpty
isNotEmpty
-
EncodeUtils.java→Test
About Encode→
urlEncode
urlDecode
base64Encode
base64Encode2String
base64Decode
base64UrlSafeEncode
htmlEncode
htmlDecode
-
EncryptUtils.java→Test
About Encrypt→
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
-
FileIOUtils.java→Test
About FileIO→
writeFileFromIS
writeFileFromBytesByStream
writeFileFromBytesByChannel
writeFileFromBytesByMap
writeFileFromString
readFile2List
readFile2String
readFile2BytesByStream
readFile2BytesByChannel
readFile2BytesByMap
-
FileUtils.java→Test
About File→
getFileByPath
isFileExists
rename
isDir
isFile
createOrExistsDir
createOrExistsFile
createFileByDeleteOldFile
copyDir
copyFile
moveDir
moveFile
deleteDir
deleteFile
listFilesInDir
listFilesInDir
listFilesInDirWithFilter
listFilesInDirWithFilter
listFilesInDirWithFilter
listFilesInDirWithFilter
searchFileInDir
getFileLastModified
getFileCharsetSimple
getFileLines
getDirSize
getFileSize
getDirLength
getFileLength
getFileMD5
getFileMD5ToString
getDirName
getFileName
getFileNameNoExtension
getFileExtension
-
FragmentUtils.java→Demo
About Fragment→
addFragment
hideAddFragment
addFragments
removeFragment
removeToFragment
removeFragments
removeAllFragments
replaceFragment
popFragment
popToFragment
popFragments
popAllFragments
popAddFragment
hideFragment
hideFragments
showFragment
hideShowFragment
getLastAddFragment
getLastAddFragmentInStack
getTopShowFragment
getTopShowFragmentInStack
getFragments
getFragmentsInStack
getAllFragments
getAllFragmentsInStack
getPreFragment
findFragment
dispatchBackPress
setBackgroundColor
setBackgroundResource
setBackground
-
HandlerUtils.java→Demo
About Handler→
HandlerHolder
-
ImageUtils.java→Demo
About Image→
bitmap2Bytes, bytes2Bitmap
drawable2Bitmap, bitmap2Drawable
drawable2Bytes, bytes2Drawable
getBitmap
scale
clip
skew
rotate
getRotateDegree
toRound
toRoundCorner
fastBlur
renderScriptBlur
stackBlur
addFrame
addReflection
addTextWatermark
addImageWatermark
toAlpha
toGray
save
isImage
getImageType
compressByScale
compressByQuality
compressBySampleSize
-
IntentUtils.java
About Intent→
getInstallAppIntent
getUninstallAppIntent
getLaunchAppIntent
getAppDetailsSettingsIntent
getShareTextIntent
getShareImageIntent
getComponentIntent
getShutdownIntent
getCaptureIntent
-
KeyboardUtils.java→Demo
About Keyboard→
showSoftInput
hideSoftInput
toggleSoftInput
clickBlankArea2HideSoftInput
-
LocationUtils.java→Demo
About Location→
isGpsEnabled
isLocationEnabled
openGpsSettings
register
unregister
getAddress
getCountryName
getLocality
getStreet
isBetterLocation
isSameProvider
-
LogUtils.java→Demo
About Log→
Builder.setLogSwitch
Builder.setConsoleSwitch
Builder.setGlobalTag
Builder.setLogHeadSwitch
Builder.setLog2FileSwitch
Builder.setDir
Builder.setBorderSwitch
Builder.setConsoleFilter
Builder.setFileFilter
v
d
i
w
e
a
file
json
xml
-
NetworkUtils.java→Demo
About Network→
openWirelessSettings
isConnected
isAvailableByPing
getDataEnabled
setDataEnabled
is4G
getWifiEnabled
setWifiEnabled
isWifiConnected
isWifiAvailable
getNetworkOperatorName
getNetworkType
getIPAddress
getDomainAddress
-
PhoneUtils.java→Demo
About Phone→
isPhone
getIMEI
getIMSI
getPhoneType
isSimCardReady
getSimOperatorName
getSimOperatorByMnc
getPhoneStatus
dial
call
sendSms
sendSmsSilent
getAllContactInfo
getContactNum
getAllSMS
-
PinyinUtils.java→Test
About Pinyin→
ccs2Pinyin
ccs2Pinyin
getPinyinFirstLetter
getPinyinFirstLetters
getSurnamePinyin
getSurnameFirstLetter
-
ProcessUtils.java→Demo
About Process→
getForegroundProcessName
killAllBackgroundProcesses
killBackgroundProcesses
-
RegexUtils.java→Test
About Regex→
isMobileSimple
isMobileExact
isTel
isIDCard15
isIDCard18
isEmail
isURL
isZh
isUsername
isDate
isIP
isMatch
getMatches
getSplits
getReplaceFirst
getReplaceAll
-
ScreenUtils.java
About Screen→
getScreenWidth
getScreenHeight
setLandscape
setPortrait
isLandscape
isPortrait
getScreenRotation
captureWithStatusBar
captureWithoutStatusBar
isScreenLock
-
SDCardUtils.java→Demo
About SDCard→
isSDCardEnable
getSDCardPath
getDataPath
getFreeSpace
getSDCardInfo
-
ServiceUtils.java
About Service→
getAllRunningService
startService
stopService
bindService
unbindService
isServiceRunning
-
ShellUtils.java
About Shell→
execCmd
-
SizeUtils.java
About Size→
dp2px, px2dp
sp2px, px2sp
applyDimension
forceGetViewSize
measureView
getMeasuredWidth
getMeasuredHeight
-
SnackbarUtils.java→Demo
About Snackbar→
showShort
showLong
showIndefinite
addView
dismiss
-
SpannableStringUtils.java→Demo
About SpannableString→
Builder.setFlag
Builder.setForegroundColor
Builder.setBackgroundColor
Builder.setQuoteColor
Builder.setLeadingMargin
Builder.setMargin
Builder.setBullet
Builder.setFontSize
Builder.setFontProportion
Builder.setFontXProportion
Builder.setStrikethrough
Builder.setUnderline
Builder.setSuperscript
Builder.setSubscript
Builder.setBold
Builder.setItalic
Builder.setBoldItalic
Builder.setFontFamily
Builder.setTypeface
Builder.setAlign
Builder.setBitmap
Builder.setDrawable
Builder.setUri
Builder.setResourceId
Builder.setClickSpan
Builder.setUrl
Builder.setBlur
Builder.append
Builder.create
-
SPUtils.java→Test
About SP→
getInstance
put
getString
getInt
getLong
getFloat
getBoolean
getAll
contains
remove
clear
-
StringUtils.java→Test
About String→
isEmpty
isTrimEmpty
isSpace
equals
equalsIgnoreCase
null2Length0
length
upperFirstLetter
lowerFirstLetter
reverse
toDBC
toSBC
-
ThreadPoolUtils.java
About ThreadPool→
ThreadPoolUtils
execute
execute
shutDown
shutDownNow
isShutDown
isTerminated
awaitTermination
submit
submit
invokeAll, invokeAny
schedule
schedule
scheduleWithFixedRate
scheduleWithFixedDelay
-
TimeUtils.java→Test
About Time→
millis2String
string2Millis
string2Date
date2String
date2Millis
millis2Date
getTimeSpan
getFitTimeSpan
getNowMills
getNowString
getNowDate
getTimeSpanByNow
getFitTimeSpanByNow
getFriendlyTimeSpanByNow
getMillis
getString
getDate
getMillisByNow
getStringByNow
getDateByNow
isToday
isLeapYear
getChineseWeek
getUSWeek
getWeekIndex
getWeekOfMonth
getWeekOfYear
getChineseZodiac
getZodiac
-
ToastUtils.java→Demo
About Toast→
setGravity
setView
getView
showShortSafe
showLongSafe
showShort
showLong
cancel
-
ZipUtils.java→Test
About Zip→
zipFiles
zipFile
unzipFiles
unzipFile
unzipFileByKeyword
getFilesPath
getComments
getEntries
-
update_log.md
About Log→
About
Download
Gradle:
compile 'com.blankj:utilcode:1.6.4'
How to use
// init it in the function of onCreate in ur Application
Utils.init(context);
Proguard
-keep class com.blankj.utilcode.** { *; }
-keepclassmembers class com.blankj.utilcode.** { *; }
-dontwarn com.blankj.utilcode.**