- 博客(62)
- 收藏
- 关注
原创 Universal-Image-Loader源码阅读(36)-LoadAndDisplayImageTask
加载并展示图片任务。顾名思义,就是先要把图片加载到内存中来,然后再view中显示。源码:/** * Presents load'n'display image task. Used to load image from Internet or file system, decode it to {@link Bitmap}, and * display it in {@link c
2016-08-31 14:44:25 736
原创 Universal-Image-Loader源码阅读(36)-DisplayBitmapTask
显示图片任务。改种任务,直接显示图片,不需要先加载(已经加载过了)。源码:/** * Displays bitmap in {@link com.nostra13.universalimageloader.core.imageaware.ImageAware}. Must be called on UI thread. * * @author Sergey Tarasevich
2016-08-31 14:34:00 327
原创 Universal-Image-Loader源码阅读(35)-
前边看了那么多的文件,终于转到核心了!!整个的ImageLoader的运行都是异步的,那么异步执行的心脏就在这里了!源码:/** * {@link ImageLoader} engine which responsible for {@linkplain LoadAndDisplayImageTask display task} execution. * * @author Se
2016-08-31 14:11:06 238
原创 Universal-Image-Loader源码阅读(34)-ImageDecoder
看名字翻译成图像解析器。就一个功能接口,就是跟据图片信息,解析出Bitmap来源码:/** * Provide decoding image to result {@link Bitmap}. * * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) * @see ImageDecodingInfo * @since
2016-08-30 14:31:49 267
原创 Universal-Image-Loader源码阅读(33)-RoundedVignetteBitmapDisplayer
圆角并且有影晕效果。其实还是在修改渲染效果,如果你对渲染深有研究的话,完全可以自己写出几个好玩的渲染出来,然后应用到这里。源码:/** * Can display bitmap with rounded corners and vignette effect. This implementation works only with ImageViews wrapped * in I
2016-08-30 14:25:35 505
原创 Universal-Image-Loader源码阅读(32)-RoundedBitmapDisplayer
图片圆角展示。核心就是理解图片渲染。源码:/** * Can display bitmap with rounded corners. This implementation works only with ImageViews wrapped * in ImageViewAware. * * This implementation is inspired by *
2016-08-30 13:43:12 295
原创 Universal-Image-Loader源码阅读(31)-FadeInBitmapDisplayer
带有闪入动画的displayer。读完之后,恍然大悟,原来就是在设置了图片之后,给其增加了从淡到浓的动画。源码:/** * Displays image with "fade in" animation * * @author Sergey Tarasevich (nostra13[at]gmail[dot]com), Daniel Martí * @since 1.6
2016-08-30 09:51:22 400
原创 Universal-Image-Loader源码阅读(30)-CircleBitmapDisplayer
展示圆形图片。把原始图片剪切成圆形图片进行展示。就是把图片转变成原型图片画在展示器中(ImageAware)。源码:/** * Can display bitmap cropped by a circle. This implementation works only with ImageViews wrapped * in ImageViewAware. * * If th
2016-08-29 17:07:39 335
原创 Universal-Image-Loader源码阅读(29)-SimpleBitmapDisplayer
BitmapDisplayer的最简单地实现。源码:/** * Just displays {@link Bitmap} in {@link com.nostra13.universalimageloader.core.imageaware.ImageAware} * * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) *
2016-08-29 17:05:58 321
原创 Universal-Image-Loader源码阅读(29)-BitmapDisplayer
在控件上展示图片的接口定义。源码:/** * Displays {@link Bitmap} in {@link com.nostra13.universalimageloader.core.imageaware.ImageAware}. Implementations can * apply some changes to Bitmap or any animation fo
2016-08-29 17:03:38 391
原创 Universal-Image-Loader源码阅读(29)-BaseImageDownloader
ImageDownLoader的具体实现。源码:/** * Provides retrieving of {@link InputStream} of image by URI from network or file system or app resources. * {@link URLConnection} is used to retrieve image strea
2016-08-29 16:28:35 425
原创 Universal-Image-Loader源码阅读(28)-ImageDownloader
图片加载接口。源码:/** * Provides retrieving of {@link InputStream} of image by URI. * Implementations have to be thread-safe. * * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) * @since 1.
2016-08-29 16:22:04 328
原创 Universal-Image-Loader源码阅读(25)-UnlimitedDiskCache
不限制的硬件缓存。这个就是直接的实现了,没有添加什么限制,规则。有就有,没就没。源码:/** * Default implementation of {@linkplain com.nostra13.universalimageloader.cache.disc.DiskCache disk cache}. * Cache size is unlimited. *
2016-08-25 15:30:21 247
原创 Universal-Image-Loader源码阅读(24)-LimitedAgeDiskCache
有时间限制的硬件缓存。增加了文件存在的最长时间,超过时间了则删除。但是存储空间的额大小没有限制。源码/** * Cache which deletes files which were loaded more than defined time. Cache size is unlimited. * * @author Sergey Tarasevich (nostra13[at
2016-08-25 14:56:43 266
原创 Universal-Image-Loader源码阅读(23)--BaseDiskCache
Discache的抽象实现。源码:/** * Base disk cache. * * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) * @see FileNameGenerator * @since 1.0.0 */public abstract class BaseDiskCache implement
2016-08-25 13:52:10 393
原创 Universal_image-Loader源码阅读(22)-disc/DiskCache
看完了MemoryCache,接下来看DiscCache.硬件中的缓存文件管理。源码:/** * Interface for disk cache * * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) * @since 1.9.2 */public interface DiskCache { /**
2016-08-24 16:32:57 302
原创 Universal-Image-Loader源码阅读(21)-memory总结
已经把 memory下的代码读完了,我们也都有了个大致的了解,以后在遇到类似的问题,大可以把他们统统的拿来自己用。下面看看他们之间的关系吧:
2016-08-24 16:11:36 159
原创 Universal-Image-Loader源码阅读(20)-memory/impl/LRULimitedMemoryCache
采用了LRU策略的LimitedMemoryCache源码:/** * Limited {@link Bitmap bitmap} cache. Provides {@link Bitmap bitmaps} storing. Size of all stored bitmaps will not to * exceed size limit. When cache reach
2016-08-24 16:05:22 331
原创 Universal-Image-Loader源码阅读(19)-memory/impl/LargestLimitedMemoryCache
在LimitedMemoryCache的基础上,当超过缓存上限的时候,将内存中最大的图片删掉。源码:/** * Limited {@link Bitmap bitmap} cache. Provides {@link Bitmap bitmaps} storing. Size of all stored bitmaps will not to * exceed size lim
2016-08-24 14:42:20 175
原创 Universal-Image-Loader源码阅读(18)-memory/impl/FIFOLimitedMemoryCache
在原来LimitedMemoryCache的基础上,扩展了FIFO的策略进行图片的缓存策略。源码:/** * Limited {@link Bitmap bitmap} cache. Provides {@link Bitmap bitmaps} storing. Size of all stored bitmaps will not to * exceed size
2016-08-24 13:54:04 200
原创 Universal-Image-Loader源码阅读(17)-memory/impl/LimitedAgeMemoryCache
依然是包装类,包装类最长老化时间。源码:/** * Decorator for {@link MemoryCache}. Provides special feature for cache: if some cached object age exceeds defined * value then this object will be removed from c
2016-08-24 13:49:59 189
原创 Universal-Image-Loader源码阅读(16)-memory/impl/FuzzyKeyMemoryCache
看名字,可以翻译成模糊关键字的缓存。看代码,是memoryCache的包装类,增加了key值(字符串)的比较。可以对其它MemoryCache,增加自定义的字符串比较算法。源码:/** * Decorator for {@link MemoryCache}. Provides special feature for cache: some different keys a
2016-08-24 13:43:04 206
原创 Universal-Image-Loader源码阅读(15)-memory/impl/LruMemoryCache
采用LRU算法处理缓存,缓存采用普通的引用(强引用),采用固定的图片数量,每次只能有一个图片被访问。同时,由于采用的是LRU算法,所以,缓存中的图片是有可能被删除回收的。源码:/** * A cache that holds strong references to a limited number of Bitmaps. Each time a Bitmap is acce
2016-08-24 11:25:33 193
原创 Universal-Image-Loader源码阅读(14)-memory/impl/WeakMemoryCache
该类作为memorycache的实现类,它实现了 baseMemoryCache的抽想方法。该实现类,仅实现了弱引用的缓存。源码:/** * Memory cache with {@linkplain WeakReference weak references} to {@linkplain android.graphics.Bitmap bitmaps} * * NO
2016-08-24 11:16:19 200
原创 Universal-Image-Loader源码阅读(13)-cache/LimitedMemoryCache
在baseMemoryCache的基础上,继续定义了缓存图片的大小限制,以及最大的空间的限制。看名字,是有限制的缓存。并且增加了 硬链接的缓存源码:/** * Limited cache. Provides object storing. Size of all stored bitmaps will not to exceed size limit ( * {@lin
2016-08-22 16:40:15 177
原创 Universal-Image-Loader源码阅读(12)-cache/BaseMemoryCache
作为MemoryCache的第一个实现的抽象类,它主要的共鞥是定义了基本的存储方式--采用弱引用的方法,并且支持多线程的。源码:/** * Base memory cache. Implements common functionality for memory cache. Provides object references ( * {@linkplain Referenc
2016-08-22 16:20:17 162
原创 Universal-Image-loader源码阅读(11)-catche/MemoryCache
上一节涉及到了memorycatche,那么现在我们就看看MemoryCatche是如何实现的。源码:/** * Interface for memory cache * * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) * @since 1.9.2 */public interface MemoryCach
2016-08-22 16:18:27 171
原创 Universal-Image-Loader源码阅读(10)-utils/MemoryCacheUtils
图片内存key的生成工具类,用于生成图片的key值。依据图片的地址(uri),以及图片的大小(imageSize)主要功能包括图片的查找,图片的比较,图片key的生成相对功能简单。源码:/** * Utility for generating of keys for memory cache, key comparing and other work with mem
2016-08-22 15:36:30 272
原创 Universal-Image-Loader源码阅读(9)-utils/StorageUtils
硬件存储工具类也就是管理我们的缓存文件在手机硬件上存储的位置如果我们以后要做本地缓存文件的话,可以直接拷贝该文件,简单的修改一下目录名称,即可。源码:/** * Provides application storage paths * * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) * @since 1.0.0
2016-08-15 17:12:19 315
原创 Universal-Image-Loader源码阅读(8)-core/imageaware/NonViewAware
imageaware的空实现,即没有包装任何view,用来显示图片。看注释,它的用途是用来处理图片的相关信息的,但不用来显示图片。即用在下载解析图片的但又不用显示的场景。源码:/** * ImageAware which provides needed info for processing of original image but do nothing for dis
2016-08-15 17:03:51 405
原创 Universal-Image-Loader源码阅读(7)-core/imageaware/ImageViewAware
ImageAware的具体实现。对ImageView的包装。源码:/** * Wrapper for Android {@link android.widget.ImageView ImageView}. Keeps weak reference of ImageView to prevent memory * leaks. * * @author Sergey Tar
2016-08-15 16:58:24 203
原创 Universal-Image-Loader源码阅读(6)-core/imageaware/ViewAware
ImageArare的抽象类实现源码:/** * Wrapper for Android {@link android.view.View View}. Keeps weak reference of View to prevent memory leaks. * * @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
2016-08-15 16:47:58 204
原创 Universal-Image-Loader源码阅读(5)-core/iamgeaware/ImageAware
上一节涉及到了一个ImageAware的对象。我们当时一笔带过,在此对其进行细致的分析分析。ImageAware是个接口定义。注释内容很多!很好,我们读一读,基本就明白它是做什么的了。先看ImageAware源码:/** * Represents image aware view which provides all needed properties and behav
2016-08-15 14:25:11 298
原创 Universal-Image-Loader源码阅读(4)-utils/ImageSizeUtils
该工具类继承了L,IoUtils的特点。不过要相对代码量大了一点了。该工具类是用于计算图片大小的。源码:/** * Provides calculations with image sizes, scales * * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) * @since 1.8.3 */publ
2016-08-15 11:10:00 314
原创 Universal-Image-Loader源码阅读(3)-utils/IoUtils
该类从名字看就是IO工具类。同样类声明为final,构造为private,方法都是static。这些是工具类的标配呀!源码:/** * Provides I/O operations * * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) * @since 1.0.0 */public final
2016-08-15 10:53:12 186
原创 Universal-Image-Loader源码阅读(2)-utils/L
先捡简单的捏一捏呵呵工具类一般都具有通用性,以及简单的特点,所以选择工具类作为切入点,好像并不能切入主题,不过可以打扫一下周边的障碍,同时熟悉一下套路。该类为静态工具类,方法都是静态方法,构造函数为private,类声明为final这些我们都可以学习的,以后我们自己写工具类的时候也要参考。源码:/** * "Less-word" analog of And
2016-08-15 10:43:36 233
原创 Universal-Image-Loader源码阅读(1)-开篇
作为第二个阅读的开源代码,我选择了Universal-Image-Loader这个要比EventBus更加具有复杂性,并且代码量也更大,而且使用的很普遍,大家都比较熟悉。作为开篇,我还会采用从简入难的方法蚕食代码。没有什么好说的,下篇开始吧!
2016-08-15 10:42:17 205
原创 EventBus源码阅读(24)-EventBus-Sticky
就从原来没有度过的几个函数开始吧!1、postSticky(Object) /** * Posts the given event to the event bus and holds on to the event (because it is sticky). The most recent sticky * event of an event's t
2016-08-12 15:47:58 212
原创 EventBus源码阅读(23)-EventBus其它
看看还剩下那些函数没有读:我们一个个的看过来:1、builder() public static EventBusBuilder builder() { return new EventBusBuilder(); }该函数是静态的,返回的是一个新的EventBusBuilder那么可以猜测使用了个性化定制EventBusBuilder的
2016-08-12 15:16:09 623
原创 EventBus源码阅读(22)-EventBus注销
在Activity销毁的时候,我们需要注销其注册的事件此时调用的是unregister /** Unregisters the given subscriber from all event classes. */ public synchronized void unregister(Object subscriber) { List> subscribed
2016-08-12 15:06:19 871
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人