第二部分 工具库

主要包括那些不错的开发库,包括依赖注入框架、图片缓存、网络相关、数据库ORM建模、Android公共库、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://play.google.com/store/apps/details?id=cn.trinea.android.demo
    文档介绍:http://www.trinea.cn/android/android-imagecache/
    特点:(1)支持预取新图片,支持等待队列
    (2)包含二级缓存,可自定义文件名保存规则
    (3)可选择多种缓存算法(FIFO、LIFO、LRU、MRU、LFU、MFU等13种)或自定义缓存算法
    (4)可方便的保存及初始化恢复数据
    (5)支持不同类型网络处理
    (6)可根据系统配置初始化缓存等

  4. 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/
    效果图:

三、网络相关

  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://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压缩

  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/

  9. RoboSpice
    Android异步网络请求工具,支持缓存、REST等等
    项目地址:https://github.com/stephanenicolas/robospice
    Demo地址:https://github.com/stephanenicolas/RoboDemo/downloads

四、数据库 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能保存从服务器获取的数据

  4. Realm
    移动端的数据库,适用于 Phone、Tablet、Wearable,支持 ORM,线程安全、支持连表及数据库加密,比 SQLite 性能更好
    项目地址:https://github.com/realm/realm-java
    文档介绍:http://realm.io/docs/java/0.72.0/

  5. ormlite-android
    项目地址:https://github.com/j256/ormlite-android
    文档介绍:http://ormlite.com/sqlite_java_android_orm.shtml

  6. Schematic
    根据SQLite生成ContentProvider
    项目地址:https://github.com/SimonVT/schematic

更多相关文章

  1. Android Support Library 介绍~在项目总如何使用android支持库
  2. 关于ADT(eclipse android)项目迁移到Android studio工具教程(下)
  3. android引入JAR包,打包成JAR包,打包成Library项目,导入Library项目
  4. android解析xml文档的各种方法
  5. 在android 中导入项目后 包出现错误
  6. 【Android】自定义View实现信封红蓝边/收货地址线条
  7. Android 开发入门问题集:启动模拟器、安装卸载apk、项目调试、导
  8. Android导入项目时出现红色感叹号
  9. android sdk API level对应关系及下载地址收藏

随机推荐

  1. Android颜色透明度(不透明度)计算
  2. Android中与ViewRoot相关的一些概念
  3. Android(安卓)OOM 排查与解决——图片加
  4. Android(安卓)IPC系列--序列化机制
  5. TextView(文本框)详解
  6. 自定义软键盘中Enter键,及其相应事件
  7. Android逆向与病毒分析
  8. Android中常用布局单位
  9. 自定义对象的监听方式
  10. android设备连接蓝牙外设导致activity重