I built a class (such as a class to make simple animations):
public class myAnimations {
private Animation animation;
private ImageView imageView;
public myAnimations(ImageView img) {
super();
this.imageView = img;
}
public void rotate(int duration, int repeat) {
animation = new RotateAnimation(0.0f, 360.0f,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
animation.setRepeatCount(repeat);
animation.setDuration(duration);
}
public void play() {
imageView.startAnimation(animation);
}
public void stop() {
animation.setRepeatCount(0);
}
}
and I just can use it in this way:
ImageView myImage = (ImageView) findViewById(R.id.my_image);
myAnimations animation = new myAnimations(myImage);
animation.rotate(1000, 10);
animation.play(); //from this way…
but if I wanted to be able to use it like this:
ImageView myImage = (ImageView) findViewById(R.id.my_image);
myAnimations animation = new myAnimations(myImage);
animation.rotate(1000, 10).play(); //…to this way
so I can call this double method (I don't know the name), how should I build my class?
PS please feel free to edit the title if you know the name of my what I need.