Search in sources :

Example 1 with SimpleImageLoadingListener

use of com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener in project Slide by ccrama.

the class Image method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.submission_imagecard, container, false);
    final SubsamplingScaleImageView image = (SubsamplingScaleImageView) rootView.findViewById(R.id.image);
    TextView title = (TextView) rootView.findViewById(R.id.title);
    TextView desc = (TextView) rootView.findViewById(R.id.desc);
    title.setVisibility(View.GONE);
    desc.setVisibility(View.GONE);
    ((Reddit) getContext().getApplicationContext()).getImageLoader().loadImage(url, new SimpleImageLoadingListener() {

        @Override
        public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
            image.setImage(ImageSource.bitmap(loadedImage));
        }
    });
    return rootView;
}
Also used : SimpleImageLoadingListener(com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener) Bitmap(android.graphics.Bitmap) ViewGroup(android.view.ViewGroup) SubsamplingScaleImageView(com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView) TextView(android.widget.TextView) SubsamplingScaleImageView(com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView) TextView(android.widget.TextView) View(android.view.View)

Example 2 with SimpleImageLoadingListener

use of com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener in project NewPipe by TeamNewPipe.

the class VideoDetailFragment method initThumbnailViews.

private void initThumbnailViews(@NonNull StreamInfo info) {
    thumbnailImageView.setImageResource(R.drawable.dummy_thumbnail_dark);
    if (!TextUtils.isEmpty(info.getThumbnailUrl())) {
        final String infoServiceName = NewPipe.getNameOfService(info.getServiceId());
        final ImageLoadingListener onFailListener = new SimpleImageLoadingListener() {

            @Override
            public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
                showSnackBarError(failReason.getCause(), UserAction.LOAD_IMAGE, infoServiceName, imageUri, R.string.could_not_load_thumbnails);
            }
        };
        imageLoader.displayImage(info.getThumbnailUrl(), thumbnailImageView, ImageDisplayConstants.DISPLAY_THUMBNAIL_OPTIONS, onFailListener);
    }
    if (!TextUtils.isEmpty(info.getUploaderAvatarUrl())) {
        imageLoader.displayImage(info.getUploaderAvatarUrl(), uploaderThumb, ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS);
    }
}
Also used : SimpleImageLoadingListener(com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener) SimpleImageLoadingListener(com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener) ImageLoadingListener(com.nostra13.universalimageloader.core.listener.ImageLoadingListener) FailReason(com.nostra13.universalimageloader.core.assist.FailReason) ImageView(android.widget.ImageView) ParallaxScrollView(com.nirhart.parallaxscroll.views.ParallaxScrollView) View(android.view.View) AdapterView(android.widget.AdapterView) AnimationUtils.animateView(org.schabi.newpipe.util.AnimationUtils.animateView) TextView(android.widget.TextView)

Example 3 with SimpleImageLoadingListener

use of com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener in project BlogSource by TeachCourse.

the class DownloadImgAPI method setImageViewSize.

/**
 * 指定加载图片的大小
 *
 * @param imageView
 * @param url
 */
public static void setImageViewSize(final ImageView imageView, String url) {
    ImageSize targetSize = new ImageSize(80, 50);
    App.getApplication().getImageLoader().loadImage(url, targetSize, options, new SimpleImageLoadingListener() {

        @Override
        public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
            imageView.setImageBitmap(loadedImage);
        }
    });
}
Also used : SimpleImageLoadingListener(com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener) Bitmap(android.graphics.Bitmap) ImageSize(com.nostra13.universalimageloader.core.assist.ImageSize) ImageView(android.widget.ImageView) View(android.view.View)

Example 4 with SimpleImageLoadingListener

use of com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener in project ForPDA by RadiationX.

the class PanelItemAdapter method onBindViewHolder.

@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);
    }
}
Also used : SimpleImageLoadingListener(com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener) Bitmap(android.graphics.Bitmap) ButtonData(forpdateam.ru.forpda.ui.views.messagepanel.advanced.ButtonData) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View)

