Android开源项目分析计划

摘要:制定计划,对当前主流的Android开源项目核心点进行分析。

1.目标

  通过阅读分析优秀的开源项目代码,了解牛人是如何搭建优秀的架构,以及各类开源项目的核心技术点。这里将开源项目主要分为缓存、网络、图片加载、UI效果、图形图像、音视频这几类进行分析。

2.音视频

2.1 ijkplayer

简介:
  ijkplayer 是一个基于 ffplay 的轻量级 Android/iOS 视频播放器。实现了跨平台功能,API易于集成;编译配置可裁剪,方便控制安装包大小;支持硬件加速解码,更加省电;提供Android平台下应用弹幕集成的解决方案,此方案目前已用于美拍和斗鱼 APP。
源码查看:
  https://github.com/Bilibili/ijkplayer

3.缓存

3.1 LruCache

简介:
  通过LruCache通过键值将存储数据缓存内存中,用户只需提供创建方式,无需关注释放问题,可以用来避免OOM,基于LRU算法实现。
源码查看:
  http://androidxref.com/6.0.1_r10/xref/frameworks/base/core/java/android/util/LruCache.java
相关文章:
  http://m.blog.chinaunix.net/uid-26930580-id-4138306.html
  http://m.blog.csdn.net/article/details?id=9316683

3.2 DiskLruCache

简介:
  通过DiskLruCache能够将数据缓存到存储空间中,避免了对象(例如图片)释放后需网络重新加载导致的性能问题。
源码查看:
  https://android.googlesource.com/platform/libcore/+/android-4.1.1_r1/luni/src/main/java/libcore/io/DiskLruCache.java
  http://androidxref.com/6.0.1_r10/xref/development/samples/browseable/DisplayingBitmaps/src/com.example.android.displayingbitmaps/util/DiskLruCache.java
相关文章:
  http://m.blog.csdn.net/article/details?id=28863651
  http://m.blog.csdn.net/article/details?id=34093441

4.网络

4.1 Volley

简介:
  Volley是在2013年Google I/O大会上推出了一个新的网络通信框架,目的是简化网络操作流程。它提供了如下的便利功能:
   - JSON,图像等的异步下载;
   - 网络请求的排序(scheduling)
   - 网络请求的优先级处理
   - 数据缓存
   - 多级别取消请求
   - 和Activity和生命周期的联动(Activity结束时同时取消所有网络请求)
源码下载:
  git clone https://android.googlesource.com/platform/frameworks/volley
相关文章:
  http://m.blog.csdn.net/article/details?id=46443235

4.2 OKHttp

简介:
  HTTP is the way modern applications network. It’s how we exchange data & media. Doing HTTP efficiently makes your stuff load faster and saves bandwidth.
  OkHttp is an HTTP client that’s efficient by default:
   - HTTP/2 support allows all requests to the same host to share a socket.
   - Connection pooling reduces request latency (if HTTP/2 isn’t available).
   - Transparent GZIP shrinks download sizes.
   - Response caching avoids the network completely for repeat requests.
   - 支持SPDY,允许连接同一主机的所有请求分享一个socket。
   - 如果SPDY不可用,会使用连接池减少请求延迟。
   - 使用GZIP压缩下载内容,且压缩操作对用户是透明的。
   - 利用响应缓存来避免重复的网络请求。
  当网络出现问题的时候,OKHttp会依然有效,它将从常见的连接问题当中恢复。 如果你的服务端有多个IP地址,当第一个地址连接失败时,OKHttp会尝试连接其他的地址,这对IPV4和IPV6以及寄宿在多个数据中心的服务而言,是非常有必要的。
  OkHttp perseveres when the network is troublesome: it will silently recover from common connection problems. If your service has multiple IP addresses OkHttp will attempt alternate addresses if the first connect fails.
This is necessary for IPv4+IPv6 and for services hosted in redundant data centers. OkHttp initiates new connections with modern TLS features (SNI, ALPN), and falls back to TLS 1.0 if the handshake fails.
源码下载:
  http://square.github.io/okhttp/
