This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// reset paint object and set color, style, alpha by step | |
private void resetPaint(int step) { | |
paint.reset(); | |
paint.setAntiAlias(true); | |
paint.setStyle(Paint.Style.FILL); | |
paint.setColor(color); | |
if (step < 3) { | |
paint.setAlpha((int) (255 - (step + frame) * (255 - ALPHA_FINAL) / 3)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// "positive" is increasing positively horizontally | |
private float[] getHorizontalCenter(int width, int height, boolean positive) { | |
float x = (width - 2 * radius) * (positive ? frame : 1 - frame) + radius; | |
float y = positive ? radius : height - radius; | |
return new float[] {x, y}; | |
} | |
// "negative" is increasing negatively vertically | |
private float[] getVerticalCenter(int width, int height, boolean negative) { | |
float x = negative ? width - radius : radius; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onDraw(Canvas canvas) { | |
super.onDraw(canvas); | |
int width = getWidth(); | |
int height = getHeight(); | |
// o ㅡㅡ o | |
// | |
// | |
// o o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void start() { | |
ValueAnimator animator = ValueAnimator.ofInt(0, 1); | |
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { | |
@Override | |
public void onAnimationUpdate(ValueAnimator animation) { | |
frame = animation.getAnimatedFraction(); | |
postInvalidate(); | |
} | |
}); | |
animator.setDuration(durationRotate); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void setRadius(int radius) { | |
this.radius = radius; | |
postInvalidate(); | |
} | |
public void setColor(int color) { | |
this.color = color; | |
postInvalidate(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onDraw(Canvas canvas) { | |
super.onDraw(canvas); | |
int width = getWidth(); | |
int height = getHeight(); | |
float size = (width > height ? height : width) - tileMargin * 2; | |
float tileSize = size / 3; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 참고로 안돌려보고 여기에서 대충 만든거라 컴파일 에러날 확률이 매우 높습니다. | |
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) { | |
super.getItemOffsets(outRect, view, parent, state) | |
outRect.setEmpty() | |
val position = parent.getChildAdapterPosition(view).takeIf { it != RecyclerView.NO_POSITION } ?: run { | |
return | |
} | |
val space = 20.dp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 참고로 안돌려보고 여기에서 대충 만든거라 컴파일 에러날 확률이 매우 높습니다. | |
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) { | |
super.getItemOffsets(outRect, view, parent, state) | |
outRect.setEmpty() | |
val position = parent.getChildAdapterPosition(view).takeIf { it != RecyclerView.NO_POSITION } ?: run { | |
return | |
} | |
val space = 20.dp |