Skip to content

Commit f3aa9ad

Browse files
committed
bug fix for calling invalidate off the main thread. removed some logging in the draw command
1 parent 923fe87 commit f3aa9ad

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

spin/src/main/java/com/marksalpeter/spin/SpinView.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
/**
2020
* SpinView is a port of Spin.js to a native android view
21-
* TODO: document your custom view class.
21+
* Created by Mark Salpeter
2222
*/
2323
public class SpinView extends View {
2424

@@ -116,7 +116,7 @@ private void init(AttributeSet attrs, int defStyle) {
116116
return;
117117
}
118118
mFrame = (mFrame + 1) % Integer.MAX_VALUE;
119-
invalidate();
119+
postInvalidate();
120120
mAnimationHandler.postDelayed(this, 1000/sFPS);
121121
}
122122
});
@@ -148,7 +148,6 @@ private void init(AttributeSet attrs, int defStyle) {
148148
);
149149
}
150150
// draw the main color over top
151-
if (i == 0) Log.d(TAG, "onDraw: " + mFrame + " / " + sFPS + " * " + mSpeed + " = " + (((float)mFrame / sFPS) * mSpeed));
152151
mColorPaint.setAlpha(getLineOpacity(i, (((float)mFrame / sFPS) * mSpeed) % 1));
153152
canvas.drawRoundRect(
154153
mRadius * mScale,

0 commit comments

Comments
 (0)