Search in sources :

Example 16 with DashPathEffect

use of android.graphics.DashPathEffect in project RecyclerView-FlexibleDivider by yqritc.

the class PaintActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sample);
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.main_recyclerview);
    // https://code.google.com/p/android/issues/detail?id=29944
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        recyclerView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    SimpleAdapter adapter = new SimpleAdapter(this);
    LinearLayoutManager manager = new LinearLayoutManager(this);
    manager.setOrientation(OrientationHelper.VERTICAL);
    recyclerView.setLayoutManager(manager);
    recyclerView.setAdapter(adapter);
    Paint paint = new Paint();
    paint.setStrokeWidth(5);
    paint.setColor(Color.BLUE);
    paint.setAntiAlias(true);
    paint.setPathEffect(new DashPathEffect(new float[] { 25.0f, 25.0f }, 0));
    recyclerView.addItemDecoration(new HorizontalDividerItemDecoration.Builder(this).paint(paint).showLastDivider().build());
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) DashPathEffect(android.graphics.DashPathEffect) Paint(android.graphics.Paint) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 17 with DashPathEffect

use of android.graphics.DashPathEffect in project android_frameworks_base by DirtyUnicorns.

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 18 with DashPathEffect

use of android.graphics.DashPathEffect in project android_frameworks_base by AOSPA.

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 19 with DashPathEffect

use of android.graphics.DashPathEffect in project android_frameworks_base by AOSPA.

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 20 with DashPathEffect

use of android.graphics.DashPathEffect in project android_frameworks_base by ResurrectionRemix.

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)

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