相关文章:
  http://m.blog.csdn.net/article/details?id=47911083
  http://www.chinaz.com/web/2015/0731/428907.shtml

4.3 Retrofit

简介:
  用JAVA接口实现http请求,通过注释去描述HTTP请求。
源码下载:
  http://square.github.io/retrofit/
相关文章:
  http://hong1024.com/2015/01/12/Retrofit%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90/

5.图片

5.1 universal-image-loader

简介:
  图片异步加载并缓存的类。
源码下载:
  https://github.com/nostra13/Android-Universal-Image-Loader
相关文章:
  http://m.blog.csdn.net/article/details?id=10079311
  http://m.blog.csdn.net/article/details?id=26810303
  http://m.blog.csdn.net/article/details?id=26810303

5.2 Fresco

简介:
  Fresco是一个强大的图片加载组件。
  Fresco中设计有一个叫做 image pipeline 的模块。它负责从网络,从本地文件系统,本地资源加载图片。为了最大限度节省空间和CPU时间,它含有3级缓存设计(2级内存,1级文件)。
  Fresco中设计有一个叫做 Drawees 模块,方便地显示loading图,当图片不再显示在屏幕上时,及时地释放内存和空间占用。
  Fresco支持 Android2.3(API level 9) 及其以上系统。
源码下载:
  http://www.fresco-cn.org/
  https://github.com/facebook/fresco

5.3 Picasso

简介:
  图片下载和缓存库。
源码下载:
  https://github.com/square/picasso

6.UI

6.1 Pull2Refresh

简介:
  下拉刷新、上拉刷新。
源码下载:
  https://github.com/chrisbanes/Android-PullToRefresh

6.2 SlidingMenu

简介:
  侧滑菜单的功能
源码下载:
  https://github.com/jfeinstein10/SlidingMenu

6.3 XListView

简介:
  下拉刷新控件,停止更新了,有精力可以看看
源码下载:
  https://github.com/Maxwin-z/XListView-Android
相关资源:
  http://blog.csdn.net/jdsjlzx/article/details/44136235

6.4 ViewPagerIndicator

简介:
  ViewPager指示器,标记当前ViewPager。
源码下载:
  https://github.com/JakeWharton/ViewPagerIndicator
相关资源:
  http://my.oschina.net/u/1403288/blog/208402

6.5 PagerSlidingTabStrip

简介:
  ViewPager指示器,标记当前ViewPager。
源码下载:
  https://github.com/astuetz/PagerSlidingTabStrip
相关资源:
  http://doc.okbase.net/HarryWeasley/archive/121430.html

6.6 AutoScrollViewPager

简介:
  轮播图片。
源码下载:
  https://github.com/Trinea/android-auto-scroll-view-pager

7.注释

ButterKnife

8.事件

8.1 EnventBus

简介:
  Android事件总线实现。
源码下载:
  https://github.com/greenrobot/EventBus
相关资源:
  http://blog.csdn.net/lmj623565791/article/details/40794879
  http://blog.csdn.net/lmj623565791/article/details/40920453

8.2 jobqueue

简介:
  Priority Job Queue is an implementation of a Job Queue specifically written for Android to easily schedule jobs (tasks) that run in the background, improving UX and application stability.
  Android Priority Job Queue是一款专门为Android平台编写,实现了Job Queue的后台任务队列类库,能够轻松的在后台执行定时任务,提高用户体验和应用的稳定性。
源码下载:
  https://github.com/path/android-priority-jobqueue
相关资源:
  http://hao.jobbole.com/android-priority-jobqueue/

9.开发框架

9.1 xUtils3

简介:
  xUtils 包含了很多实用的android工具.
  xUtils 支持超大文件(超过2G)上传,更全面的http请求协议支持(11种谓词),拥有更加灵活的ORM,更多的事件注解支持且不受混淆影响…
源码下载:
  https://github.com/wyouflf/xUtils3
相关文章:
  http://m.blog.csdn.net/article/details?id=38356773

10.其它

10.1 Rhino(Javascript库)

https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino