use of android.graphics.DashPathEffect in project LshUtils by SenhLinsh.
the class DashedLine method initAttr.
private void initAttr(AttributeSet attrs) {
TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.DashedLine);
mDashColor = typedArray.getColor(R.styleable.DashedLine_dashColor, Color.TRANSPARENT);
mOrientation = typedArray.getInt(R.styleable.DashedLine_dashOrientation, 0);
int mDashGap = typedArray.getDimensionPixelSize(R.styleable.DashedLine_dashGap, 0);
int mDashWidth = typedArray.getDimensionPixelSize(R.styleable.DashedLine_dashWidth, 1);
mDashPathEffect = new DashPathEffect(new float[] { mDashWidth, mDashGap }, 0);
typedArray.recycle();
}
use of android.graphics.DashPathEffect in project android_frameworks_base by crdroidandroid.
the class GradientDrawable method updateLocalState.
private void updateLocalState(Resources res) {
final GradientState state = mGradientState;
if (state.mSolidColors != null) {
final int[] currentState = getState();
final int stateColor = state.mSolidColors.getColorForState(currentState, 0);
mFillPaint.setColor(stateColor);
} else if (state.mGradientColors == null) {
// If we don't have a solid color and we don't have a gradient,
// the app is stroking the shape, set the color to the default
// value of state.mSolidColor
mFillPaint.setColor(0);
} else {
// Otherwise, make sure the fill alpha is maxed out.
mFillPaint.setColor(Color.BLACK);
}
mPadding = state.mPadding;
if (state.mStrokeWidth >= 0) {
mStrokePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mStrokePaint.setStyle(Paint.Style.STROKE);
mStrokePaint.setStrokeWidth(state.mStrokeWidth);
if (state.mStrokeColors != null) {
final int[] currentState = getState();
final int strokeStateColor = state.mStrokeColors.getColorForState(currentState, 0);
mStrokePaint.setColor(strokeStateColor);
}
if (state.mStrokeDashWidth != 0.0f) {
final DashPathEffect e = new DashPathEffect(new float[] { state.mStrokeDashWidth, state.mStrokeDashGap }, 0);
mStrokePaint.setPathEffect(e);
}
}
mTintFilter = updateTintFilter(mTintFilter, state.mTint, state.mTintMode);
mGradientIsDirty = true;
state.computeOpacity();
}
use of android.graphics.DashPathEffect in project android_frameworks_base by crdroidandroid.
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 HorizontalStepsViewIndicator method init.
/**
* init
*/
private void init() {
mStepBeanList = new ArrayList<>();
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);
}
use of android.graphics.DashPathEffect in project UltimateAndroid by cymcsg.
the class SearchDrawable method setPhase.
public void setPhase(float phase) {
mPhase = phase;
float len = pm.getLength();
DashPathEffect effect = new DashPathEffect(new float[] { len, len }, -phase * len);
mPaint.setPathEffect(effect);
createEditorPath(phase);
invalidateSelf();
}
Aggregations