com.nostra13.universalimageloader.core.imageaware
Interface ImageAware

All Known Implementing Classes:
ImageViewAware, NonViewAware, ViewAware

public interface ImageAware

Represents image aware view which provides all needed properties and behavior for image processing and displaying through ImageLoader. It can wrap any Android View which can be accessed by getWrappedView(). Wrapped view is returned in ImageLoadingListener's callbacks.

Since:
1.9.0
Author:
Sergey Tarasevich (nostra13[at]gmail[dot]com)
See Also:
ViewAware, ImageViewAware, NonViewAware

Method Summary
 int getHeight()
          Returns height of image aware view.
 int getId()
          Returns ID of image aware view.
 ViewScaleType getScaleType()
          Returns scale type which is used for scaling image for this image aware view.
 int getWidth()
          Returns width of image aware view.
 android.view.View getWrappedView()
          Returns wrapped Android View.
 boolean isCollected()
          Returns a flag whether image aware view is collected by GC or whatsoever.
 boolean setImageBitmap(android.graphics.Bitmap bitmap)
          Sets image bitmap into this image aware view.
 boolean setImageDrawable(android.graphics.drawable.Drawable drawable)
          Sets image drawable into this image aware view.
 

Method Detail

getWidth

int getWidth()
Returns width of image aware view. This value is used to define scale size for original image. Can return 0 if width is undefined.
Is called on UI thread if ImageLoader was called on UI thread. Otherwise - on background thread.


getHeight

int getHeight()
Returns height of image aware view. This value is used to define scale size for original image. Can return 0 if height is undefined.
Is called on UI thread if ImageLoader was called on UI thread. Otherwise - on background thread.


getScaleType

ViewScaleType getScaleType()
Returns scale type which is used for scaling image for this image aware view. Must NOT return null.


getWrappedView

android.view.View getWrappedView()
Returns wrapped Android View. Can return null if no view is wrapped or view was collected by GC.
Is called on UI thread if ImageLoader was called on UI thread. Otherwise - on background thread.


isCollected

boolean isCollected()
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 ImageLoadingListener#onLoadingCancelled(String, View) callback.
Mey be called on UI thread if ImageLoader was called on UI thread. Otherwise - on background thread.

Returns:
true - if view is collected by GC and ImageLoader should stop processing this image aware view; false - otherwise

getId

int getId()
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.

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.


setImageDrawable

boolean setImageDrawable(android.graphics.drawable.Drawable drawable)
Sets image drawable into this image aware view.
Displays drawable in this image aware view for empty Uri, on loading or on loading fail. These drawables can be specified in display options.
Also can be called in BitmapDisplayer.< br /> Is called on UI thread if ImageLoader was called on UI thread. Otherwise - on background thread.

Returns:
true if drawable was set successfully; false - otherwise

setImageBitmap

boolean setImageBitmap(android.graphics.Bitmap bitmap)
Sets image bitmap into this image aware view.
Displays loaded and decoded image Bitmap in this image view aware. Actually it's used only in BitmapDisplayer.< br /> Is called on UI thread if ImageLoader was called on UI thread. Otherwise - on background thread.

Returns:
true if bitmap was set successfully; false - otherwise


Copyright © 2011-2014. All Rights Reserved.