com.nostra13.universalimageloader.core.assist.SimpleImageLoadingListener Java Examples

The following examples show how to use com.nostra13.universalimageloader.core.assist.SimpleImageLoadingListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImageAdapter.java    From android-opensource-library-56 with Apache License 2.0 6 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.image_item, null);
    }
    Photo photo = getItem(position);
    ImageView imageView = (ImageView) convertView.findViewById(R.id.image);
    imageView.setTag(photo.getMediumUrl());
    imageView.setImageBitmap(null);
    ImageLoader.getInstance().cancelDisplayTask(imageView);

    ImageLoader.getInstance().displayImage(photo.getMediumUrl(), imageView, new SimpleImageLoadingListener() {
        @Override
        public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
            if (view.getTag().equals(imageUri)) {
                ((ImageView) view).setImageBitmap(loadedImage);
            }
        }
    });
    
    return convertView;
}
 
Example #2
Source File: MainActivity.java    From q-municate-android with Apache License 2.0 5 votes vote down vote up
private void loadLogoActionBar(String logoUrl) {
    ImageLoader.getInstance().loadImage(logoUrl, ImageLoaderUtils.UIL_USER_AVATAR_DISPLAY_OPTIONS,
            new SimpleImageLoadingListener() {

                @Override
                public void onLoadingComplete(String imageUri, View view, Bitmap loadedBitmap) {
                    setActionBarIcon(MediaUtils.getRoundIconDrawable(MainActivity.this, loadedBitmap));
                }
            });
}
 
Example #3
Source File: BaseDialogActivity.java    From q-municate-android with Apache License 2.0 5 votes vote down vote up
protected void loadActionBarLogo(String logoUrl) {
    ImageLoader.getInstance().loadImage(logoUrl, ImageLoaderUtils.UIL_USER_AVATAR_DISPLAY_OPTIONS,
            new SimpleImageLoadingListener() {

                @Override
                public void onLoadingComplete(String imageUri, View view, Bitmap loadedBitmap) {
                    setActionBarIcon(
                            MediaUtils.getRoundIconDrawable(BaseDialogActivity.this, loadedBitmap));
                }
            });
}
 
Example #4
Source File: AsyncImageGetter.java    From v2ex-daily-android with Apache License 2.0 5 votes vote down vote up
@Override
public Drawable getDrawable(String source) {
    final URLDrawable urlDrawable = new URLDrawable();
    ImageLoader.getInstance().loadImage(source, new SimpleImageLoadingListener() {
        @Override
        public void onLoadingComplete(String s, View view, Bitmap bitmap) {
            if (bitmap != null) {
                int width;
                int height;
                if (bitmap.getWidth() > mMaxWidth) {
                    width = mMaxWidth;
                    height = mMaxWidth * bitmap.getHeight() / bitmap.getWidth();
                } else {
                    width = bitmap.getWidth();
                    height = bitmap.getHeight();
                }
                Drawable drawable = new BitmapDrawable(mContext.getResources(), bitmap);
                drawable.setBounds(0, 0, width, height);
                urlDrawable.setBounds(0, 0, width, height);
                urlDrawable.mDrawable = drawable;
                //reset text to invalidate.
                mContainer.setText(mContainer.getText());
            }
        }
    });
    return urlDrawable;
}
 
Example #5
Source File: ZenGalleryActivity.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {

	if (convertView == null) {
		convertView = mInflater
				.inflate(R.layout.zen_gallery_item, null);
	}

	ImageView GallerySelector = (ImageView) convertView
			.findViewById(R.id.zen_gallery_selector);
	final ImageView imageView = (ImageView) convertView
			.findViewById(R.id.zen_gallery_item);

	imageLoader.displayImage("file://" + imageUrls.get(position),
			imageView, options, new SimpleImageLoadingListener() {
				@Override
				public void onLoadingComplete(Bitmap loadedImage) {
					Animation anim = AnimationUtils
							.loadAnimation(ZenGalleryActivity.this,
									R.anim.zen_fade_in);
					imageView.setAnimation(anim);
					anim.start();
				}
			});

	int selector = (mSparseBooleanArray.get(position) ? R.drawable.checkbox_selected : R.drawable.checkbox_normal);
	GallerySelector.setTag(position);
	GallerySelector.setImageResource(selector);
	
	return convertView;
}
 
Example #6
Source File: CustomGalleryAdapter.java    From MultipleImagePicker with Apache License 2.0 4 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {

	final ViewHolder holder;
	if (convertView == null) {

		convertView = infalter.inflate(R.layout.gallery_item, null);
		holder = new ViewHolder();
		holder.imgQueue = (ImageView) convertView
				.findViewById(R.id.imgQueue);

		holder.imgQueueMultiSelected = (ImageView) convertView
				.findViewById(R.id.imgQueueMultiSelected);

		if (isActionMultiplePick) {
			holder.imgQueueMultiSelected.setVisibility(View.VISIBLE);
		} else {
			holder.imgQueueMultiSelected.setVisibility(View.GONE);
		}

		convertView.setTag(holder);

	} else {
		holder = (ViewHolder) convertView.getTag();
	}
	holder.imgQueue.setTag(position);

	try {

		imageLoader.displayImage("file://" + data.get(position).sdcardPath,
				holder.imgQueue, new SimpleImageLoadingListener() {
					@Override
					public void onLoadingStarted(String imageUri, View view) {
						holder.imgQueue
								.setImageResource(R.drawable.no_media);
						super.onLoadingStarted(imageUri, view);
					}
				});

		if (isActionMultiplePick) {

			holder.imgQueueMultiSelected
					.setSelected(data.get(position).isSeleted);

		}

	} catch (Exception e) {
		e.printStackTrace();
	}

	return convertView;
}