|
|
@@ -67,12 +67,12 @@ public class CustomIndicator extends View {
|
|
|
mPaint.setStrokeCap(Paint.Cap.ROUND);
|
|
|
mPaint.setStrokeWidth(mIndicatorStrokeWidth);
|
|
|
mPaint.setStyle(Paint.Style.FILL);
|
|
|
- invalidate();
|
|
|
+ this.invalidate();
|
|
|
}
|
|
|
|
|
|
public void onChangedIndex(int firstVisibleItemPosition) {
|
|
|
this.activePosition = firstVisibleItemPosition;
|
|
|
- invalidate();
|
|
|
+ this.invalidate();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -80,6 +80,7 @@ public class CustomIndicator extends View {
|
|
|
if (null == recyclerView || null == recyclerView.getAdapter()) {
|
|
|
return;
|
|
|
}
|
|
|
+ Log.e("APP# CustomIndicator | onDraw", "|");
|
|
|
|
|
|
itemCount = recyclerView.getAdapter().getItemCount();
|
|
|
totalLength = mIndicatorItemLength * itemCount;
|
|
|
@@ -88,7 +89,6 @@ public class CustomIndicator extends View {
|
|
|
indicatorStartX = (recyclerView.getWidth() - indicatorTotalWidth) / 2F; //중앙
|
|
|
float indicatorPosY = getHeight() - mIndicatorHeight / 2F;
|
|
|
|
|
|
-
|
|
|
drawInactiveIndicators(canvas, indicatorStartX, indicatorPosY, itemCount);
|
|
|
if (activePosition == RecyclerView.NO_POSITION) {
|
|
|
return;
|
|
|
@@ -133,6 +133,7 @@ public class CustomIndicator extends View {
|
|
|
}
|
|
|
else if ((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_UP) {
|
|
|
float itemWidth = mIndicatorItemLength + mIndicatorItemPadding;
|
|
|
+ Log.e("APP# CustomIndicator | onTouchEvent", "|" + itemWidth + " , " + indicatorStartX); //48, 516 (index 1) // 48 , 0
|
|
|
int index = (int) Math.floor((event.getX() - indicatorStartX) / itemWidth); //인디케이터 안에서 찍힌 x 좌표
|
|
|
Log.e("APP# CustomIndicator | onTouchEvent", "index |" + index);
|
|
|
if (index >= 0 && index < itemCount) {
|