天天看點

Android開源工具庫



一、依賴注入DI

通過依賴注入減少View、服務、資源簡化初始化,事件綁定等重複繁瑣工作

1. AndroidAnnotations(Code Diet) android快速開發架構

項目位址:https://github.com/excilys/androidannotations

文檔介紹:https://github.com/excilys/androidannotations/wiki

官方網站:http://androidannotations.org/

特點:(1)依賴注入:包括view,extras,系統服務,資源等等

(2)簡單的線程模型,通過annotation表示方法運作在ui線程還是背景線程

(3)事件綁定:通過annotation表示view的響應事件,不用在寫内部類

(4)REST用戶端:定義用戶端接口,自動生成REST請求的實作

(5)沒有你想象的複雜:AndroidAnnotations隻是在在編譯時生成相應子類

(6)不影響應用性能:僅50kb,在編譯時完成,不會對運作時有性能影響。

PS:與roboguice的比較:roboguice通過運作時讀取annotations進行反射,是以可能影響應用性能,而AndroidAnnotations在編譯時生成子類,是以對性能沒有影響

2. roboguice 幫你處理了很多代碼異常,利用annotation使得更少的代碼完成項目

項目位址:https://github.com/roboguice/roboguice

文檔介紹:https://github.com/roboguice/roboguice/wiki

3. butterknife 利用annotation幫你快速完成View的初始化,減少代碼

項目位址:https://github.com/JakeWharton/butterknife

文檔介紹:http://jakewharton.github.io/butterknife/

4. Dagger 依賴注入,适用于Android和Java

項目位址:https://github.com/square/dagger

文檔介紹:http://square.github.io/dagger/

二、圖檔緩存

1. Android-Universal-Image-Loader 圖檔緩存

目前使用最廣泛的圖檔緩存,支援主流圖檔緩存的絕大多數特性。

項目位址:https://github.com/nostra13/Android-Universal-Image-Loader

Demo位址:https://github.com/Trinea/TrineaDownload/blob/master/universal-imageloader-demo.apk?raw=true

文檔介紹:http://www.intexsoft.com/blog/item/74-universal-image-loader-part-3.html

2. picasso square開源的圖檔緩存

項目位址:https://github.com/square/picasso

文檔介紹:http://square.github.io/picasso/

特點:(1)可以自動檢測adapter的重用并取消之前的下載下傳

(2)圖檔變換

(3)可以加載本地資源

(4)可以設定占位資源

(5)支援debug模式

3. ImageCache 圖檔緩存,包含記憶體和Sdcard緩存

項目位址:https://github.com/Trinea/AndroidCommon

Demo位址:https://github.com/Trinea/TrineaDownload/blob/master/TrineaAndroidDemo.apk?raw=true

文檔介紹:http://www.trinea.cn/?p=704

特點:(1)支援預取新圖檔,支援等待隊列

(2)包含二級緩存,可自定義檔案名儲存規則

(3)可選擇多種緩存算法(FIFO、LIFO、LRU、MRU、LFU、MFU等13種)或自定義緩存算法

(4)可友善的儲存及初始化恢複資料

(5)支援不同類型網絡處理

(6)可根據系統配置初始化緩存等

三、網絡相關

1. Asynchronous Http Client for Android Android異步Http請求

項目位址:https://github.com/loopj/android-async-http

文檔介紹:http://loopj.com/android-async-http/

特點:(1) 在匿名回調中處理請求結果

(2) 在UI線程外進行http請求

(3) 檔案斷點上傳

(4) 智能重試

(5) 預設gzip壓縮

(6) 支援解析成Json格式

(7) 可将Cookies持久化到SharedPreferences

2. android-query 異步加載,更少代碼完成Android加載

項目位址:https://github.com/androidquery/androidquery或https://code.google.com/p/android-query/

文檔介紹:https://code.google.com/p/android-query/#Why_AQuery?

Demo位址:https://play.google.com/store/apps/details?id=com.androidquery

特點:https://code.google.com/p/android-query/#Why_AQuery?

3. Async Http Client Java異步Http請求

項目位址:https://github.com/AsyncHttpClient/async-http-client

文檔介紹:http://sonatype.github.io/async-http-client/

4. Ion 支援圖檔、json、http post等異步請求

項目位址:https://github.com/koush/ion

文檔介紹:https://github.com/koush/ion#more-examples

5. HttpCache Http緩存

項目位址:https://github.com/Trinea/AndroidCommon

Demo位址:https://github.com/Trinea/TrineaDownload/blob/master/TrineaAndroidDemo.apk?raw=true

Demo代碼:https://github.com/Trinea/AndroidDemo/blob/master/src/cn/trinea/android/demo/HttpCacheDemo.java

特點是:(1) 根據cache-control、expires緩存http請求

(2) 支援同步、異步Http請求

(3) 在匿名回調中處理請求結果

(4) 在UI線程外進行http請求

(5) 預設gzip壓縮

6. Http Request

項目位址:https://github.com/kevinsawicki/http-request

文檔介紹:https://github.com/kevinsawicki/http-request#examples

7. okhttp square開源的http工具類

項目位址:https://github.com/square/okhttp

文檔介紹:http://square.github.io/okhttp/

特點:(1) 支援SPDY(http://zh.wikipedia.org/wiki/SPDY)協定。SPDY協定是Google開發的基于傳輸控制協定的應用層協定,通過壓縮,多路複用(一個TCP連結傳送網頁和圖檔等資源)和優先級來縮短加載時間。

(2) 如果SPDY不可用,利用連接配接池減少請求延遲

(3) Gzip壓縮

(4) Response緩存減少不必要的請求

8. Retrofit RESTFUL API設計

項目位址:https://github.com/square/retrofit

文檔介紹:http://square.github.io/retrofit/

四、資料庫 orm工具包

orm的db工具類,簡化建表、查詢、更新、插入、事務、索引的操作

1. greenDAO Android Sqlite orm的db工具類

項目位址:https://github.com/greenrobot/greenDAO

文檔介紹:http://greendao-orm.com/documentation/

官方網站:http://greendao-orm.com/

特點:(1)性能佳

(2) 簡單易用的API

(3) 記憶體小好小

(4) 庫大小小

2. ActiveAndroid Android Sqlite orm的db工具類

項目位址:https://github.com/pardom/ActiveAndroid

文檔介紹:https://github.com/pardom/ActiveAndroid/wiki/_pages

3. Sprinkles Android Sqlite orm的db工具類

項目位址:https://github.com/emilsjolander/sprinkles

文檔介紹:http://emilsjolander.github.io/blog/2013/12/18/android-with-sprinkles/

特點:比較顯著的特點就是配合https://github.com/square/retrofit能儲存從伺服器擷取的資料

五、Android公共庫

1. Guava Google的基于java1.6的類庫集合的擴充項目

包括collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O等等. 這些高品質的API可以使你的JAVa代碼更加優雅,更加簡潔

項目位址:https://code.google.com/p/guava-libraries/

文檔介紹:https://code.google.com/p/guava-libraries/wiki/GuavaExplained

2. AndroidCommon Android公共庫

項目位址:https://github.com/Trinea/AndroidCommon

Demo位址:https://github.com/Trinea/TrineaDownload/blob/master/TrineaAndroidDemo.apk?raw=true

文檔介紹:http://www.trinea.cn/?p=778

包括:(1)緩存(圖檔緩存、預取緩存、網絡緩存)

(2) 公共View(下拉及底部加載更多ListView、底部加載更多ScrollView、滑動一頁Gallery)

(3) Android常用工具類(網絡、下載下傳、Android資源操作、shell、檔案、Json、随機數、Collection等等)

六、Android 高版本向低版本相容

1. ActionBarSherlock 為Android所有版本提供統一的ActionBar,解決4.0以下ActionBar的适配問題

項目位址:https://github.com/JakeWharton/ActionBarSherlock

Demo位址:https://play.google.com/store/apps/details?id=com.actionbarsherlock.sample.demos

APP示例:太多了。。現在連google都在用

2. Nine Old Androids 将Android 3.0(Honeycomb)所有動畫API(ObjectAnimator ValueAnimator等)相容到Android1.0

項目位址:https://github.com/JakeWharton/NineOldAndroids

Demo位址:https://play.google.com/store/apps/details?id=com.jakewharton.nineoldandroids.sample

文檔介紹:http://nineoldandroids.com/

3. HoloEverywhere 将Android 3.0的Holo主題相容到Android2.1++

項目位址:https://github.com/Prototik/HoloEverywhere

Demo位址:https://raw.github.com/Prototik/HoloEverywhere/repo/org/holoeverywhere/demo/2.1.0/demo-2.1.0.apk

文檔介紹:http://android-developers.blogspot.com/2012/01/holo-everywhere.html

七、多媒體相關

1. cocos2d-x 跨平台的2d遊戲架構,支援Android、IOS、Linux、Windows等衆多平台

項目位址:https://github.com/cocos2d/cocos2d-x

文檔介紹:http://www.cocos2d-x.org/wiki

官方網站:http://www.cocos2d-x.org/

2. Vitamio 是一款Android與iOS平台上的全能多媒體開發架構

項目位址:https://github.com/yixia/VitamioBundle

網站介紹:http://www.vitamio.org/docs/

特點:(1) 全面支援硬體解碼與GPU渲染

(2) 能夠流暢播放720P甚至1080P高清MKV,FLV,MP4,MOV,TS,RMVB等常見格式的視訊

(3) 在Android與iOS上跨平台支援 MMS, RTSP, RTMP, HLS(m3u8)等常見的多種視訊流媒體協定,包括點播與直播。

3. PhotoProcessing 利用ndk處理圖檔庫,支援Instafix、Ansel、Testino、XPro、Retro、BW、Sepia、Cyano、Georgia、Sahara、HDR、Rotate、Flip

項目位址:https://github.com/lightbox/PhotoProcessing

Demo位址:https://github.com/Trinea/TrineaDownload/blob/master/photo-processing.apk?raw=true

4. Android StackBlur 圖檔模糊效果工具類

項目位址:https://github.com/kikoso/android-stackblur

Demo位址:https://github.com/kikoso/android-stackblur/blob/master/StackBlurDemo/bin/StackBlurDemo.apk?raw=true

文檔介紹:https://github.com/kikoso/android-stackblur#usage

八、其他

1. Salvage view 帶View緩存的Viewpager PagerAdapter,很友善使用

項目位址:https://github.com/JakeWharton/salvage

2. Android-PasscodeLock 應用鎖,每次啟動或從任何Activity啟動應用都需要輸入四位數字的密碼方可進入

項目位址:https://github.com/wordpress-mobile/Android-PasscodeLock

Demo位址:https://play.google.com/store/apps/details?id=com.sothree.umano

APP示例:Wordpress Android,支付寶,挖财

3. android-lockpattern Android的圖案密碼解鎖

項目位址:https://code.google.com/p/android-lockpattern/

Demo位址:https://play.google.com/store/apps/details?id=group.pals.android.lib.ui.lockpattern.demo

使用介紹:https://code.google.com/p/android-lockpattern/wiki/QuickUse

示例APP:Android開機的圖案密碼解鎖,支付寶的密碼解鎖

4. GlowPadBackport将Android4.2的鎖屏界面解鎖擴充到Android1.6及1.6+

項目位址:https://github.com/rock3r/GlowPadBackport

Demo位址:https://play.google.com/store/apps/details?id=net.sebastianopoggi.samples.ui.GlowPadSample

效果圖:https://lh6.ggpht.com/U070b6Lh6cVsVwx4jN-5nq0xqiB1PBzrYABPeJIEe2hZQ5UWOxc-FDUG77wADelToHA=h310-rw

5. GlowPadView Android4鎖屏界面解鎖

項目位址:https://github.com/nadavfima/GlowPadView

效果圖:https://raw.github.com/nadavfima/GlowPadView/master/example.png

6. Android Priority Job Queue Android背景任務隊列

項目位址:https://github.com/path/android-priority-jobqueue

文檔介紹:https://github.com/path/android-priority-jobqueue#getting-started

7. jsoup 一個解析html的java庫,可友善的提取和操作資料

項目位址:https://github.com/jhy/jsoup

官方網站:http://jsoup.org/

作用:(1) 從一個url、檔案或string獲得html并解析

(2) 利用dom周遊或css選擇器查找、提取資料

(3) 操作html元素

(4) 根據白名單去除用于送出的非法資料防止xss攻擊

(5) 輸出整齊的html

8.ZIP java壓縮和解壓庫

項目位址:https://github.com/zeroturnaround/zt-zip

文檔介紹:https://github.com/zeroturnaround/zt-zip#examples

作用:(1) 解壓和壓縮,并支援檔案夾内遞歸操作

(2) 支援包含和排除某些元素

(3) 支援重命名元素

(4) 支援周遊zip包内容

(5) 比較兩個zip包等功能

9. Cobub Razor 開源的mobile行為分析系統,包括web端、android端,支援ios和window phone

項目位址:https://github.com/cobub/razor

Demo位址:http://demo.cobub.com/razor

網站介紹:http://dev.cobub.com/

10. aFileChooser 檔案選擇器,可内嵌到程式中,而無需使用系統或三方檔案選擇器。

項目位址:https://github.com/iPaulPro/aFileChooser

11. androidpn 基于xmpp協定的消息推送解決方案,包括伺服器端和android端。

項目位址:https://github.com/dannytiehui/androidpn

12. Android插件式開發

項目位址:https://github.com/umeng/apf