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 make a method getIamgeView for squareprogressbar? #34

Closed tosslife closed 9 years ago

tosslife commented 9 years ago

i want to use universal-image-loader to loading net picture ,and show progress。 squareprogressbar very nice,but only set local drawable and bitmap; can you get my idea?

mrwonderman commented 9 years ago

Hi @tosslife

Thank you very much for the feedback. I just looked at it in detail and I can give you two different solutions for the problem.

Workaround with the current version

I checked with the Android-Universal-Image-Loader library and there is actually a working example on the repository page. You could use the following code to set the loaded image to the SquareProgressBar:

final SquareProgressBar squareProgressBar = (SquareProgressBar) findViewById(R.id.sprogressbar);
squareProgressBar.setImage(R.drawable.panda);
squareProgressBar.setProgress(50.0);

ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.init(ImageLoaderConfiguration.createDefault(this));
imageLoader.loadImage("http://halcyon.ch/wp-content/uploads/2015/06/1.png", new SimpleImageLoadingListener() {
        @Override
        public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
            squareProgressBar.setImageBitmap(loadedImage);
        }
    });

So this works perfectly with the current code. But I also see your point, because it would be way easier if the SquareProgressBar could return the ImageView directly.

Getter on the SquareProgressBar (not yet implemented)

To use the one-line solution provided by the Android-Universal-Image-Loader library, you need the ImageView directly:

imageLoader.displayImage(imageUri, imageView);

To make this possible I will include a getter method on the SquareProgressBar class which returns the ImageView. This will be included in the 1.6.0 update which is going live next week.

Is this okay so far? I will push the change to the develop-branch and include it in the next version.

Thanks again Yannick

tosslife commented 9 years ago

@mrwonderman tanks very much!!! hope 1.6.0 ! other need control ImageView size ,big picture show not better.

1.6.0 1.6.0 ^^

mrwonderman commented 9 years ago

@tosslife yes, I noticed the problems about big images as well. I found a solution for it earlier this week and just pushed the change to the develop branch (https://github.com/mrwonderman/android-square-progressbar/commit/513b45be1be885c16bbfbcb201c6a787a248899d). So this should be fixed with 1.6.0 too. I will close this issue as soon as the version 1.6.0 published.

mrwonderman commented 9 years ago

@tosslife

version 1.6.0 is available now and with it the new getter for the ImageView halcyon.ch - squareprogressbar v. 1.6.0. Thank you very much for your feedback. I will close this issue for now.