AndBase开发框架  1.6
 全部  命名空间 文件 函数 变量 枚举值 
Public 成员函数 | Protected 成员函数 | 静态包函数 | Private 成员函数 | 静态 Private 成员函数 | Private 属性 | 静态 Private 属性 | 所有成员列表
com.ab.image.toolbox.ImageRequest类 参考
类 com.ab.image.toolbox.ImageRequest 继承关系图:

Public 成员函数

 ImageRequest (String url, Response.Listener< Bitmap > listener, int maxWidth, int maxHeight, Config decodeConfig, Response.ErrorListener errorListener)
 
Priority getPriority ()
 

Protected 成员函数

Response< Bitmap > parseNetworkResponse (NetworkResponse response)
 
void deliverResponse (Bitmap response)
 

静态包函数

static int findBestSampleSize (int actualWidth, int actualHeight, int desiredWidth, int desiredHeight)
 

Private 成员函数

Response< Bitmap > doParse (NetworkResponse response)
 

静态 Private 成员函数

static int getResizedDimension (int maxPrimary, int maxSecondary, int actualPrimary, int actualSecondary)
 

Private 属性

final Response.Listener< Bitmap > mListener
 
final Config mDecodeConfig
 
final int mMaxWidth
 
final int mMaxHeight
 

静态 Private 属性

static final int IMAGE_TIMEOUT_MS = 1000
 
static final int IMAGE_MAX_RETRIES = 2
 
static final float IMAGE_BACKOFF_MULT = 2f
 
static final Object sDecodeLock = new Object()
 

详细描述

A canned request for getting an image at a given URL and calling back with a decoded Bitmap.

构造及析构函数说明

com.ab.image.toolbox.ImageRequest.ImageRequest ( String  url,
Response.Listener< Bitmap >  listener,
int  maxWidth,
int  maxHeight,
Config  decodeConfig,
Response.ErrorListener  errorListener 
)
inline

Creates a new image request, decoding to a maximum specified width and height. If both width and height are zero, the image will be decoded to its natural size. If one of the two is nonzero, that dimension will be clamped and the other one will be set to preserve the image's aspect ratio. If both width and height are nonzero, the image will be decoded to be fit in the rectangle of dimensions width x height while keeping its aspect ratio.

参数
urlURL of the image
listenerListener to receive the decoded bitmap
maxWidthMaximum width to decode this bitmap to, or zero for none
maxHeightMaximum height to decode this bitmap to, or zero for none
decodeConfigFormat to decode the bitmap to
errorListenerError listener, or null to ignore errors

成员函数说明

void com.ab.image.toolbox.ImageRequest.deliverResponse ( Bitmap  response)
inlineprotected
Response<Bitmap> com.ab.image.toolbox.ImageRequest.doParse ( NetworkResponse  response)
inlineprivate

The real guts of parseNetworkResponse. Broken out for readability.

static int com.ab.image.toolbox.ImageRequest.findBestSampleSize ( int  actualWidth,
int  actualHeight,
int  desiredWidth,
int  desiredHeight 
)
inlinestaticpackage

Returns the largest power-of-two divisor for use in downscaling a bitmap that will not result in the scaling past the desired dimensions.

参数
actualWidthActual width of the bitmap
actualHeightActual height of the bitmap
desiredWidthDesired width of the bitmap
desiredHeightDesired height of the bitmap
Priority com.ab.image.toolbox.ImageRequest.getPriority ( )
inline
static int com.ab.image.toolbox.ImageRequest.getResizedDimension ( int  maxPrimary,
int  maxSecondary,
int  actualPrimary,
int  actualSecondary 
)
inlinestaticprivate

Scales one side of a rectangle to fit aspect ratio.

参数
maxPrimaryMaximum size of the primary dimension (i.e. width for max width), or zero to maintain aspect ratio with secondary dimension
maxSecondaryMaximum size of the secondary dimension, or zero to maintain aspect ratio with primary dimension
actualPrimaryActual size of the primary dimension
actualSecondaryActual size of the secondary dimension
Response<Bitmap> com.ab.image.toolbox.ImageRequest.parseNetworkResponse ( NetworkResponse  response)
inlineprotected

类成员变量说明

final float com.ab.image.toolbox.ImageRequest.IMAGE_BACKOFF_MULT = 2f
staticprivate

Default backoff multiplier for image requests

final int com.ab.image.toolbox.ImageRequest.IMAGE_MAX_RETRIES = 2
staticprivate

Default number of retries for image requests

final int com.ab.image.toolbox.ImageRequest.IMAGE_TIMEOUT_MS = 1000
staticprivate

Socket timeout in milliseconds for image requests

final Config com.ab.image.toolbox.ImageRequest.mDecodeConfig
private
final Response.Listener<Bitmap> com.ab.image.toolbox.ImageRequest.mListener
private
final int com.ab.image.toolbox.ImageRequest.mMaxHeight
private
final int com.ab.image.toolbox.ImageRequest.mMaxWidth
private
final Object com.ab.image.toolbox.ImageRequest.sDecodeLock = new Object()
staticprivate

Decoding lock so that we don't decode more than one image at a time (to avoid OOM's)


该类的文档由以下文件生成: