Skip to content

Instantly share code, notes, and snippets.

@minhazmiraz
Created July 29, 2020 08:48
Show Gist options
  • Save minhazmiraz/7f559b7db99ecedada436c0cc1c39d00 to your computer and use it in GitHub Desktop.
Save minhazmiraz/7f559b7db99ecedada436c0cc1c39d00 to your computer and use it in GitHub Desktop.
public void onRefreshButtonClicked(final View view){
RotateAnimation rotate = new RotateAnimation(
0, 355,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f
);
rotate.setDuration(400);
rotate.setInterpolator(new LinearInterpolator());
rotate.setRepeatCount(300);
rotate.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
view.setEnabled(false);
}
@Override
public void onAnimationEnd(Animation animation) {
view.setEnabled(true);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
view.startAnimation(rotate);
}
@minhazmiraz
Copy link
Author

    <Button
        android:id="@+id/refreshbuttton"
        android:layout_width="32dp"
        android:layout_height="32dp"
        android:layout_marginStart="1.3dp"
        android:layout_marginTop="13.3dp"
        android:layout_marginEnd="1.3dp"
        android:layout_marginBottom="1.3dp"
        android:background="@android:drawable/ic_popup_sync"
        android:onClick="onRefreshButtonClicked" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment