抱歉我的英文。首先,我使用库Picasso
它是一个很好的库,有很多可能性,但它不存储在缓存中。然后我了解了库ImageLoader
优秀的库,它可以将图像存储在缓存中。但我首先在示例Picasso
上进行了应用。例如,我在Picasso
中模糊了图像:
//code
Picasso.with(context).load(profileList.get(0).getImage())
.resize(100, 100)
.centerInside()
.into(target);
//code
private Target target = new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
Bitmap b;
b = fastblur(bitmap, 3); // fastblur method blur image
int color = Color.parseColor("#8C2d569c")
foneImage.setColorFilter(color); //set filter
foneImage.setImageBitmap(b); //and set image
}
@Override
public void onBitmapFailed(Drawable arg0) {
// TODO Auto-generated method stub
}
@Override
public void onPrepareLoad(Drawable arg0) {
// TODO Auto-generated method stub
}
};
但现在我不知道如何将此代码移至ImageLoader
。以下是我使用ImageLoader
并在ImageView
mImageLoader.displayImage(profileList.get(0).getImage(), imageProfile, null, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String arg0, View arg1) {
Log.e("Script", "OnLoadeing");
}
@Override
public void onLoadingFailed(String arg0, View arg1, FailReason arg2) {
Log.e("Script", "OnLoadeingComplete");
}
@Override
public void onLoadingComplete(String arg0, View arg1, Bitmap arg2) {
Log.e("Script", "OnLoadeingFailed");
}
@Override
public void onLoadingCancelled(String arg0, View arg1) {
Log.e("Script", "OnLoadeingStarted");
}
}, new ImageLoadingProgressListener() {
@Override
public void onProgressUpdate(String uri, View view, int current, int total) {
Log.e("Script", "OnProgressUpdate" + uri + " " + total);
}
})
;
如何在fastblur (bitmap, 3);
中添加方法mImageLoader
?
UPD:
我对问题的回答
mImageLoader.displayImage(profileList.get(0).getImage(), foneImage, null, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String arg0, View arg1) {
Log.e("Script", "OnLoadeing");
}
@Override
public void onLoadingFailed(String arg0, View arg1, FailReason arg2) {
Log.e("Script", "OnLoadeingComplete");
}
@Override
public void onLoadingComplete(String arg0, View arg1, Bitmap arg2) {
Bitmap b;
b = fastblur(arg2, 5);
int color = Color.parseColor("#8C2d569c"); //The color u want
foneImage.setColorFilter(color);
foneImage.setImageBitmap(b);
}
@Override
public void onLoadingCancelled(String arg0, View arg1) {
Log.e("Script", "OnLoadeingStarted");
}
}, new ImageLoadingProgressListener() {
@Override
public void onProgressUpdate(String uri, View view, int current, int total) {
Log.e("Script", "OnProgressUpdate" + uri + " " + total);
}
});
答案 0 :(得分:2)
如果这不是最终类,你应该继承mImageLoader的原型,然后在这个新类中添加你的方法。