您的位置:首页 > 其它

一些可以参考的常用工具库类整理

2016-08-15 14:08 253 查看
强大的common包们:

Trinea: https://github.com/Trinea/android-common (包含强大的listview、bitmap cache)
litesuits: https://github.com/litesuits/android-common

下面为零散的common包集合:
注意查看每个库的说明文档辅助快速上手

Singleton 单例模式抽象类。Singleton helper class for lazily initialization

BasicUtils
Android快速开发系列 10个常用工具类(日志工具类L.java 、Toast统一管理类 、SharedPreferences封装类SPUtils、单位转换类 DensityUtils、SD卡相关辅助类 SDCardUtils、屏幕相关辅助类 ScreenUtilsApp相关辅助类、软键盘相关辅助类KeyBoardUtils、网络相关辅助类 NetUtils、Http相关辅助类 HttpUtils

Charsets 获取字符集实例
Charsets StringCodingUtils
RandomUtils 随机工具类
RegexUtils 正则表达式工具类,提供一些常用的正则表达式
RegularExpression 正则验证相关操作的类

CountDownTimer 定时器,解决系统的CountDownTimer cancel失效问题
Countdown 倒计时器
LoopTimer 循环定时器
AmUtiles 定时器工具类

DateUtils 日期时间工具类 根据String构建一个Date,指定format构建,根据Date格式化,获取Date 年、月、日、时、分、秒、毫秒,获取一个月最后一天,获取一个月第一天,根据Date获取星期,时间友好显示
DateUtil 日期操作工具类.
TimeUtils
TransitionTime 用来计算显示的时间是多久之前的

Android系统、组件相关

系统相关

AndroidUtils(跟Android系统相关的一些工具类,包括文件路径处理,Toast显示,屏幕方向,组件启用禁用,获取App签名信息,是否是合法的文件名,获取Cache目录,SD卡存储空间判断,键盘隐藏与显示,显示Toast,检测相机,媒体扫描,横竖屏设置,系统版本判断,获取系统服务,重启Activity,获取电池信息,获取应用签名等)

NetUtil 网络状态工具类
NetworkUtils 网络状态工具类
BasicNetworkUtils 网络状态工具类

MemoryUtil Get memory info

PackageUtils 应用安装下载相关
PackageUtils Package相关的工具类,App是否安装,是否运行,启用和禁用组件等
ApkUtils Apk工具
AppUtils
AppUtils APP相关信息工具类。获取版本信息
DeviceStatusUtils 手机状态工具类 主要包括网络、蓝牙、屏幕亮度、飞行模式、音量等
DeviceUtils 设备相关工具类 判断是否有内存卡,获取本机IP,多个内存卡时获取外置内存卡,获取内存卡总大小、使用大小和剩余多少,判断网络是否可以用,判断某个服务是否在运行,判断某个进程是否在运行,获取IMEI、IMSI、MAC、UUID,执行震动,获取相机最后一次拍照的图片,获取屏幕大小,copy到剪切板,获取所有应用程序,判断某个app是否安装了,dp px转换,获取system bar高度,获取navigation bar高度,输入法隐藏和显示,启动某个应用下的Activity,返回Home,获取网络类型,拨打电话,发送短信。。。

InputMethodUtils 软键盘工具类

PhoneUtil 手机组件调用工具类(调用系统发短信界面、调用系统打电话界面)

ImsiUtil IMSI工具类
TelephoneUtil
ShortCutUtils 快捷方式工具类。创建删除快捷图标
BadgeUtil 设置徽章

ChannelUtil 为打包而生的渠道工具类 极速打包传送门
AntiEmulatorUtiles 检测是否在模拟器上运行
DoubleClickExitDetector 双击退出识别器

ShellUtils shell 工具类
ShellUtils shell 工具类

组件相关

ActivityManager 应用程序Activity管理类:用于Activity管理和应用程序退出
AppInfoUtil Retrieve launcher activity name of the application from the context

NextBaseActivity 基础Activity,添加了一些ActionBar相关的封装方法
NextBaseFragment 础Fragment,添加了ActionBar和Activity相关的一些封装方法

NextMessage 一个简单数据容器,类似于Android系统的Message类,但是使用更方便,能支持更多数据类型
MultiIntentService 类似于IntentService,但是多个异步任务可以并行执行;Service每隔300秒自动检查,如果活跃任务目为0则自动结束;自动结束时间可设置,是否启用自动结束功能可设置

ManifestUtils Android Manifest工具类

SettingUtils 应用配置工具类

网络

json xml

gson封装
JsonUtil JsonMetaReader JsonHashMapReader
JSONUtils Json解析工具类 推荐使用Google的GSON

JsonFormatUtils JSON格式化输出
JsonValidator 验证JSON合法性

XmlParseUtiles 对pull解析xml进行了封装,不用给每个xml,再创建一个对应的解析类

Http

HttpUtils HttpUtils which use apache http client
HttpUtilsAsync HttpUtils which use asynchoronous(异步) method to help you use network method without using an addtional Thread
HttpsUtils Https工具类:Send https request

MimeUtils MIME工具类,支持根据文件扩展名获取MIME类型

DownloadManagerPro 下载管理工具类
PollingUtils 轮询服务工具类

PreferencesCookieStore A CookieStore impl, it's save cookie to SharedPreferences.

WebView

SampleWebViewClient A webview which can open url by itself and can show some error message when receive error
WebViewUtils A webview setting which enable JavaScript ,DomStorage and file access
Html5Webview A webview which support many Html5 feature like video ,audio etc
WebViewManager WebView管理器,提供常用设置

加密

CryptographyUtils Cryptography Utils including MD5,SHA1 etc
CryptoUtils 加密算法相关的工具方法,支持MD5/SHA1/SHA256/AES/HEX等
CipherUtils 加密与解密的工具类

Base64 Base64 DES MD5
TripleDES

AESCoder
Base64Coder
DES3Coder
DESCoder
HexCoder
MD5Coder
RSACoder
使用文档

缓存

DiskLruCache

IDiscCache DiscCache
两种内存缓存:
IMemoryCache (内存cache的统一接口)
MemoryCacheImpl (内存cache的统一接口的统一实现类,需要传入IMemoryCache的具体实现):

LruCacheImplIMemoryCache的具体实现:使用LRU策略,里面用到LruCacheCompat(使用LinkedList实现LRU))

MapCacheImplIMemoryCache的具体实现:没有使用LRU策略,直接使用HashMap实现)

MemoryCache (获取以上两个实现类的统一接口)
LruCache (内存cache的统一接口的LRU实现类,(内部通过获取LRU缓存具体实现LruCacheImpl 获得))

使用文档
Android系统、Application相关
PackageUtils package相关
HandlerUtils An easy way to send Handler
BasicNetworkUtils 检查网络状态

线程

ThreadUtils 返回自定义线程池(这里代码与线程池工厂一样)
AsyncExecutor 一个简单的可以自定义线程池并发执行器

数据库

DataBaseUtils
ExtendedCursor 对Cursor的封装类,并且Wraps a cursor to add an additional column with the same value for all rows
SQLiteContentProvider extends ContentProvider implements SQLiteTransactionListener。General purpose android.content.ContentProvider base class that uses SQLiteDatabase for storage.
DatabaseExportUtils 应用数据库导出工具类
DbHelper
DbConstants Some constants about db

greenDao
GreenDaoUtils greendao使用的封装 DbDaoGenerator

文件 / IO

资源

RUtils R资源反射工具类
ResourceUtils 通过资源名称获取资源ID

AssetDatabaseOpenHelper 读取 Asset 目录中数据库工具类

ParcelUtils Parcel与HashMap读写
SerializeUtils

PreferencesUtils SharedPreferences封装

PreferencesUtils

文件

FileUtils 读写文件相关
FileUtils 文件操作工具类
FileUtils
FileUtils 读取某个文件内容、将某个文本写入到指定文件、文件移动、文件拷贝、获取文件扩展名、获取URL扩展名、获取文件名、获取文件大小、创建文件夹以及父文件夹。。。
FilenameUtils
IOUtils
DataCleanManager 本应用数据清除管理器。主要功能有清除内/外缓存,清除数据库,清除sharedPreference,清除files和清除自定义目录

