0

I'm currently loading various url images into an imageview. Some are type svg and the rest are png. I would like a progress bar in each imageview until the image has loaded. I can do this fine with png images using Glide, but I can't seem to find a way using SvgLoader. Here is my code:

if(homeImageType.equals("svg")){
                SvgLoader.pluck()
                        .with(mActivity)
                        .load(mData.get(i).getHomeTeamBadge(), myViewHolder.homeTeamBadge);

                myViewHolder.progressHomeBadge.setVisibility(View.GONE);

}
else {
                Glide
                        .with(mContext)
                        .load(mData.get(i).getHomeTeamBadge())
                        .listener(new RequestListener<String, GlideDrawable>() {
                            @Override
                            public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
                                return false;
                            }

                            @Override
                            public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
                                myViewHolder.progressHomeBadge.setVisibility(View.GONE);
                                return false;
                            }
                        })
                        .into(myViewHolder.homeTeamBadge);
            }

The png images work perfectly, in that the progress bar remains right up to the point the image loads into view. The svg progress bar however has its visibility changed noticeably before the image loads as there doesn't appear to be any listeners that you can add to the SvgLoader. Any ideas? Thanks in advance.

1 Answers1

0

I've found a workaround with the help of DBragion's answer in

Animated loading image in picasso

The drawable xml can be inputted into the placeholder of both Glide and SvgLoader and works well. The animated progress bar is quite big however and fills the placeholder. I wonder if there is a way of making it smaller?