All Projects → mazouri → Androidtools

mazouri / Androidtools

Android开发工具类库.Toolkit of Android development, make your app developing easier!

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Androidtools

Hutool
🍬A set of tools that keep Java sweet.
Stars: ✭ 21,386 (+31819.4%)
Mutual labels:  util, tool
Utils Everywhere
整理并收集各种常用的覆盖面广的工具类
Stars: ✭ 329 (+391.04%)
Mutual labels:  util, tool
Xxl Tool
a series of tools that make Java development more efficient.(Java工具类库XXL-TOOL)
Stars: ✭ 311 (+364.18%)
Mutual labels:  util, tool
Protools
历经开发周期两年,并且应用过千万级别项目的工具箱
Stars: ✭ 663 (+889.55%)
Mutual labels:  util, tool
Laravel Cadillac
🍺 A database tool for laravel.
Stars: ✭ 63 (-5.97%)
Mutual labels:  tool
Changed Log
Returns all commit messages between 2 versions of an NPM module
Stars: ✭ 58 (-13.43%)
Mutual labels:  util
Pizza Cli
🍕 Order a pizza in a CLI app (just for fun!)
Stars: ✭ 58 (-13.43%)
Mutual labels:  tool
Simiki
Simiki is a simple wiki framework, written in Python.
Stars: ✭ 1,082 (+1514.93%)
Mutual labels:  tool
Revokemsgpatcher
A hex editor for WeChat/QQ/TIM - PC版微信/QQ/TIM防撤回补丁(我已经看到了,撤回也没用了)
Stars: ✭ 12,482 (+18529.85%)
Mutual labels:  tool
Hastscript
utility to create hast trees
Stars: ✭ 65 (-2.99%)
Mutual labels:  util
Mthawkeye
Profiling / Debugging assist tools for iOS. (Memory Leak, OOM, ANR, Hard Stalling, Network, OpenGL, Time Profile ...)
Stars: ✭ 1,119 (+1570.15%)
Mutual labels:  tool
Dotslash3.0
🎯 Creating DartPad Snippets Made Easy
Stars: ✭ 60 (-10.45%)
Mutual labels:  tool
Align
A general purpose application and library for aligning text.
Stars: ✭ 63 (-5.97%)
Mutual labels:  tool
Googledriveuploadtool
A tool for Windows to upload and manage files in Google Drive. It resumes uploads in case of an error or failure. Perfect for uploading large files or if your connection is unstable.
Stars: ✭ 58 (-13.43%)
Mutual labels:  tool
Minecraft Armorstand
This tool generates a summon command, to summon an armorstand in a desired pose.
Stars: ✭ 65 (-2.99%)
Mutual labels:  tool
Goutil
go util 是golang通用工具包,实现一站式,开箱即用
Stars: ✭ 56 (-16.42%)
Mutual labels:  util
Ving
🐸 A ping utility with nice output, with powerful traceroute and port probe.
Stars: ✭ 62 (-7.46%)
Mutual labels:  tool
Neutron
Neutron is a CLI developed to help developers create new react projects with Redux + Redux Saga and offers well-structured code standardization.
Stars: ✭ 65 (-2.99%)
Mutual labels:  tool
Nova Custom Email Sender
A Laravel Nova tool that sends ad-hoc email messages from the dashboard.
Stars: ✭ 62 (-7.46%)
Mutual labels:  tool
Slickermaster Rev4
NSA Hacking Tool Recreation UnitedRake
Stars: ✭ 62 (-7.46%)
Mutual labels:  tool

AndroidTools

中文版README

About AndroidTools

This library contains the most of tools that we use on Android development. Just add this to your module, you could simplify your code, save your valuable time, and make developing app easier. Enjoy tools, happy coding!

How to use AndroidTools

1.Add it in your root build.gradle at the end of repositories:

allprojects {
	  repositories {
		  ...
		  maven { url 'https://jitpack.io' }
	  }
  }

2.Add this to your module's build.gradle file:

