Search in sources :

Example 21 with DashPathEffect

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();
}
Also used : TypedArray(android.content.res.TypedArray) DashPathEffect(android.graphics.DashPathEffect) Paint(android.graphics.Paint)

Example 22 with DashPathEffect

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();
}
Also used : DashPathEffect(android.graphics.DashPathEffect) Paint(android.graphics.Paint) Paint(android.graphics.Paint)

Example 23 with DashPathEffect

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();
}
Also used : DashPathEffect(android.graphics.DashPathEffect) Paint(android.graphics.Paint)

Example 24 with DashPathEffect

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);
}
Also used : Path(android.graphics.Path) DashPathEffect(android.graphics.DashPathEffect) Paint(android.graphics.Paint)

Example 25 with DashPathEffect

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();
}
Also used : DashPathEffect(android.graphics.DashPathEffect)

Aggregations

DashPathEffect (android.graphics.DashPathEffect)45 Paint (android.graphics.Paint)34 Path (android.graphics.Path)7 PathEffect (android.graphics.PathEffect)7 Animation (com.db.chart.animation.Animation)4 LineSet (com.db.chart.model.LineSet)3 Cap (android.graphics.Paint.Cap)2 Join (android.graphics.Paint.Join)2 Style (android.graphics.Paint.Style)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 View (android.view.View)2 BarSet (com.db.chart.model.BarSet)2 Point (com.db.chart.model.Point)2 ArrayList (java.util.ArrayList)2 BasicStroke (org.achartengine.renderer.BasicStroke)2 SuppressLint (android.annotation.SuppressLint)1 TypedArray (android.content.res.TypedArray)1 LinearGradient (android.graphics.LinearGradient)1 Rect (android.graphics.Rect)1 Shader (android.graphics.Shader)1