本文整理汇总了Java中com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener类的典型用法代码示例。如果您正苦于以下问题:Java SimpleImageLoadingListener类的具体用法?Java SimpleImageLoadingListener怎么用?Java SimpleImageLoadingListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleImageLoadingListener类属于com.nostra13.universalimageloader.core.listener包,在下文中一共展示了SimpleImageLoadingListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: downloadImage
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener; //导入依赖的package包/类
private void downloadImage() {
MobclickAgent.onEvent(getActivity(), Event.STATUS_SAVE_IMAGE_OK);
this.imageLoader.loadImage(this.imageUrl, new SimpleImageLoadingListener() {
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
if (!HomePopView.this.isRemoved()) {
String result = FileUtil.downloadImage2Gallery(HomePopView.this.getActivity()
, loadedImage, new Md5FileNameGenerator().generate(HomePopView.this
.imageUrl));
if (TextUtils.isEmpty(result)) {
Helper.showToast((CharSequence) "保存图片失败,请重新保存~~");
} else {
Helper.showToast("图片已保存到" + result);
}
HomePopView.this.ivDownload.setEnabled(true);
}
}
});
}
示例2: getView
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
if(convertView == null)
{
convertView = LayoutInflater.from(context).inflate(R.layout.gallery_item, parent, false);
ViewGroup.LayoutParams params = convertView.findViewById(R.id.image).getLayoutParams();
params.width = params.height = width;
}
final ImageView iv_image = (ImageView) convertView.findViewById(R.id.image);
final String uri = "file://" + data.get(position).path;
imageLoader.displayImage(uri, iv_image, new SimpleImageLoadingListener()
{
@Override
public void onLoadingStarted(String imageUri, View view)
{
iv_image.setImageResource(R.drawable.picture_unavailable);
super.onLoadingStarted(imageUri, view);
}
});
return convertView;
}
示例3: onBindViewHolder
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener; //导入依赖的package包/类
@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
ButtonData item = items.get(position);
if (type == TYPE_ASSET) {
ImageLoader.getInstance().loadImage(urlsToAssets.get(position), new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
holder.button.setImageBitmap(loadedImage);
}
});
} else if (type == TYPE_DRAWABLE) {
holder.button.setImageDrawable(App.getVecDrawable(holder.itemView.getContext(), item.getIconRes()));
//holder.button.setColorFilter(colorFilter);
}
if (item.getTitle() == null) {
holder.title.setVisibility(View.GONE);
holder.itemView.setContentDescription(item.getText());
} else {
holder.itemView.setContentDescription(item.getTitle());
holder.title.setText(item.getTitle());
holder.title.setVisibility(View.VISIBLE);
}
}
示例4: load
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener; //导入依赖的package包/类
@Override
public void load(String path, int defaultRes, ImageView iv, final AbsImageLoader.ImageLoadingListener listener) {
if(!TextUtils.isEmpty(path)) {
if (!path.equals(iv.getTag())) {
iv.setTag(path);
ImageAware imageAware = new ImageViewAware(iv, false);
ImageLoader.getInstance().displayImage(path, imageAware,
getDefaultOptions(false, defaultRes), new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
if(listener!=null){
listener.onSuccess(imageUri, view);
}
}
});
}
}else{
iv.setImageResource(defaultRes);
}
}
示例5: updatePersonalInfo
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener; //导入依赖的package包/类
private void updatePersonalInfo(User user) {
personalName.setText(user.getNick());
personalSign.setText(user.getSignature());
ImageLoader.getInstance().displayImage(user.getAvatar(), personalIcon,
ImageLoadOptions.getOptions(),
new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view,
Bitmap loadedImage) {
// TODO Auto-generated method stub
super.onLoadingComplete(imageUri, view, loadedImage);
L.i(TAG, "load personal icon completed.");
}
}
);
}
示例6: onPostExecute
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener; //导入依赖的package包/类
@Override
protected void onPostExecute(String uri) {
ImageLoader.getInstance().displayImage(uri, playlistImage,
new DisplayImageOptions.Builder().cacheInMemory(true)
.showImageOnFail(R.drawable.ic_empty_music2)
.resetViewBeforeLoading(true)
.build(), new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
}
});
songcount.setText(" " + String.valueOf(songCountInt) + " " + mContext.getString(R.string.songs));
}
示例7: bindVoiceData
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener; //导入依赖的package包/类
@Override
public void bindVoiceData(StickerAdapt2Result stickerAdapt2Result) {
mViewDrawableOverlay.post(this::loadSticker);
if (stickerAdapt2Result.getScenes().size() > 0)
ImageLoader.getInstance().displayImage(Constants.setAliyunImageUrl(stickerAdapt2Result.getScenes().get(0).getImgname_url()), mIvBackground, new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
super.onLoadingComplete(imageUri, view, loadedImage);
Observable.just(loadedImage)
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.filter(loadedImg -> loadedImg != null && !loadedImg.isRecycled())
.subscribe(loadedImg -> {
int hashName = FileUtil.STICKER_BG_NAME.hashCode();
FileUtil.saveBitmap(FileUtil.getAppFilePath(FileUtil.DIR_STICKERS) + hashName, loadedImage);
}, Throwable::printStackTrace);
}
});
}
示例8: displayImage
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener; //导入依赖的package包/类
public void displayImage(MQImageView imageView, String path, @DrawableRes int loadingResId,
@DrawableRes int failResId, int width, int height, final
MQDisplayImageListener displayImageListener) {
initImageLoader(imageView.getContext());
if (path == null) {
path = "";
}
if (!(path.startsWith("http") || path.startsWith("file"))) {
path = "file://" + path;
}
String str = path;
ImageLoader.getInstance().displayImage(str, new ImageViewAware(imageView), new
DisplayImageOptions.Builder().showImageOnLoading(loadingResId).showImageOnFail
(failResId).cacheInMemory(true).build(), new ImageSize(width, height), new
SimpleImageLoadingListener() {
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
if (displayImageListener != null) {
displayImageListener.onSuccess(view, imageUri);
}
}
}, null);
}
示例9: loadBooheePic
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener; //导入依赖的package包/类
private void loadBooheePic() {
new Thread(new Runnable() {
public void run() {
for (int i = 0; i < 100; i++) {
MyFavoriteActivity.this.imageUrl = String.format("http://up.boohee" +
".cn/house/u/one/reminder/%d.jpg", new Object[]{Integer.valueOf(i)});
MyFavoriteActivity.this.imageLoader.loadImage(MyFavoriteActivity.this
.imageUrl, new SimpleImageLoadingListener() {
public void onLoadingComplete(String imageUri, View view, Bitmap
loadedImage) {
super.onLoadingComplete(imageUri, view, loadedImage);
new SaveImageTask().execute(new Bitmap[]{loadedImage});
}
});
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}).start();
}
示例10: doLoadImage
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener; //导入依赖的package包/类
/**
* ImageLoader异步加载
*/
private void doLoadImage(final boolean needLoad, final String tag, final String url, final int thumbSize) {
if (needLoad) {
setTag(tag); // 解决ViewHolder复用问题
/**
* 若使用网易云信云存储,这里可以设置下载图片的压缩尺寸,生成下载URL
* 如果图片来源是非网易云信云存储,请不要使用NosThumbImageUtil
*/
final String thumbUrl = makeAvatarThumbNosUrl(url, thumbSize);
// 异步从cache or NOS加载图片
ImageLoader.getInstance().displayImage(thumbUrl, new NonViewAware(new ImageSize(thumbSize, thumbSize),
ViewScaleType.CROP), options, new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
if (getTag() != null && getTag().equals(tag)) {
setImageBitmap(loadedImage);
}
}
});
} else {
setTag(null);
}
}
示例11: onCreate
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.assistant_metro_activity_map_view);
String cityName = getIntent().getStringExtra("name");
final String imageUrl = getIntent().getStringExtra("imageUrl");
Log.d(">>>imageUrl", imageUrl);
UIHelp.setHeaderMenuView(this, cityName + "地铁线路图");
imageView = (GestureImageView) findViewById(R.id.imageView);
ImageLoadUtil.getInstance().loadImage(imageUrl, new SimpleImageLoadingListener(){
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
imageView.setImageBitmap(loadedImage);
}
});
}
示例12: setToolbarAndStatusColorAccordingToEventImage
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener; //导入依赖的package包/类
private void setToolbarAndStatusColorAccordingToEventImage() {
if(event.hasImage()) {
MyImageLoader.getInstance().getImageLoader().loadImage(event.getImage(), new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
super.onLoadingComplete(imageUri, view, loadedImage);
Palette.from(loadedImage).generate(new Palette.PaletteAsyncListener() {
@Override
public void onGenerated(Palette palette) {
int darkVibrantColor = palette.getDarkVibrantColor(getResources().getColor(R.color.primaryDark));
int vibrantColor = palette.getVibrantColor(getResources().getColor(R.color.primary));
collapsingToolbarLayout.setContentScrimColor(vibrantColor);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = EventDetailActivity.this.getWindow();
window.setStatusBarColor(darkVibrantColor);
}
}
});
}
});
}
}
示例13: onCreate
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pic_detail);
ButterKnife.bind(this);
imgUrl = getIntent().getStringExtra("IMAGE_URL");
photoViewAttacher = new PhotoViewAttacher(pvPic);
DisplayImageOptions options = new DisplayImageOptions.Builder()
.cacheOnDisk(true).considerExifParams(true).build();
ImageLoader.getInstance().displayImage(imgUrl,pvPic,options,
new SimpleImageLoadingListener(){
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
progressBar.setVisibility(View.GONE);
photoViewAttacher.update();
}
});
}
示例14: onCreateView
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_beauty, container, false);
mBeautyImg = (ImageView) v.findViewById(R.id.beautyImg);
mAttacher = new PhotoViewAttacher(mBeautyImg);
ImageLoaderUtil.displayImage(url, mBeautyImg,
ImageLoaderUtil.getDefaultOptions(),new SimpleImageLoadingListener(){
@Override
public void onLoadingComplete(String imageUri, View view,
Bitmap loadedImage) {
super.onLoadingComplete(imageUri, view, loadedImage);
mAttacher.update();
}
});
return v;
}
示例15: fillImage
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener; //导入依赖的package包/类
/**
* Method fillInfo
* all written info is filled
*
* @param filmDetail
*/
private void fillImage(FilmDetailsJSONEntity filmDetail) {
// Finally the image loaded by Universal Image Loader library
final String titleOfFilm = filmDetail.getTitle();
// Load image, decode it to Bitmap and return Bitmap to callback
ImageLoader.getInstance().displayImage(filmDetail.getUrlPoster(), imgExtended, new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
// Do whatever you want with Bitmap
Palette.generateAsync(loadedImage, new Palette.PaletteAsyncListener() {
public void onGenerated(Palette palette) {
applyPalette(palette, titleOfFilm);
}
});
}
});
}