mrwonderman / android-square-progressbar

An android library to display a progressbar that goes around an image.
http://halcyon.ch/android-square-progressbar-v-1-6-0/
1.28k stars 285 forks source link

can I implement this fancy progress bar in pull-to-refresh-listview #22

Closed Logan676 closed 9 years ago

Logan676 commented 9 years ago

I have a listview showing a list of files, when use click download all files, I want to use this progressbar to show downloading progress, is it possible for that?

mrwonderman commented 9 years ago

Hi, yes this is possible. Check out this page in the wiki: https://github.com/mrwonderman/android-square-progressbar/wiki/Usage. If you need some help, you can post the code here or you can send me an email (yannick@signer.pro). Cheers Yannick

Logan676 commented 9 years ago

Thanks for you reply. I want to show progressbar when loading icons, but the icon file type is not an primitive int type, it`s an drawable or bitmap. So how could I handle that. you can see the code segment below. Viewholder class

private class Viewholder {
        TextView title, subtitle;
        ImageView icon, action;
        SquareProgressBar squareProgressBar;

        public Viewholder(TextView title, TextView subtitle, ImageView icon, ImageView action) {
            super();
            this.icon = icon;
            this.action = action;
            this.title = title;
            this.subtitle = subtitle;
        }
    }

the code to start show progressbar Plz note that the viewHolder.icon is not compatible with the setImage method.

viewHolder.squareProgressBar.setImage(viewHolder.icon);
            // viewHolder.squareProgressBar.setProgress(percent);
mrwonderman commented 9 years ago

As you might saw, this was implemented with the 1.4.1 update. You can use setImageBitmap(Bitmap bitmap) method on the square progressbar to set a bitmap.