Universal-Image-Loader源码阅读(5)-core/iamgeaware/ImageAware
来源:互联网 发布:私募排排网数据申报 编辑:程序博客网 时间:2024/05/18 01:36
上一节涉及到了一个ImageAware的对象。
我们当时一笔带过,在此对其进行细致的分析分析。
ImageAware是个接口定义。注释内容很多!很好,我们读一读,基本就明白它是做什么的了。
先看ImageAware源码:
/** * Represents image aware view which provides all needed properties and behavior for image processing and displaying * through {@link com.nostra13.universalimageloader.core.ImageLoader ImageLoader}. * It can wrap any Android {@link android.view.View View} which can be accessed by {@link #getWrappedView()}. Wrapped * view is returned in {@link com.nostra13.universalimageloader.core.listener.ImageLoadingListener ImageLoadingListener}'s * callbacks. * * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) * @see ViewAware * @see ImageViewAware * @see NonViewAware * @since 1.9.0 */public interface ImageAware {/** * Returns width of image aware view. This value is used to define scale size for original image. * Can return 0 if width is undefined.<br /> * Is called on UI thread if ImageLoader was called on UI thread. Otherwise - on background thread. */int getWidth();//显示图片的wiew的宽度,用于定义图片的缩放比例/** * Returns height of image aware view. This value is used to define scale size for original image. * Can return 0 if height is undefined.<br /> * Is called on UI thread if ImageLoader was called on UI thread. Otherwise - on background thread. */int getHeight();/** * Returns {@linkplain com.nostra13.universalimageloader.core.assist.ViewScaleType scale type} which is used for * scaling image for this image aware view. Must <b>NOT</b> return <b>null</b>. */ViewScaleType getScaleType();//缩放模式/** * Returns wrapped Android {@link android.view.View View}. Can return <b>null</b> if no view is wrapped or view was * collected by GC.<br /> * Is called on UI thread if ImageLoader was called on UI thread. Otherwise - on background thread. */View getWrappedView();//包装的view,用于显示image的,例如我们用的imageView/** * Returns a flag whether image aware view is collected by GC or whatsoever. If so then ImageLoader stop processing * of task for this image aware view and fires * {@link com.nostra13.universalimageloader.core.listener.ImageLoadingListener#onLoadingCancelled(String, * android.view.View) ImageLoadingListener#onLoadingCancelled(String, View)} callback.<br /> * Mey be called on UI thread if ImageLoader was called on UI thread. Otherwise - on background thread. * * @return <b>true</b> - if view is collected by GC and ImageLoader should stop processing this image aware view; * <b>false</b> - otherwise */boolean isCollected();//我们包装的view是否已经被系统回收/** * Returns ID of image aware view. Point of ID is similar to Object's hashCode. This ID should be unique for every * image view instance and should be the same for same instances. This ID identifies processing task in ImageLoader * so ImageLoader won't process two image aware views with the same ID in one time. When ImageLoader get new task * it cancels old task with this ID (if any) and starts new task. * <p/> * It's reasonable to return hash code of wrapped view (if any) to prevent displaying non-actual images in view * because of view re-using. */int getId();//包装的view的id/** * Sets image drawable into this image aware view.<br /> * Displays drawable in this image aware view * {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions.Builder#showImageForEmptyUri( *android.graphics.drawable.Drawable) for empty Uri}, * {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions.Builder#showImageOnLoading( *android.graphics.drawable.Drawable) on loading} or * {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions.Builder#showImageOnFail( *android.graphics.drawable.Drawable) on loading fail}. These drawables can be specified in * {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions display options}.<br /> * Also can be called in {@link com.nostra13.universalimageloader.core.display.BitmapDisplayer BitmapDisplayer}.< br /> * Is called on UI thread if ImageLoader was called on UI thread. Otherwise - on background thread. * * @return <b>true</b> if drawable was set successfully; <b>false</b> - otherwise */boolean setImageDrawable(Drawable drawable);/** * Sets image bitmap into this image aware view.<br /> * Displays loaded and decoded image {@link android.graphics.Bitmap} in this image view aware. * Actually it's used only in * {@link com.nostra13.universalimageloader.core.display.BitmapDisplayer BitmapDisplayer}.< br /> * Is called on UI thread if ImageLoader was called on UI thread. Otherwise - on background thread. * * @return <b>true</b> if bitmap was set successfully; <b>false</b> - otherwise */boolean setImageBitmap(Bitmap bitmap);}
明显是个接口,用于包装真正的imgeView。
0 0
- Universal-Image-Loader源码阅读(5)-core/iamgeaware/ImageAware
- Universal-Image-Loader源码阅读(6)-core/imageaware/ViewAware
- Universal-Image-Loader源码阅读(7)-core/imageaware/ImageViewAware
- Universal-Image-Loader源码阅读(8)-core/imageaware/NonViewAware
- Universal-Image-Loader源码阅读(35)-
- 【Android框架】Android-universal-image-loader源码阅读(一)
- Universal-Image-Loader源码阅读(1)-开篇
- Universal-Image-Loader源码阅读(2)-utils/L
- Universal-Image-Loader源码阅读(3)-utils/IoUtils
- Universal-Image-Loader源码阅读(4)-utils/ImageSizeUtils
- Universal-Image-Loader源码阅读(9)-utils/StorageUtils
- Universal-Image-Loader源码阅读(10)-utils/MemoryCacheUtils
- Universal-Image-loader源码阅读(11)-catche/MemoryCache
- Universal-Image-Loader源码阅读(12)-cache/BaseMemoryCache
- Universal-Image-Loader源码阅读(13)-cache/LimitedMemoryCache
- Universal-Image-Loader源码阅读(14)-memory/impl/WeakMemoryCache
- Universal-Image-Loader源码阅读(15)-memory/impl/LruMemoryCache
- Universal-Image-Loader源码阅读(16)-memory/impl/FuzzyKeyMemoryCache
- Cookie跨域操作
- kafka中文文档(0.10.0)
- 总结
- Centos 7.2 安装 Ambari 2.2.2 + HDP 2.4.2 搭建Hadoop集群
- 守护进程
- Universal-Image-Loader源码阅读(5)-core/iamgeaware/ImageAware
- Linux 标准I/O函数库
- 自定义View实现加载巨图
- python基础篇总结
- priority_queue 用法详解
- 关于Qt5的录音
- Linux 文件描述符与索引节点
- OPENGL---Ps 径向模糊算法(glsl)
- IOS Dev Intro - Frameworks