views:

61

answers:

1

I want to rebuild (maybe I don't even have to) the nativ android progress indicator and show it as icon for a list item. I followed this example and endet up with a heavy performance eating animation, which also doesn't match the native spinner. The code has as "LinearInterpolator" which seems to cause those problems.

Now I made my own Interpolar and fulfilled one of my needs: It's quantizing the steps into 12.

However, I still have huge performance problems. The UiThread now doesnt let my background threads run, which are intended to download and parse data. Note the fact, that I am displaying several spinners in a list. I also tried to set the interpolator as class variable in my listAdapter. So, all listViews can take use of this Interpolator.

if(imageViewIcon != null) {
  RotateAnimation anim = new RotateAnimation(0f, 360f, 51f, 51f);
  anim.setInterpolator(new Interpolator() {

    @Override
    public float getInterpolation( float input ) {
      return (float) Math.floor((double)input*10)/12;
    }
  });
 // anim
  anim.setRepeatCount(Animation.INFINITE);
  anim.setDuration(1000);


  // Start animating the image
  imageViewSpinner.startAnimation(anim);


}

Update

Finally I found the ProgressBarWidget which does exactly the same as I do. However, it's still not very performant. (It's better though)

A: 

Use the widget "ProgressBar". The simplest version is that round spinner

OneWorld