本文整理匯總了Java中org.kymjs.kjframe.bitmap.BitmapCallBack類的典型用法代碼示例。如果您正苦於以下問題:Java BitmapCallBack類的具體用法?Java BitmapCallBack怎麽用?Java BitmapCallBack使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BitmapCallBack類屬於org.kymjs.kjframe.bitmap包,在下文中一共展示了BitmapCallBack類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initWidget
import org.kymjs.kjframe.bitmap.BitmapCallBack; //導入依賴的package包/類
@Override
public void initWidget() {
super.initWidget();
kjb.display(mImg, url, new BitmapCallBack() {
@Override
public void onPreLoad() {
super.onPreLoad();
mProgressBar.setVisibility(View.VISIBLE);
}
@Override
public void onFinish() {
super.onFinish();
mProgressBar.setVisibility(View.GONE);
}
});
mImg.setOnFinishListener(new PhotoViewAttacher.OnPhotoTapListener() {
@Override
public void onPhotoTap(View view, float x, float y) {
ImageActivity.this.finish();
}
});
}
示例2: setAvatarUrl
import org.kymjs.kjframe.bitmap.BitmapCallBack; //導入依賴的package包/類
public void setAvatarUrl(String url) {
if (StringUtils.isEmpty(url)) {
setImageResource(R.mipmap.widget_dface);
return;
}
// 由於頭像地址默認加了一段參數需要去掉
int end = url.indexOf('?');
final String headUrl;
if (end > 0) {
headUrl = url.substring(0, end);
} else {
headUrl = url;
}
kjb.display(this, headUrl, R.mipmap.widget_dface, 0, 0,
new BitmapCallBack() {
@Override
public void onFailure(Exception e) {
super.onFailure(e);
aty.runOnUiThread(new Runnable() {
@Override
public void run() {
setImageResource(R.mipmap.widget_dface);
}
});
setImageResource(R.mipmap.widget_dface);
}
});
}
示例3: display3
import org.kymjs.kjframe.bitmap.BitmapCallBack; //導入依賴的package包/類
private void display3() {
KJBitmap kjb = new KJBitmap();
kjb.display(
mImg3,
"http://static.oschina.net/uploads/space/2015/0420/133006_NnLQ_12.jpg",
new BitmapCallBack() {
@Override
public void onPreLoad() {
super.onPreLoad();
ViewInject.toast("即將開始下載");
}
@Override
public void onSuccess(Bitmap bitmap) {
super.onSuccess(bitmap);
ViewInject.toast("加載成功");
}
@Override
public void onFailure(Exception e) {
super.onFailure(e);
ViewInject.toast("加載失敗");
}
@Override
public void onFinish() {
super.onFinish();
ViewInject.toast("加載完成");
}
});
}
示例4: display
import org.kymjs.kjframe.bitmap.BitmapCallBack; //導入依賴的package包/類
@Deprecated
public void display(View imageView, String imageUrl, int loadAndErrorRes,
int width, int height, BitmapCallBack callback) {
new Builder().view(imageView).imageUrl(imageUrl).loadBitmapRes(loadAndErrorRes)
.errorBitmapRes(loadAndErrorRes).width(width).height(height).callback(callback)
.display(this);
}
示例5: doDisplay
import org.kymjs.kjframe.bitmap.BitmapCallBack; //導入依賴的package包/類
/**
* 真正去加載一個圖片
*/
public void doDisplay(final View imageView, final String imageUrl, int width, int height,
final Drawable loadBitmap, final int loadBitmapRes,
final Drawable errorBitmap, final int errorBitmapRes,
final BitmapCallBack callback) {
imageView.setTag(imageUrl);
BitmapCallBack bitmapCallBack = new BitmapCallBack() {
@Override
public void onPreLoad() {
super.onPreLoad();
if (getMemoryCache(imageUrl) == null)
setImageWithResource(imageView, loadBitmap, loadBitmapRes);
if (callback != null)
callback.onPreLoad();
}
@Override
public void onSuccess(Bitmap bitmap) {
super.onSuccess(bitmap);
if (imageUrl.equals(imageView.getTag())) {
doSuccess(imageView, bitmap, errorBitmap, errorBitmapRes);
if (callback != null)
callback.onSuccess(bitmap);
currentUrls.add(imageUrl);
}
}
@Override
public void onFailure(Exception e) {
super.onFailure(e);
doFailure(imageView, errorBitmap, errorBitmapRes);
if (callback != null) {
callback.onFailure(e);
}
}
@Override
public void onFinish() {
if (callback != null) {
callback.onFinish();
}
}
@Override
public void onDoHttp() {
super.onDoHttp();
if (callback != null) {
callback.onDoHttp();
}
}
};
if (imageUrl.startsWith("http")) {
displayer.get(imageUrl, width, height, bitmapCallBack);
} else {
if (diskImageRequest == null) {
diskImageRequest = new DiskImageRequest();
}
diskImageRequest.load(imageUrl, width, height, bitmapCallBack);
}
}
示例6: displayWithDefWH
import org.kymjs.kjframe.bitmap.BitmapCallBack; //導入依賴的package包/類
@Deprecated
public void displayWithDefWH(View imageView, String imageUrl, Drawable loadBitmap,
Drawable errorBitmap, BitmapCallBack callback) {
new Builder().view(imageView).imageUrl(imageUrl).loadBitmap(loadBitmap)
.errorBitmap(errorBitmap).callback(callback).display(this);
}