dependencies {
        compile 'com.github.mazouri:AndroidTools:1.0'
  }

3.Initiate AndroidTools in your application class:

public class YourApplication extends Application {

  @Override
  public void onCreate() {
      super.onCreate();

      //[Required]
      Tools.init(this); 
      
      //[Optional] if u wanna see AndroidTools internal logs, add this line.
      Tools.openToolsLog(true); 
  }
}

4.Then U could use tools that u want like this:

// print log with tag.
Tools.log().tag(App.class.getSimpleName()).d("print log with tag()"); 

// is null or its length is 0. [will return false]
Tools.string().isEmpty(App.class.getSimpleName()); 

// is wifi connected? [will return true||false]
Tools.network().isWifiConnected(this);  

Screenshots [tobeupdate]

Classify tools [tobeupdate]

You can also query by docs.

I believe you could get the meaning of these methods by their name, so I will not translate the desc into English. Enjoy Tools!

Tools

   
Tools.app()获取Application, 即Context

All tools list: AppTool, ApkTool, InputMethodTool, IntentTool, ProcessTool, SnackbarTool, ToastTool, ConstantsTool, ConvertTool, DeviceTool, NetworkTool, BitmapTool, CloseTool, ExternalStorageTool, FileTool, SPTool, LogTool, RegexTool, SecureTool, ShellTool, StringTool, TimeTool, UnitTool.

AppTool

//usage examples:
Tools.appTool().getAllRunningService(Tools.app()); //获取所有运行的服务
    Tools.appTool().startService(Tools.app(), MockService.class); //启动服务
getAllRunningService 获取所有运行的服务
startService 启动服务
stopService 停止服务
bindService 绑定服务
unbindService 解绑服务
getAppVersionCode 获取应用版本号
getLauncherActivity 获取launcher activity
getPackageName 获取应用包名
getTopActivityName 获取顶层activity名称
getVersionNameFromPackage 获取应用版本名称
isActivityExists 判断是否存在Activity
isAppForeground 判断App是否处于前台
isProessRunning 进程是否运行
isProessRunning 进程是否运行
isRunningForeground 判断应用是否在前台运行
isServiceRunning 服务是否运行
launchActivity 打开Activity

ApkTool

//usage examples:
Tools.apk().getAppDetailsSettings(Tools.app()); // 获取App具体设置
                                                               
getAppDetailsSettings获取App具体设置
getAppIcon获取App图标
getAppName获取App名称
getAppPath获取App路径
getAppSignature获取App签名
getAppSignatureSHA1获取应用签名的的SHA1值
getChannelFromApk从apk中获取版本信息
installApp安装App
installAppSilent静默安装App
uninstallAppSilent静默卸载App
isAppDebug判断App是否是Debug版本
isAppInstall检查手机上是否安装了指定的软件
isAppRoot判断App是否有root权限
isSystemApp判断App是否是系统应用
launchApp打开App
uninstallApp卸载App

InputMethodTool

//usage examples:
Tools.inputMethod().isActiveSoftInput(Tools.app()); // 判断输入法是否处于激活状态
           
hideInputSoftFromWindowMethod隐藏键盘 :强制隐藏
isActiveSoftInput判断输入负是否处于激活状态
showInputSoftFromWindowMethod显示输入法

ProcessTool

//usage examples:
Tools.process().getAllBackgroundProcesses(); // 获取后台服务进程
                   
getAllBackgroundProcesses获取所有的后台服务进程
getForegroundProcessName获取前台线程包名
killAllBackgroundProcesses杀死所有的后台服务进程
killBackgroundProcesses杀死后台服务进程

IntentTool

//usage examples:
Tools.intent().getInstallAppIntent("/sdcard/mock.apk"); // 获取安装App的意图
                                   
getAppDetailsSettingsIntent获取App具体设置的意图
getCaptureIntent获取拍照的意图
getComponentIntent获取其他应用组件的意图
getInstallAppIntent获取安装App的意图
getLaunchAppIntent获取打开App的意图
getShareImageIntent获取分享图片的意图
getShareTextIntent获取分享文本的意图
getShutdownIntent获取分享文本的意图
getUninstallAppIntent获取分享文本的意图

