強大的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
Android快速開發系列 10個常用工具類(日志工具類
L.java 、
Toast統一管理類 、
SharedPreferences封裝類SPUtils、單位轉換類
DensityUtils、SD卡相關輔助類
SDCardUtils、屏幕相關輔助類
ScreenUtils、
App相關輔助類、軟鍵盤相關輔助類
KeyBoardUtils、網絡相關輔助類
NetUtils、Http相關輔助類
HttpUtils)
Charsets 獲取字符集實例
RandomUtils 隨機工具類
RegexUtils 正則表達式工具類,提供一些常用的正則表達式
RegularExpression 正則驗證相關操作的類
CountDownTimer 定時器,解決系統的CountDownTimer cancel失效問題
Countdown 倒計時器
LoopTimer 循環定時器
AmUtiles 定時器工具類
DateUtils 日期時間工具類 根據String構建一個Date,指定format構建,根據Date格式化,獲取Date 年、月、日、時、分、秒、毫秒,獲取一個月最后一天,獲取一個月第一天,根據Date獲取星期,時間友好顯示
DateUtil 日期操作工具類.
TransitionTime 用來計算顯示的時間是多久之前的
Android系統、組件相關
系統相關
AndroidUtils(跟Android系統相關的一些工具類,包括文件路徑處理,Toast顯示,屏幕方向,組件啟用禁用,獲取App簽名信息,是否是合法的文件名,獲取Cache目錄,SD卡存儲空間判斷,鍵盤隱藏與顯示,顯示Toast,檢測相機,媒體掃描,橫豎屏設置,系統版本判斷,獲取系統服務,重啟Activity,獲取電池信息,獲取應用簽名等)
NetUtil 網絡狀態工具類
NetworkUtils 網絡狀態工具類
BasicNetworkUtils 網絡狀態工具類
MemoryUtil Get memory info
PackageUtils 應用安裝下載相關
PackageUtils Package相關的工具類,App是否安裝,是否運行,啟用和禁用組件等
ApkUtils Apk工具
AppUtils APP相關信息工具類。獲取版本信息
DeviceStatusUtils 手機狀態工具類 主要包括網絡、藍牙、屏幕亮度、飛行模式、音量等
DeviceUtils 設備相關工具類 判斷是否有內存卡,獲取本機IP,多個內存卡時獲取外置內存卡,獲取內存卡總大小、使用大小和剩余多少,判斷網絡是否可以用,判斷某個服務是否在運行,判斷某個進程是否在運行,獲取IMEI、IMSI、MAC、UUID,執行震動,獲取相機最后一次拍照的圖片,獲取屏幕大小,copy到剪切板,獲取所有應用程序,判斷某個app是否安裝了,dp px轉換,獲取system bar高度,獲取navigation bar高度,輸入法隱藏和顯示,啟動某個應用下的Activity,返回Home,獲取網絡類型,撥打電話,發送短信。。。
InputMethodUtils 軟鍵盤工具類
PhoneUtil 手機組件調用工具類(調用系統發短信界面、調用系統打電話界面)
ImsiUtil IMSI工具類
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封裝
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 加密與解密的工具類
緩存
IDiscCache DiscCache |
兩種內存緩存: IMemoryCache (內存cache的統一接口)
MemoryCacheImpl (內存cache的統一接口的統一實現類,需要傳入
IMemoryCache的具體實現):
MemoryCache (獲取以上兩個實現類的統一接口)
LruCache (內存cache的統一接口的LRU實現類,(內部通過獲取LRU緩存具體實現
LruCacheImpl 獲得))
|
使用文檔 |
Android系統、Application相關
PackageUtils package相關
HandlerUtils An easy way to send Handler
BasicNetworkUtils 檢查網絡狀態
線程
ThreadUtils 返回自定義線程池(這里代碼與線程池工廠一樣)
AsyncExecutor 一個簡單的可以自定義線程池並發執行器
數據庫
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 應用數據庫導出工具類
DbConstants Some constants about db
greenDao
GreenDaoUtils greendao使用的封裝 DbDaoGenerator
文件 / IO
資源
RUtils R資源反射工具類
ResourceUtils 通過資源名稱獲取資源ID
AssetDatabaseOpenHelper 讀取 Asset 目錄中數據庫工具類
ParcelUtils Parcel與HashMap讀寫
PreferencesUtils SharedPreferences封裝
文件
FileUtils 讀寫文件相關
FileUtils 文件操作工具類
FileUtils 讀取某個文件內容、將某個文本寫入到指定文件、文件移動、文件拷貝、獲取文件擴展名、獲取URL擴展名、獲取文件名、獲取文件大小、創建文件夾以及父文件夾。。。
DataCleanManager 本應用數據清除管理器。主要功能有清除內/外緩存,清除數據庫,清除sharedPreference,清除files和清除自定義目錄
SDCardUtils SDcard 操作工具類
ExternalStorage 擴展SDcard獲取
StorageUtils 與緩沖存儲目錄有關
ResourceUtils 文件資源讀取工具類
AppCacheUtils 數據/配置存儲類
IO
IOUtils IO操作工具類,包含常用的文件復制/字符串/數組/列表/數據流讀寫方法,每個方法都包含不同參數的多個重載的版本
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,不包含重復元素
WeakFastHashMap 一個高性能的WeakHashMap實現,默認讀寫均同步;在大量讀操作時可以手動開啟快速模式,快速模式讀不同步,寫同步
字符串
ArrayUtils 數組處理
StringUtils 字符串操作工具包 結合android.text.TextUtils使用
StringUtils 一些字符串相關的處理
StringUtils 字符串工具類,支持常用的字符串合並/分割/比較/轉換/判斷等操作,這里面的方法同樣包含很多參數不同的重載版本,使用時根據IDE提示選取即可 (文檔見
https://github.com/mcxiaoke/Android-Next/blob/master/docs/core.md )
NumberUtil 字符串轉換為long等
RegUtils 數據校驗工具類
JAVA特性
反射
ReflectionUtils 反射相關的工具類
ReflectUtils 反射工具類,提供一些Java基本的反射功能
其他
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保存到指定路徑。。。
顏色 / 字體
Colors 顏色工具類 包括常用的色值
Symbols 符號名字
HanziToPinyin 漢字轉拼音工具類
UniversalImageLoader com.nostra13.universalimageloader封裝類
常用UI控件
提示
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
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
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 根據經緯度查詢地址信息和根據地址信息查詢經緯度
聲音
震動
功能模塊
分享
高級分享組件:封裝的一個 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封裝類
流量
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