Page 1181 - 3-3
P. 1181
fanctrl.startAnimation(rotate);
} else if (count1 == 2) {
fan.setBackgroundResource(R.drawable.fan_op);
angle = r.nextInt() + 360;
RotateAnimation rotate = new RotateAnimation(0, angle,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5F);
rotate.setFillAfter(true);
rotate.setRepeatCount(Animation.INFINITE);
rotate.setRepeatMode(Animation.RESTART);
rotate.setDuration(1000);
rotate.setInterpolator(new AccelerateDecelerateInterpolator());
fanctrl.startAnimation(rotate);
} else if (count1 == 3) {
fan.setBackgroundResource(R.drawable.fan_op);
angle = r.nextInt() + 360;
RotateAnimation rotate = new RotateAnimation(0, angle,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5F);
rotate.setRepeatCount(Animation.INFINITE);
rotate.setRepeatMode(Animation.RESTART);
rotate.setFillAfter(true);
rotate.setDuration(1000);
rotate.setInterpolator(new AccelerateDecelerateInterpolator());
fanctrl.startAnimation(rotate);
} else if (count1 == 4) {
fan.setBackgroundResource(R.drawable.fan_op);
angle = r.nextInt() + 360;
RotateAnimation rotate = new RotateAnimation(0, angle,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5F);
rotate.setRepeatCount(Animation.INFINITE);
rotate.setRepeatMode(Animation.RESTART);
rotate.setFillAfter(true);
rotate.setDuration(1000);
rotate.setInterpolator(new AccelerateDecelerateInterpolator());
fanctrl.startAnimation(rotate);
} else if (count1 == 5) {
count1 = 0;
}
fanlevel.setText("" + count1);
}
});
fanstop.setOnClickListener(
new Button.OnClickListener() {
- 1181 -