SnackbarTool

//usage examples:
Tools.snackbar().dismissSnackbar()(); // 取消snackbar显示
                   
addView为snackbar添加布局 在show...Snackbar之后调用
dismissSnackbar取消snackbar显示
showIndefiniteSnackbar显示自定义时长snackbar
showLongSnackbar显示长时snackbar
showShortSnackbar显示短时snackbar

ProcessTool

//usage examples:
Tools.process().getAllBackgroundProcesses(); // 获取后台服务进程
   
getAllBackgroundProcesses获取后台服务进程

ToastTool

//usage examples:
Tools.toast().showToast(Toast.app, "show toast"); // 获取后台服务进程
               
showToast显示Short型Toast
showToastLong显示Long型Toast

ConvertTool

//usage examples:

   Tools.convert().dp2px(50f); // dp转px

                                                                                                                               
bitmap2Bytesbitmap转byteArr
bitmap2Drawablebitmap转drawable
bits2Bytesbits转bytes
byte2FitMemorySize字节数转合适内存大小 保留3位小数
byte2MemorySize字节数转以unit为单位的内存大小
bytes2BitmapbyteArr转bitmap
bytes2Bitsbytes转bits
bytes2CharsbyteArr转charArr
bytes2DrawablebyteArr转drawable
bytes2HexStringbyteArr转hexString
bytes2InputStreambyteArr转inputStream
bytes2OutputStreamoutputStream转byteArr
dp2pxdp转px
px2dppx转dp
px2sppx转sp
sp2pxsp转px
drawable2Bitmapdrawable转bitmap
drawable2Bytesdrawable转byteArr
hexString2ByteshexString转byteArr
input2OutputStreaminputStream转outputStream
inputStream2BytesinputStream转byteArr
inputStream2StringinputStream转string按编码
memorySize2Byte以unit为单位的内存大小转字节数
millis2FitTimeSpan毫秒时间戳转合适时间长度
millis2TimeSpan毫秒时间戳转以unit为单位的时间长度
output2InputStreamoutputStream转inputStream
outputStream2BytesoutputStream转byteArr
outputStream2StringoutputStream转string按编码
string2InputStreamstring转inputStream按编码
string2OutputStreamstring转outputStream按编码
timeSpan2Millis以unit为单位的时间长度转毫秒时间戳
view2Bitmapview转Bitmap

DeviceTool

//usage examples:
Tools.device().getAllSDCardSize(); // 获取SD大小
                                                                                       
coptyToClipBoard复制到剪切板
existSDCard判断SDCard是否可用
getAllSDCardSize获取SD大小
getAppPackageNamelist获取非系统应用包名
getAvailaleSDCardSize获取可用空间大小
getIMEI获取IMEI
getLatestCameraPicture获取最后一次拍照的图片
getLocalIPAddress获取本机IP地址
getMac获取MAC地址
getNavigationBarHeight获取navigationbar高度
getScreenPix获取手机大小(分辨率)
getStatusBarHeight获取statusbar高度
getTopBarHeight获取状态栏高度+标题栏(ActionBar)高度
getUDID获取UDID
goHome主动回到Home,后台运行
isOnline是否有网络
isSoftKeyAvail判断是否有软控制键
isSoftKeyAvail判断是否有软控制键
vibrate震动

NetworkTool

//usage examples:

   Tools.network().getDataEnabled()(); // 判断移动数据是否打开

                                           
getDataEnabled判断移动数据是否打开
getDomainAddress获取域名ip地址
getIPAddress获取IP地址
getNetType判断手机连接的网络类型(wifi,2G,3G,4G)
getNetworkOperatorName获取网络运营商名称 如中国移动、中国联通、中国电信
is4G()判断网络是否是4G
isNetworkConnected判断是否连接网络
isWifiConnected判断是否连接wifi
openWirelessSettings打开网络设置界面 3.0以下打开设置界面
setDataEnabled打开或关闭移动数据