SDCardUtils SDcard 操作工具类
ExternalStorage 扩展SDcard获取
StorageUtils 与缓冲存储目录有关

ResourceUtils 文件资源读取工具类
AppCacheUtils 数据/配置存储类

ZipUtils
ZipUtils
ZipUtil

IO

IOUtils IO操作工具类,包含常用的文件复制/字符串/数组/列表/数据流读写方法,每个方法都包含不同参数的多个重载的版本

ByteUtils

StreamUtils 流转换成字符串

ByteArrayOutputStream This class implements an output stream in which the data is written into a byte array. The buffer automatically grows as data is written to it.
StringBuilderWriter Writer implementation that outputs to a StringBuilder
BoundedInputStream This is a stream that will only supply bytes up to a certain length - if its position goes above that, it will stop.

StringBuilderWriter extends Writer implements Serializable。This implementation, as an alternative to java.io.StringWriter , provides an un-synchronized (i.e. for use in a single thread) implementation for better performance. For safe usage with multiple Threads then java.io.StringWriter should be used.

ProxyInputStream 继承自FilterInputStream。A Proxy stream which acts as expected, that is it passes the method calls on to the proxied stream and doesn't change which methods are being called.
CountingInputStream 继承自ProxyInputStream 。A decorating input stream that counts the number of bytes that have passed through the stream so far.

ProxyOutputStream 继承自FilterOutputStream 。A Proxy stream which acts as expected, that is it passes the method calls on to the proxied stream and doesn't change which methods are being called. It is an alternative base class to FilterOutputStream to increase reusability.
CountingOutputStream 继承自ProxyOutputStream ,A decorating output stream that counts the number of bytes that have passed through the stream so far

集合相关

ConvertVectorUtils 集合与数组转换
函数操作符: 文档 (对集合进行:合并多个数据集 (concat/merge)、取最大最小值 (max/min)、数据项去重 (distinct/unique)、过滤掉不符合条件的 (filter)、是否所有项都满足条件 (all)、是否存在一项满足条件 (any)、遍历数据集 (foreach)、压缩数据集 (zip)、折叠操作 (reduce/fold)、普通映射操作 (map)、平坦映射操作 (flatMap/flatten))

DoubleKeyValueMap 双键值对
NoDuplicatesArrayList 不包含重复元素的ArrayList
NoDuplicatesLinkedList 不包含重复元素的LinkedList
NoDuplicatesCopyOnWriteArrayList extends CopyOnWriteArrayList,不包含重复元素
NoEmptyStringHashMap
WeakFastHashMap 一个高性能的WeakHashMap实现,默认读写均同步;在大量读操作时可以手动开启快速模式,快速模式读不同步,写同步

字符串

