日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Android >内容正文

Android

Android 开源项目android-open-project工具库解析之(一) 依赖注入,图片缓存,网络相关,数据库orm工具包,Android公共库...

發布時間:2024/4/17 Android 49 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Android 开源项目android-open-project工具库解析之(一) 依赖注入,图片缓存,网络相关,数据库orm工具包,Android公共库... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一、依賴注入DI?

通過依賴注入降低View、服務、資源簡化初始化。事件綁定等反復繁瑣工作

  • 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) RESTclient:定義client接口,自己主動生成REST請求的實現
    (5) 沒有你想象的復雜:AndroidAnnotations僅僅是在在編譯時生成對應子類
    (6) 不影響應用性能:僅50kb。在編譯時完畢,不會對執行時有性能影響。
    PS:與roboguice的比較:roboguice通過執行時讀取annotations進行反射,所以可能影響應用性能。而AndroidAnnotations在編譯時生成子類。所以對性能沒有影響

  • roboguice
    幫你處理了非常多代碼異常,利用annotation使得更少的代碼完畢項目
    項目地址:https://github.com/roboguice/roboguice
    文檔介紹:https://github.com/roboguice/roboguice/wiki

  • butterknife
    利用annotation幫你高速完畢View的初始化,降低代碼
    項目地址:https://github.com/JakeWharton/butterknife
    文檔介紹:http://jakewharton.github.io/butterknife/

  • Dagger
    依賴注入,適用于Android和Java
    項目地址:https://github.com/square/dagger
    文檔介紹:http://square.github.io/dagger/

  • 二、圖片緩存

  • 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

  • picasso
    square開源的圖片緩存
    項目地址:https://github.com/square/picasso
    文檔介紹:http://square.github.io/picasso/
    特點:(1)能夠自己主動檢測adapter的重用并取消之前的下載
    (2)圖片變換
    (3)能夠載入本地資源
    (4)能夠設置占位資源
    (5)支持debug模式

  • ImageCache
    圖片緩存。包括內存和Sdcard緩存
    項目地址:https://github.com/Trinea/AndroidCommon
    Demo地址:https://play.google.com/store/apps/details?id=cn.trinea.android.demo
    文檔介紹:http://www.trinea.cn/android/android-imagecache/
    特點:(1)支持預取新圖片,支持等待隊列
    (2)包括二級緩存??勺约憾x文件名稱保存規則
    (3)可選擇多種緩存算法(FIFO、LIFO、LRU、MRU、LFU、MFU等13種)或自己定義緩存算法
    (4)可方便的保存及初始化恢復數據
    (5)支持不同類型網絡處理
    (6)可依據系統配置初始化緩存等

  • Cube ImageLoader
    阿里巴巴一淘使用的圖片載入,綜合了Android-Universal-Image-Loader 和 square 等組件長處。簡單易用,良好的中文文檔支持
    項目地址:https://github.com/etao-open-source/cube-sdk
    Demo地址:https://github.com/liaohuqiu/cube-sdk/raw/master/cube-sdk-sample.apk
    效果圖:文檔介紹:http://cube-sdk.liaohuqiu.net/

  • fresco
    一款強大的圖片緩存工具,由 Facebook開發
    項目地址:https://github.com/facebook/fresco
    文檔介紹:http://frescolib.org/
    特點:(1) 兩個內存緩存加上磁盤緩存構成了三級緩存
    (2) 支持流式,能夠類似網頁上模糊漸進式顯示圖片
    (3) 對多幀動繪圖片支持更好,如 Gif、WebP
    (4) 很多其它樣的顯示,如圓角、進度條、點擊重試、自己定義對焦點
    (5) 很多其它樣的載入,如支持 EXIF、全面支持 WebP
    (6) 支持 Android 2.3+

  • 三、網絡相關

  • 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

  • android-query
    異步載入,更少代碼完畢Android載入
    項目地址:https://github.com/androidquery/androidquery 或 https://code.google.com/p/android-query/
    Demo地址:https://play.google.com/store/apps/details?

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


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

  • Async Http Client
    Java異步Http請求
    項目地址:https://github.com/AsyncHttpClient/async-http-client
    文檔介紹:http://sonatype.github.io/async-http-client/

  • Ion
    支持圖片、json、http post等異步請求
    項目地址:https://github.com/koush/ion
    文檔介紹:https://github.com/koush/ion#more-examples

  • HttpCache
    Http緩存
    項目地址:https://github.com/Trinea/AndroidCommon
    Demo地址:https://play.google.com/store/apps/details?

    id=cn.trinea.android.demo
    文檔介紹:http://www.trinea.cn/android/android-http-cache
    特點是:(1) 依據cache-control、expires緩存http請求
    (2) 支持同步、異步Http請求
    (3) 在匿名回調中處理請求結果
    (4) 在UI線程外進行http請求
    (5) 默認gzip壓縮

  • Http Request
    項目地址:https://github.com/kevinsawicki/http-request
    文檔介紹:https://github.com/kevinsawicki/http-request#examples

  • 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緩存降低不必要的請求

  • Retrofit
    RESTFUL API設計
    項目地址:https://github.com/square/retrofit
    文檔介紹:http://square.github.io/retrofit/

  • RoboSpice
    Android異步網絡請求工具。支持緩存、REST等等
    項目地址:https://github.com/stephanenicolas/robospice
    Demo地址:https://github.com/stephanenicolas/RoboDemo/downloads

  • Droppy
    支持多種樣式的下拉菜單
    項目地址:https://github.com/shehabic/Droppy

  • 四、數據庫 orm工具包

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

  • greenDAO
    Android Sqlite orm的db工具類
    項目地址:https://github.com/greenrobot/greenDAO
    文檔介紹:http://greendao-orm.com/documentation/
    官網網址:http://greendao-orm.com/
    特點:(1) 性能佳
    (2) 簡單易用的API
    (3) 內存小好小
    (4) 庫大小小

  • ActiveAndroid
    Android Sqlite orm的db工具類
    項目地址:https://github.com/pardom/ActiveAndroid
    文檔介紹:https://github.com/pardom/ActiveAndroid/wiki/_pages

  • Sprinkles
    Android Sqlite orm的db工具類,比較顯著的特點就是配合 https://github.com/square/retrofit 能保存從server獲取的數據
    項目地址:https://github.com/emilsjolander/sprinkles
    文檔介紹:http://emilsjolander.github.io/blog/2013/12/18/android-with-sprinkles/

  • Realm
    移動端的數據庫,適用于 Phone、Tablet、Wearable。支持 ORM,線程安全、支持連表及數據庫加密,比 SQLite 性能更好
    項目地址:https://github.com/realm/realm-java
    文檔介紹:http://realm.io/docs/java/0.72.0/

  • ormlite-android
    項目地址:https://github.com/j256/ormlite-android
    文檔介紹:http://ormlite.com/sqlite_java_android_orm.shtml

  • Schematic
    依據SQLite生成ContentProvider
    項目地址:https://github.com/SimonVT/schematic

  • DBFlow
    Android SQLite ORM工具庫。

    綜合了 Active Android, Schematic, Ollie,Sprinkles等庫的長處;通過注解實現,性能好;能生成ContentProvider。


    項目地址:https://github.com/Raizlabs/DBFlow
    文檔介紹:https://github.com/Raizlabs/DBFlow#usage-docs

  • 五、Android公共庫

  • 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

  • Volley
    Google提供的網絡通信庫,使得網絡請求更簡單、更高速
    項目地址:https://android.googlesource.com/platform/frameworks/volley
    文檔介紹:http://commondatastorage.googleapis.com/io-2013/presentations/110%20-%20Volley-%20Easy,%20Fast%20Networking%20for%20Android.pdf

  • AndroidCommon
    Android公共庫
    項目地址:https://github.com/Trinea/AndroidCommon
    Demo地址:https://play.google.com/store/apps/details?id=cn.trinea.android.demo
    文檔介紹:http://www.trinea.cn/android/android-common-lib/
    包含:(1)緩存(圖片緩存、預取緩存、網絡緩存)
    (2) 公共View(下拉及底部載入很多其它ListView、底部載入很多其它ScrollView、滑動一頁Gallery)
    (3) Android經常使用工具類(網絡、下載、Android資源操作、shell、文件、Json、隨機數、Collection等等)

  • shipfaster
    整合了Dagger Otto Retrofit Robolectric Picasso OkHttp,方便高速開發
    項目地址:https://github.com/pyricau/shipfaster

  • CleanAndroidCode
    整合了Dagger Otto AndroidAnnotations,方便高速開發
    項目地址:https://github.com/pyricau/CleanAndroidCode

  • xUtils
    基于Afinal。包括DbUtils、ViewUtils、HttpUtils、BitmapUtils四大模塊,可用于高速開發
    項目地址:https://github.com/wyouflf/xUtils

  • Afinal
    Afinal是一個android的ioc,orm框架,內置了四大模塊功能:FinalAcitivity,FinalBitmap,FinalDb,FinalHttp。通過finalActivity,我們能夠通過注解的方式進行綁定ui和事件。通過finalBitmap,我們能夠方便的載入bitmap圖片,而無需考慮oom等問題。

    通過finalDB模塊,我們一行代碼就能夠對android的sqlite數據庫進行增刪改查。

    通過FinalHttp模塊,我們能夠以ajax形式請求http數據
    項目地址:https://github.com/yangfuhai/afinal
    官網網址:http://www.afinal.org

  • UltimateAndroid
    UltimateAndroid是一個高速開發Android應用的框架。框架眼下主要包括的功能有View Injection,ORM,異步網絡請求和圖片載入,自己主動化腳本測試,磁盤LRU等功能.同一時候提供了類似于TripleDes、Webview高速設置、Md5處理、String處理,Https處理等經常使用工具類,還有超過100多種UI控件效果。
    項目地址:https://github.com/cymcsg/UltimateAndroid
    官網網址:http://blog.marshalchen.com/UltimateAndroid/

  • SAF
    SAF(Simple Android Framework)是一個簡單的android框架。它為開發Android app提供了基礎性組件。


    項目地址:https://github.com/fengzhizi715/SAF
    官網網址:http://www.salesuite.cn/
    包含:(1)Event Bus(事件總線)
    (2) Rest Client(http的框架)
    (3) Image Cache(圖片緩存)
    (4) Dependency Injection(依賴注入)
    (5) Sqlite ORM(sqlite的orm)
    (6) Router(Activity、Fragment的Router)
    (7) Utils(各種經常使用的工具類)

  • Barber
    Custom View 神器。通過簡單的注解幫助你大大降低 Custom View 中的代碼量。

    因為和 ButterKnife 一樣使用了 Annotation Proccessor ,所以對程序性能沒有影響。
    項目地址:https://github.com/hzsweers/barber

  • device-year-class
    A library that analyzes an Android device's specifications and calculates which year the device would be considered "high end”.(facebook開發的檢測手機主流配置工具)
    項目地址:https://github.com/facebook/device-year-class


  • 轉載于:https://www.cnblogs.com/zfyouxi/p/5112314.html

    總結

    以上是生活随笔為你收集整理的Android 开源项目android-open-project工具库解析之(一) 依赖注入,图片缓存,网络相关,数据库orm工具包,Android公共库...的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。