Skip to content

yyblove/AndroidUtilCode

 
 

Repository files navigation

Android developers should collect the following utils

README of Chinese


Directory is shown below:

isActivityExists
launchActivity
getLauncherActivity: 获取入口activity
isInstallApp
installApp
installAppSilent
uninstallApp
uninstallAppSilent
isAppRoot
launchApp
closeApp
getAppPackageName
getAppDetailsSettings: 获取App具体设置
getAppName
getAppIcon
getAppPath
getAppVersionName
getAppVersionCode
isSystemApp
isAppDebug
getAppSignature
getAppSignatureSHA1
isAppForeground
getForegroundApp
getAppInfo
getAppsInfo
cleanAppData
setTransparentStatusBar: 设置透明状态栏(api大于19方可使用)
hideStatusBar
getStatusBarHeight
isStatusBarExists
getActionBarHeight
showNotificationBar
hideNotificationBar
cleanInternalCache
cleanInternalFiles
cleanInternalDbs
cleanInternalDbByName: 根据名称清除数据库
cleanInternalSP
cleanExternalCache
cleanCustomCache
copyText
getText
copyUri
getUri
copyIntent: 复制意图到剪贴板
getIntent
closeIO
closeIOQuietly: 安静关闭IO
MemoryConst: 存储相关常量
TimeConst
RegexConst
bytes2HexString, hexString2Bytes
chars2Bytes, bytes2Chars
memorySize2Byte, byte2MemorySize
byte2FitMemorySize
timeSpan2Millis, millis2TimeSpan
millis2FitTimeSpan
bytes2Bits, bits2Bytes
input2OutputStream, output2InputStream
inputStream2Bytes, bytes2InputStream
outputStream2Bytes, bytes2OutputStream
inputStream2String, string2InputStream
outputStream2String, string2OutputStream: outputStream与string按编码互转
bitmap2Bytes, bytes2Bitmap
drawable2Bitmap, bitmap2Drawable
drawable2Bytes, bytes2Drawable
view2Bitmap
dp2px, px2dp
sp2px, px2sp
getInstance: 获取单例
init
isDeviceRoot
getSDKVersion
getAndroidID
getMacAddress
getManufacturer
getModel
shutdown
reboot
reboot2Recovery
reboot2Bootloader: 重启到bootloader
isEmpty
isNotEmpty: 判断对象是否非空
urlEncode
urlDecode
base64Encode, base64Encode2String: Base64编码
base64Decode
base64UrlSafeEncode
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: 3DES加密
decrypt3DES, decryptHexString3DES, decryptBase64_3DES
encryptAES, encryptAES2HexString, encryptAES2Base64
decryptAES, decryptHexStringAES, decryptBase64AES
getFileByPath
isFileExists
rename
isDir
isFile
createOrExistsDir
createOrExistsFile
createFileByDeleteOldFile
copyDir
copyFile
moveDir
moveFile
deleteDir
deleteFile
listFilesInDir
listFilesInDir
listFilesInDirWithFilter
listFilesInDirWithFilter
listFilesInDirWithFilter
listFilesInDirWithFilter
searchFileInDir
writeFileFromIS
writeFileFromString
readFile2List
readFile2String
readFile2Bytes
getFileLastModified
getFileCharsetSimple
getFileLines
getDirSize
getFileSize
getDirLength
getFileLength
getFileMD5, getFileMD5ToString: 获取文件的MD5校验码
getDirName
getFileName
getFileNameNoExtension
getFileExtension
HandlerHolder: 使用必读
bitmap2Bytes, bytes2Bitmap
drawable2Bitmap, bitmap2Drawable: drawable与bitmap互转
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
getInstallAppIntent
getUninstallAppIntent
getLaunchAppIntent
getAppDetailsSettingsIntent: 获取App具体设置的意图
getShareTextIntent
getShareImageIntent
getComponentIntent
getShutdownIntent
getCaptureIntent
hideSoftInput
clickBlankArea2HideSoftInput: 点击屏幕空白区域隐藏软键盘
showSoftInput
toggleSoftInput
isGpsEnabled
isLocationEnabled: 判断定位是否可用
openGpsSettings
register
unregister
getAddress
getCountryName
getLocality
getStreet
init
getBuilder: 获取LogUtils建造者
v
d
i
w
e
openWirelessSettings
isConnected
isAvailableByPing
getDataEnabled
setDataEnabled
is4G
getWifiEnabled
setWifiEnabled
isWifiConnected
isWifiAvailable
getNetworkOperatorName: 获取移动网络运营商名称
getNetworkType
getIPAddress
getDomainAddress
isPhone
getIMEI
getIMSI
getPhoneType
isSimCardReady
getSimOperatorName, getSimOperatorByMnc: 获取Sim卡运营商名称
getPhoneStatus
dial
call
sendSms
sendSmsSilent
getAllContactInfo
getContactNum
getAllSMS
ccs2Pinyin
ccs2Pinyin
getPinyinFirstLetter
getPinyinFirstLetters: 获取所有汉字的首字母
getSurnamePinyin
getSurnameFirstLetter: 根据名字获取姓氏的首字母
getForegroundProcessName
cleanAllBackgroundProcesses, cleanBackgroundProcesses: 清理后台服务进程
isMobileSimple
isMobileExact
isTel
isIDCard15
isIDCard18
isEmail
isURL
isZh
isUsername
isDate
isIP
isMatch
getMatches
getSplits
getReplaceFirst: 替换正则匹配的第一部分
getReplaceAll
getScreenWidth
getScreenHeight
setLandscape
setPortrait
isLandscape
isPortrait
getScreenRotation
captureWithStatusBar
captureWithoutStatusBar: 获取当前屏幕截图,不包含状态栏
isScreenLock
isSDCardEnable: 判断SD卡是否可用
getSDCardPath
getDataPath
getFreeSpace
getSDCardInfo
getAllRunningService: 获取所有运行的服务
startService
stopService
bindService
unbindService
isServiceRunning
execCmd: 是否是在root下执行命令
dp2px, px2dp
sp2px, px2sp
applyDimension
forceGetViewSize
measureView
getMeasuredWidth
getMeasuredHeight: 获取测量视图高度
showShortSnackbar
showLongSnackbar
showIndefiniteSnackbar: 显示自定义时长snackbar
addView
dismissSnackbar
SPUtils
putString
getString
putInt
getInt
putLong
getLong
putFloat
getFloat
putBoolean: SP中写入boolean类型value
getBoolean: SP中读取boolean
getAll
remove
contains
clear
isEmpty
isSpace
equals
equalsIgnoreCase: 判断两字符串忽略大小写是否相等
null2Length0
length
upperFirstLetter: 首字母大写
lowerFirstLetter: 首字母小写
reverse
toDBC
toSBC
ThreadPoolUtils
execute
execute
shutDown
shutDownNow
isShutDown
isTerminated
awaitTermination
submit
submit
invokeAll, invokeAny
schedule
schedule
scheduleWithFixedRate
scheduleWithFixedDelay: 延迟并以固定休息时间循环执行命令
millis2String
string2Millis
string2Date
date2String
date2Millis
millis2Date
getTimeSpan
getFitTimeSpan
getNowTimeMills
getNowTimeString
getNowTimeDate
getTimeSpanByNow
getFitTimeSpanByNow
getFriendlyTimeSpanByNow: 获取友好型与当前时间的差
isSameDay
isLeapYear
getWeek, getWeekIndex
getWeekOfMonth
getWeekOfYear
getChineseZodiac
getZodiac
init
showShortToastSafe: 安全地显示短时吐司
showLongToastSafe
showShortToast
showLongToast
cancelToast
zipFiles
zipFile
unzipFiles
unzipFile
unzipFileByKeyword: 解压带有关键字的文件
getFilesPath
getComments
getEntries

I'm so sorry for that the code is annotated with Chinese.

Download


Gradle:

compile 'com.blankj:utilcode:1.3.4'

Proguard


-keep class com.blankj.utilcode.** { *; }
-keepclassmembers class com.blankj.utilcode.** { *; }
-dontwarn com.blankj.utilcode.**

License


Copyright 2016 Blankj

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Android developers should collect the following utils(updating)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%