ArrayUtils 数组处理
ArrayUtils
StringUtils 字符串操作工具包 结合android.text.TextUtils使用
StringUtils
StringUtils
StringUtils 一些字符串相关的处理
StringUtils 字符串工具类,支持常用的字符串合并/分割/比较/转换/判断等操作,这里面的方法同样包含很多参数不同的重载版本,使用时根据IDE提示选取即可 (文档见https://github.com/mcxiaoke/Android-Next/blob/master/docs/core.md

NumberUtil 字符串转换为long等

RegUtils 数据校验工具类

JAVA特性

反射

ReflectionUtils 反射相关的工具类
ReflectUtils 反射工具类,提供一些Java基本的反射功能

其他

ClassUtils

UI工具类

显示

BasicUiUtils UI界面显示辅助类
DisplayUtils 系统显示相关工具类
ViewUtils View相关的几个工具方法,例如getScreenRawSize/getActionBarHeightInDp/getResourceValue等
ViewUtils View / 系统显示相关工具类
ViewFinder findViewById 替代工具类。Helper for finding and tweaking a view's children

DensityUtil 屏幕信息获取数值的转换

WindowUtils 窗口工具箱

动画

AnimationUtils 一些动画效果的封装

AnimationUtils 动画工具类
AnimationUtils 动画工具类
ViewAnimationUtils 视图动画工具箱,提供简单的控制视图的动画的工具方法

图片

ImageUtils Bitmap图片处理工具类
ImageProcessor 图片处理器
ImageType determine image width, height and color depth for a number of image file formats.
ImageUtils 从目录读取图片、获取图片目录
ImageUtils_Deprecated Bitmap图片处理工具类
BitmapUtils Bitmap缩放,旋转,圆角,阴影,裁剪等方法
BitmapUtil Bitmap工具类主要包括获取Bitmap和对Bitmap的操作
BitmapUtils Bitmap工具类 drawable bitmap互转、获取图片在相册中的方向、Bitmap比例缩放、圆形Bitmap、Bitmap缩略图、Bitmap保存到指定路径。。。
BitmapUtil

颜色 / 字体

Colors 颜色工具类 包括常用的色值
Symbols 符号名字
HanziToPinyin 汉字转拼音工具类

UniversalImageLoader com.nostra13.universalimageloader封装类

常用UI控件

提示

ToastUtil
DownloadDialogShower
DialogUtils
NotificationUtil

AlertDialogFragment(4.0版本) AlertDialogFragment(使用support-v4的版本): 封装好的DialogFragment,一个自定义的DialogFragment,接口和功能基本等同于系统的AlertDialog

ProgressDialogFragment (4.0版本) ProgressDialogFragment (使用support-v4的版本):封装好的DialogFragment

image

CircularImageView Custom ImageView for circular images in Android while maintaining thebest draw performance and supporting custom borders & selectors
SquareImageView
VideoImageView 让图片看起来像是动的视频一样
Blur 模糊效果

list

BasicUltimateListView A component in UltimateListView which provide load more
UltimateListview UltimateListView which can pull to refresh using the SwipeRefreshLayout and load more
LoadMoreListView
FixSpeedScroller

无限加载列表 : 封装 RecyclerView ,用于支持滚动到底部时自动加载数据和显示正在加载 代码文件夹 说明文档

EndlessAdapter EndlessListView 封装的ListView,添加了支持加载更多数据的接口和FooterView展示

NestedGridView 专门嵌套使用的GridView,重写其onMeasure()方法使其显示所有数据不会出现滚动条
NestedListView 专门嵌套使用的ListView,重写其onMeasure()方法使其显示所有数据不会出现滚动条

其他/综合

AutofitTextView A TextView that resizes it's text to be no larger than the width of the view
OnClickEvent 防止Button的频繁点击,多次执行点击事件

UI常用组件(mcxiaoke)

酷炫效果库:下载APK查看效果+查看源码结合:UltimateAndroid

传感器

位置

LastLocationFinder this class let's you find the "best" (most accurate and timely) previously detected location using whatever providers are available.用于快速获取上次定位位置
LocationUtils 根据经纬度查询地址信息和根据地址信息查询经纬度

声音

RecorderControl 录音

震动

VibrateUtil

功能模块

分享

高级分享组件:封装的一个 ActionProvider ,比系统自带的 SharedActionProvider 提供大得多的灵活度,可自定义出现在列表里的项目,主要包括 AdvancedShareActionProvider ShareTarget 两个类。使用文档

调试与检查相关

crash

CrashHandler crash信息采集
CrashHandler crash收集

BaseApplication 应用 Application 此处主要是为了错误处理。
BaseCrashHandler 在 Application 中统一捕获异常,保存到文件中下次再打开时上传
RebootThreadExceptionHandler 重启线程异常处理器,当发生未知异常时会提示异常信息并在一秒钟后重新启动应用。
StartAppReceiver 重启应用广播接收器。

log

LogWriter A class to help you log in memory
Logs Log封装类
LogUtils Log封装类
LogUtils
LogUtil

流量

TrafficUtils - App流量使用统计工具类

性能

ViewServer enable the use of HierarchyViewer inside an application. HierarchyViewer is an Android SDK tool that can be used to inspect and debug the user interface of running applications.

check

Preconditions Static convenience methods that help a method or constructor check whether it was invoked correctly
AssertUtils Assert类,Null检查,对象检查,数组检查等

CheckingUtils 提供常用数据验证的工具类,不符合的话就抛异常

整理by Doing
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: