@Override public void onDrawIndicator(Canvas canvas) { int height = mPageIndicator.getHeight(); for (int i = 0; i < mPageIndicator.getTotalPages(); i++) { if (i == mPageIndicator.getActualPosition() + 1) { int x = mConversionUtils.getPixelsFromDp(4) + mConversionUtils.getPixelsFromDp(16 * i); canvas.save(); canvas.rotate(90 * mPageIndicator.getPositionOffset(), x, height / 2); } else if (i == mPageIndicator.getActualPosition()) { int x = mConversionUtils.getPixelsFromDp(4) + mConversionUtils.getPixelsFromDp(16 * i); canvas.save(); canvas.rotate(90 + (90 * mPageIndicator.getPositionOffset()), x, height / 2); } else { canvas.save(); } int x = mConversionUtils.getPixelsFromDp(0) + mConversionUtils.getPixelsFromDp(16 * i); int twoDp = mConversionUtils.getPixelsFromDp(3); int sixDp = mConversionUtils.getPixelsFromDp(5); int heightDp = mConversionUtils.getPixelsFromDp(8); canvas.drawRect(x, twoDp, x + heightDp, sixDp, mPaint); canvas.restore(); } }
@Override public int getMeasuredWidth(int widthMeasuredSpec, int heightMeasuredSpec) { return mConversionUtils.getPixelsFromDp(8 * (mPageIndicator.getTotalPages() * 2 - 1)); }
@Override public int getMeasuredHeight(int widthMeasuredSpec, int heightMeasuredSpec) { return mConversionUtils.getPixelsFromDp(8f); }