com.nostra13.universalimageloader.core.imageaware
Class NonViewAware

java.lang.Object
  extended by com.nostra13.universalimageloader.core.imageaware.NonViewAware
All Implemented Interfaces:
ImageAware

public class NonViewAware
extends Object
implements ImageAware

ImageAware which provides needed info for processing of original image but do nothing for displaying image. It's used when user need just load and decode image and get it in callback.

Since:
1.9.0
Author:
Sergey Tarasevich (nostra13[at]gmail[dot]com)

Field Summary
protected  ImageSize imageSize
           
protected  String imageUri
           
protected  ViewScaleType scaleType
           
 
Constructor Summary
NonViewAware(ImageSize imageSize, ViewScaleType scaleType)
           
NonViewAware(String imageUri, ImageSize imageSize, ViewScaleType scaleType)
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imageUri

protected final String imageUri

imageSize

protected final ImageSize imageSize

scaleType

protected final ViewScaleType scaleType
Constructor Detail

NonViewAware

public NonViewAware(ImageSize imageSize,
                    ViewScaleType scaleType)

NonViewAware

public NonViewAware(String imageUri,
                    ImageSize imageSize,
                    ViewScaleType scaleType)
Method Detail

getWidth

public int getWidth()
Description copied from 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.
Is called on UI thread if ImageLoader was called on UI thread. Otherwise - on background thread.

Specified by:
getWidth in interface ImageAware

getHeight

public int getHeight()
Description copied from interface: ImageAware
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.

Specified by:
getHeight in interface ImageAware

getScaleType

public ViewScaleType getScaleType()
Description copied from interface: ImageAware
Returns scale type which is used for scaling image for this image aware view. Must NOT return null.

Specified by:
getScaleType in interface ImageAware

getWrappedView

public android.view.View getWrappedView()
Description copied from interface: ImageAware
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.

Specified by:
getWrappedView in interface ImageAware

isCollected

public boolean isCollected()
Description copied from interface: ImageAware
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.

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

getId

public int getId()
Description copied from interface: ImageAware
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.

Specified by:
getId in interface ImageAware

setImageDrawable

public boolean setImageDrawable(android.graphics.drawable.Drawable drawable)
Description copied from interface: ImageAware
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.

Specified by:
setImageDrawable in interface ImageAware
Returns:
true if drawable was set successfully; false - otherwise

setImageBitmap

public boolean setImageBitmap(android.graphics.Bitmap bitmap)
Description copied from interface: ImageAware
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.

Specified by:
setImageBitmap in interface ImageAware
Returns:
true if bitmap was set successfully; false - otherwise


Copyright © 2011-2014. All Rights Reserved.