Add the two classes to your project
Wheel myWheel = new Wheel();
Wheel myWheel = new Wheel(ImageView wheelImageView,
ImageView needleImageViewint,
int nbOfSlices
[int nbOfSpins, int animationDuration]);
-
wheelImageView : The ImageView from layout (only the circular part)
-
needleImageView : The ImageView that points to the needle view
-
nbOfSlices : The number of slices in your wheel (start count from 1)
-
nbOfSpins : How many rotations to animate before landing on the destinatino slice
-
animationDuration : In milli seconds the duration of the entire spin animation
Call the spinTo method and pass in the index (starting from 0)
myWheel.spinTo(int index)
When the animation ends a callback method can be called
- In your class implement WheelCallback interface
- Create a WheelCallback instance where you can write your code to execute after animation ends
- Set the callback instance you created by calling:
myWheel.setCallback(myCallback);
- setWheel (ImageView wheel)
- setNumberOfSlices (int number_of_slices)
- setGoToIndex (int go_to_index)
- setSpinFactor (int spin_factor) -- set the number of rotations for the animation
- setInterpolator (double a, double b, double c, double d) -- Create a pathinterpolator for the animation