Example 5 with SimpleImageLoadingListener

use of com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener in project ForPDA by RadiationX.

the class ImagesAdapter method loadImage.

private void loadImage(View imageLayout, int position) {
    assert imageLayout != null;
    CircularProgressView progressBar = (CircularProgressView) imageLayout.findViewById(R.id.progress_bar);
    PhotoView photoView = (PhotoView) imageLayout.findViewById(R.id.photo_view);
    if (crop)
        photoView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    if (clickListener != null)
        photoView.setOnClickListener(v -> clickListener.itemClick(v, position));
    imageLoader.displayImage(urls.get(position), photoView, options, new SimpleImageLoadingListener() {

        @Override
        public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
            progressBar.setVisibility(View.GONE);
        }

        @Override
        public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
            progressBar.setVisibility(View.GONE);
        // delayedHide(1000);
        }

        @Override
        public void onLoadingCancelled(String imageUri, View view) {
            progressBar.setVisibility(View.GONE);
        }

        @Override
        public void onLoadingStarted(String imageUri, View view) {
            progressBar.setVisibility(View.VISIBLE);
            if (progressBar.isIndeterminate()) {
                progressBar.setIndeterminate(false);
                progressBar.stopAnimation();
            }
        }
    }, (s, view, i, i1) -> progressBar.setProgress((int) (100F * i / i1)));
    photoView.setOnPhotoTapListener(tapListener);
}
Also used : PhotoView(com.github.chrisbanes.photoview.PhotoView) CircularProgressView(com.github.rahatarmanahmed.cpv.CircularProgressView) Context(android.content.Context) LayoutInflater(android.view.LayoutInflater) PhotoView(com.github.chrisbanes.photoview.PhotoView) ImageView(android.widget.ImageView) PagerAdapter(android.support.v4.view.PagerAdapter) ImageLoader(com.nostra13.universalimageloader.core.ImageLoader) DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions) ViewGroup(android.view.ViewGroup) List(java.util.List) Bitmap(android.graphics.Bitmap) OnPhotoTapListener(com.github.chrisbanes.photoview.OnPhotoTapListener) SimpleImageLoadingListener(com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener) View(android.view.View) App(forpdateam.ru.forpda.App) FailReason(com.nostra13.universalimageloader.core.assist.FailReason) R(forpdateam.ru.forpda.R) Log(android.util.Log) SimpleImageLoadingListener(com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener) Bitmap(android.graphics.Bitmap) CircularProgressView(com.github.rahatarmanahmed.cpv.CircularProgressView) FailReason(com.nostra13.universalimageloader.core.assist.FailReason) CircularProgressView(com.github.rahatarmanahmed.cpv.CircularProgressView) PhotoView(com.github.chrisbanes.photoview.PhotoView) ImageView(android.widget.ImageView) View(android.view.View)

Aggregations

View (android.view.View)23 Bitmap (android.graphics.Bitmap)22 SimpleImageLoadingListener (com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener)22 TextView (android.widget.TextView)15 ImageView (android.widget.ImageView)14 FailReason (com.nostra13.universalimageloader.core.assist.FailReason)11 DisplayImageOptions (com.nostra13.universalimageloader.core.DisplayImageOptions)8 RecyclerView (android.support.v7.widget.RecyclerView)4 Palette (androidx.palette.graphics.Palette)4 RecyclerView (androidx.recyclerview.widget.RecyclerView)4 Handler (android.os.Handler)3 ViewGroup (android.view.ViewGroup)3 CircularProgressView (com.github.rahatarmanahmed.cpv.CircularProgressView)3 ImageSize (com.nostra13.universalimageloader.core.assist.ImageSize)3 PagerAdapter (android.support.v4.view.PagerAdapter)2 OnClickListener (android.view.View.OnClickListener)2 ArtistInfoListener (com.naman14.timber.lastfmapi.callbacks.ArtistInfoListener)2 Album (com.naman14.timber.models.Album)2 List (java.util.List)2 Context (android.content.Context)1