public abstract class ViewAware extends java.lang.Object implements ImageAware
View
. Keeps weak reference of View to prevent memory leaks.Modifier and Type | Field and Description |
---|---|
protected boolean |
checkActualViewSize |
protected java.lang.ref.Reference<android.view.View> |
viewRef |
static java.lang.String |
WARN_CANT_SET_BITMAP |
static java.lang.String |
WARN_CANT_SET_DRAWABLE |
Constructor and Description |
---|
ViewAware(android.view.View view)
Constructor.
|
ViewAware(android.view.View view,
boolean checkActualViewSize)
Constructor
|
Modifier and Type | Method and Description |
---|---|
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.
Displays loaded and decoded image Bitmap in this image view aware. |
protected abstract void |
setImageBitmapInto(android.graphics.Bitmap bitmap,
android.view.View view)
Should set Bitmap into incoming view.
|
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. |
protected abstract void |
setImageDrawableInto(android.graphics.drawable.Drawable drawable,
android.view.View view)
Should set drawable into incoming view.
|
public static final java.lang.String WARN_CANT_SET_DRAWABLE
public static final java.lang.String WARN_CANT_SET_BITMAP
protected java.lang.ref.Reference<android.view.View> viewRef
protected boolean checkActualViewSize
public ViewAware(android.view.View view)
ImageViewAware(imageView, true)
.view
- View
to work withpublic ViewAware(android.view.View view, boolean checkActualViewSize)
view
- View
to work withcheckActualViewSize
- true - then getWidth()
and getHeight()
will check actual
size of View. It can cause known issues like
this.
But it helps to save memory because memory cache keeps bitmaps of actual (less in
general) size.
false - then getWidth()
and getHeight()
will NOT
consider actual size of View, just layout parameters. public int getWidth()
view
parameters, configuration
parameters or device display dimensions.getWidth
in interface ImageAware
public int getHeight()
view
parameters, configuration
parameters or device display dimensions.getHeight
in interface ImageAware
public ViewScaleType getScaleType()
ImageAware
getScaleType
in interface ImageAware
public android.view.View getWrappedView()
ImageAware
View
. Can return null if no view is wrapped or view was
collected by GC.getWrappedView
in interface ImageAware
public boolean isCollected()
ImageAware
ImageLoadingListener#onLoadingCancelled(String, View)
callback.isCollected
in interface ImageAware
public int getId()
ImageAware
getId
in interface ImageAware
public boolean setImageDrawable(android.graphics.drawable.Drawable drawable)
ImageAware
BitmapDisplayer
.< br />
Is called on UI thread if ImageLoader was called on UI thread. Otherwise - on background thread.setImageDrawable
in interface ImageAware
public boolean setImageBitmap(android.graphics.Bitmap bitmap)
ImageAware
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.setImageBitmap
in interface ImageAware
protected abstract void setImageDrawableInto(android.graphics.drawable.Drawable drawable, android.view.View view)
protected abstract void setImageBitmapInto(android.graphics.Bitmap bitmap, android.view.View view)