use of android.graphics.DashPathEffect in project platform_frameworks_base by android.
the class GradientDrawable method setStrokeInternal.
private void setStrokeInternal(int width, int color, float dashWidth, float dashGap) {
if (mStrokePaint == null) {
mStrokePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mStrokePaint.setStyle(Paint.Style.STROKE);
}
mStrokePaint.setStrokeWidth(width);
mStrokePaint.setColor(color);
DashPathEffect e = null;
if (dashWidth > 0) {
e = new DashPathEffect(new float[] { dashWidth, dashGap }, 0);
}
mStrokePaint.setPathEffect(e);
invalidateSelf();
}
use of android.graphics.DashPathEffect in project StepView by baoyachi.
the class VerticalStepViewIndicator method init.
/**
* init
*/
private void init() {
mPath = new Path();
mEffects = new DashPathEffect(new float[] { 8, 8, 8, 8 }, 1);
//初始化
mCircleCenterPointPositionList = new ArrayList<>();
mUnCompletedPaint = new Paint();
mCompletedPaint = new Paint();
mUnCompletedPaint.setAntiAlias(true);
mUnCompletedPaint.setColor(mUnCompletedLineColor);
mUnCompletedPaint.setStyle(Paint.Style.STROKE);
mUnCompletedPaint.setStrokeWidth(2);
mCompletedPaint.setAntiAlias(true);
mCompletedPaint.setColor(mCompletedLineColor);
mCompletedPaint.setStyle(Paint.Style.STROKE);
mCompletedPaint.setStrokeWidth(2);
mUnCompletedPaint.setPathEffect(mEffects);
mCompletedPaint.setStyle(Paint.Style.FILL);
//已经完成线的宽高 set mCompletedLineHeight
mCompletedLineHeight = 0.05f * defaultStepIndicatorNum;
//圆的半径 set mCircleRadius
mCircleRadius = 0.28f * defaultStepIndicatorNum;
//线与线之间的间距 set mLinePadding
mLinePadding = 0.85f * defaultStepIndicatorNum;
//已经完成的icon
mCompleteIcon = ContextCompat.getDrawable(getContext(), R.drawable.complted);
//正在进行的icon
mAttentionIcon = ContextCompat.getDrawable(getContext(), R.drawable.attention);
//未完成的icon
mDefaultIcon = ContextCompat.getDrawable(getContext(), R.drawable.default_icon);
//default draw
mIsReverseDraw = true;
}
use of android.graphics.DashPathEffect in project discrollview by flavienlaurent.
the class DiscrollvablePathLayout method onDraw.
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
makeAndMeasurePath();
if (!isInEditMode()) {
// Apply the dash effect
float length = mPathMeasure.getLength();
PathEffect effect = new DashPathEffect(new float[] { length, length }, length * (1 - mRatio));
mPaint.setPathEffect(effect);
}
canvas.drawPath(mPath, mPaint);
}
use of android.graphics.DashPathEffect in project ListenerMusicPlayer by hefuyicoder.
the class LyricView method drawIndicator.
/**
* 绘制指示器
* @param canvas
* */
private void drawIndicator(Canvas canvas) {
mIndicatorPaint.setColor(mIndicatorColor);
mIndicatorPaint.setAlpha(128);
mIndicatorPaint.setStyle(Paint.Style.FILL);
canvas.drawText(measureCurrentTime(), getMeasuredWidth() - mTimerBound.width(), (getMeasuredHeight() + mTimerBound.height() - 6) * 0.5f, mIndicatorPaint);
Path path = new Path();
mIndicatorPaint.setStrokeWidth(2.0f);
mIndicatorPaint.setStyle(Paint.Style.STROKE);
mIndicatorPaint.setPathEffect(new DashPathEffect(new float[] { 20, 10 }, 0));
path.moveTo(mPlayable ? mBtnBound.right + 24 : 24, getMeasuredHeight() * 0.5f);
path.lineTo(getMeasuredWidth() - mTimerBound.width() - mTimerBound.width() - 36, getMeasuredHeight() * 0.5f);
canvas.drawPath(path, mIndicatorPaint);
}
use of android.graphics.DashPathEffect in project RecyclerView-FlexibleDivider by yqritc.
the class ComplexAdapter method dividerPaint.
@Override
public Paint dividerPaint(int position, RecyclerView parent) {
Paint paint = new Paint();
switch(position % 10) {
case 0:
paint.setColor(Color.RED);
paint.setStrokeWidth(30);
break;
case 1:
paint.setColor(Color.MAGENTA);
paint.setStrokeWidth(10);
break;
default:
if (position % 2 == 0) {
paint.setColor(Color.BLUE);
paint.setAntiAlias(true);
paint.setPathEffect(new DashPathEffect(new float[] { 25.0f, 25.0f }, 0));
} else {
paint.setColor(Color.GREEN);
}
paint.setStrokeWidth(2 + position);
break;
}
return paint;
}
Aggregations