本文整理汇总了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);
}