BitmapTool

//usage examples:

   Tools.bitmap().toRoundCorner(); // 转化成圆bitmap    

                                                                                                                                                                               
bitmapToByteBitmap转bytes
bitmapToDrawableBitmap转Drawable
bitmapToStringbitmap转换成Base64编码String
byteToBitmapbytes转Bitmap
compressBimap质量压缩图片-压缩在maxSize以内
compressBitmap等比压缩(宽高等比缩放)
compressBitmap压缩bitmp到目标大小(质量压缩)
compressBitmap质量压缩图片-压缩在1M以内
compressBitmap质量压缩图片
compressBitmap图片缩放-尺寸缩放
compressBitmapBig图片缩放-尺寸缩放
compressBitmapSmall图片缩放-尺寸缩放
compressImage质量压缩图片-压缩在1M以内
compressImage质量压缩图片
compressImage质量压缩图片-压缩在maxSize以内
createBitmapThumbnail生成bitmap缩略图
drawableToBitmapdrawable转Bitmap
getDegress根据path, 获取图片旋转角度
rotateBitmap旋转bitmap
saveBitmap保存Bitmap到文件
scaleImage缩放image
scaleImageTo缩放image到指定高、宽

CloseTool

//usage examples:

   Tools.close().closeIO(in); // 关闭IO

       
closeIO关闭IO
closeIOQuietly安静关闭IO

ExternalStorageTool

//usage examples:

   Tools.externalStorage().isAvailable(); // sdcard是否可用

                               
getAllStorageLocations获取所有可用sdcard
getSdCardPath获取sdcard路径
isAvailablesdcard是否可用
isWritablesdcard是否可写

FileTool

//usage examples:

   Tools.file().getFileByPath("/sdcard/mock.txt"); // 根据文件路径获取文件

                                                                                                                                           
copyDir复制目录
copyFile复制文件
createFileByDeleteOldFile判断文件是否存在,存在则在创建之前删除
createOrExistsDir判断目录是否存在,不存在则判断是否创建成功
createOrExistsFile判断文件是否存在,不存在则判断是否创建成功
deleteDir删除目录
deleteFile删除文件
deleteFilesInDir删除目录下的所有文件
getDirLength获取目录长度
getDirName获取全路径中的最长目录
getFileByPath根据文件路径获取文件
getFileCharsetSimple简单获取文件编码格式
getFileExtension获取全路径中的文件拓展名
getFileLastModified获取文件最后修改的毫秒时间戳
getFileLength获取文件长度
getFileLines获取文件行数
getFileMD5获取文件的MD5校验码
getFileMD5ToString获取文件的MD5校验码
getFileName获取全路径中的文件名
getFileNameNoExtension获取全路径中的不带拓展名的文件名
getFileSize获取文件大小
isDir判断是否是目录
isFile判断是否是文件
isFileExists判断文件是否存在
listFilesInDir获取目录下所有文件包括子目录
listFilesInDirWithFilter获取目录下所有符合filter的文件包括子目录
moveDir移动目录
moveFile移动文件
readFile2Bytes读取文件到字符数组中
readFile2List指定编码按行读取文件到链表中
readFile2String指定编码按行读取文件到字符串中
rename重命名文件
searchFileInDir获取目录下指定文件名的文件包括子目录 大小写忽略
writeFileFromIS将输入流写入文件
writeFileFromString将字符串写入文件

SPTool

//usage examples:

   Tools.sp().saveShareBoolean("mock_key", true); // 存储moke_key的值到shared_preference的文件    

                               
name设置SharedPreference的xml文件名,默认为AndroidTools.xml
saveShareBoolean存储布尔值
saveShareInt存储整型值
saveShareString存储字符串

LogTool

//three kinds of LogTool usage:

   Tools.log().d("print log with default generated tag"); //默认tag ==> 打印结果为【类名.方法名[第几行]】:App.onCreate(line:20)    Tools.log().tag(App.class.getSimpleName()).d("print log with tag()");//指定tag Tools.log().d(App.class.getSimpleName(), "print log with set tag");//指定tag

               
setDebug设置是否打印log
tag设置tag

RegexTool

//usage examples:

   Tools.regex().isEmail("[email protected]"); // 获取后台服务进程

                                                                               
isUserName是否为用户名
isPassword是否为密码
isMobile是否为手机号
isEmail是否为邮箱
isChinese是否为中文
isIDCard是否为身份证号(中国)
isUrl是否为URL
isIPAddress是否为IP地址
isPlateNum是否为车牌号(中国)
isVehicleVin是否为车辆vin码

ShellTool

//usage examples:

   Tools.shell().execCmd("ls /sdcard/", ""); // 获取后台服务进程

   
execCmd是否是在root下执行命令

StringTool

//usage examples:

   Tools.string().isEmpty(); // 是否为null或者长度为0或者都是空格

                                                               
isEmpty是否为null或者长度为0或者都是空格
isBlank是否为null或者长度为0或者都是空格
length字符串长度,如果为null,返回0
nullStrToEmpty将空对象转化为空字符串
capitalizeFirstLetter首字母大写
utf8Encode编码为utf-8
fullWidthToHalfWidth全角转半角
halfWidthToFullWidth半角转全角
sqliteEscape数据库字符转义

TimeTool

//usage examples:

   Tools.time().millis2String(System.currentTimeMillis()); // 将时间戳转为时间字符串

                                                                                       
date2Millis将Date类型转为时间戳
date2String将Date类型转为时间字符串
getChineseZodiac获取生肖
getFitTimeSpan获取合适型两个时间差
getFitTimeSpanByNow获取合适型与当前时间的差
getFriendlyTimeSpanByNow获取友好型与当前时间的差
getNowTimeDate获取当前Date
getNowTimeMills获取当前毫秒时间戳
getNowTimeString获取当前时间字符串
getTimeSpan获取两个时间差
getTimeSpanByNow获取与当前时间的差
getWeek获取星期
getWeekIndex获取星期 注意:周日的Index才是1,周六为7
getWeekOfMonth获取月份中的第几周 注意:国外周日才是新的一周的开始
getWeekOfYear获取年份中的第几周 注意:国外周日才是新的一周的开始
getZodiac获取星座
isLeapYear判断是否闰年
isSameDay判断是否同一天
millis2Date将时间戳转为Date类型
millis2String将时间戳转为时间字符串
string2Date将时间字符串转为Date类型
string2Millis将时间字符串转为时间戳

UnitTool

//usage examples:
Tools.unit().c2f(27f); // 摄氏度转华氏度
                                               
c2f摄氏度转华氏度
f2c华氏度转摄氏度
km2mikm转mile
mi2kmmile转km
l2gal升转加仑
l100km2mpg百公里油耗转mpg
mpg2l100kmmpg转百公里油耗

SecureTool

                                                                                               
encryptMD2ToStringMD2加密
encryptMD5ToStringMD5加密
encryptMD5File2StringMD5加密文件
encryptSHA1ToStringSHA1加密
encryptSHA224ToStringSHA224加密
encryptSHA256ToStringSHA256加密
encryptSHA384ToStringSHA384加密
encryptSHA512ToStringSHA512加密
hashTemplatehash加密模板
encryptHmacMD5ToStringHmacMD5加密
encryptHmacSHA1ToStringHmacSHA1加密
encryptDES2Base64DES加密后转为Base64编码
encryptDES2HexStringDES加密后转为16进制
encryptDESDES加密
decryptBase64DESDES解密Base64编码密文
decryptHexStringDESDES解密16进制密文
decryptDESDES解密
encrypt3DES2Base643DES加密后转为Base64编码
encrypt3DES2HexString3DES加密后转为16进制
encrypt3DES3DES加密
decrypt3DES3DES解密
encryptAES2Base64AES加密后转为Base64编码
encryptAESAES加密
decryptAESAES解密
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].