android.graphics.ComposePathEffect#android.graphics.CornerPathEffect源码实例Demo

下面列出了android.graphics.ComposePathEffect#android.graphics.CornerPathEffect 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

BarcodeGraphicBase(GraphicOverlay overlay) {
  super(overlay);

  boxPaint = new Paint();
  boxPaint.setColor(ContextCompat.getColor(context, R.color.barcode_reticle_stroke));
  boxPaint.setStyle(Paint.Style.STROKE);
  boxPaint.setStrokeWidth(
      context.getResources().getDimensionPixelOffset(R.dimen.barcode_reticle_stroke_width));

  scrimPaint = new Paint();
  scrimPaint.setColor(ContextCompat.getColor(context, R.color.barcode_reticle_background));
  eraserPaint = new Paint();
  eraserPaint.setStrokeWidth(boxPaint.getStrokeWidth());
  eraserPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));

  boxCornerRadius =
      context.getResources().getDimensionPixelOffset(R.dimen.barcode_reticle_corner_radius);

  pathPaint = new Paint();
  pathPaint.setColor(Color.WHITE);
  pathPaint.setStyle(Paint.Style.STROKE);
  pathPaint.setStrokeWidth(boxPaint.getStrokeWidth());
  pathPaint.setPathEffect(new CornerPathEffect(boxCornerRadius));

  boxRect = PreferenceUtils.getBarcodeReticleBox(overlay);
}
 
源代码2 项目: NewFastFrame   文件: ViewPagerIndicator.java
public ViewPagerIndicator(Context context, AttributeSet attrs) {
    super(context, attrs);
    //获取可见的tab数量
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ViewPagerIndicator);
    mVisibleTabCount = a.getInt(R.styleable.ViewPagerIndicator_visibleTabCount, 3);
    tabSelectedColor = a.getColor(R.styleable.ViewPagerIndicator_tabSelectedColor, getResources().getColor(R.color.orange_red_300));
    spaceHeight = (int) a.getDimension(R.styleable.ViewPagerIndicator_spaceHeight, 2);
    tabNormalColor = a.getColor(R.styleable.ViewPagerIndicator_tabNormalColor, getResources().getColor(R.color.black_transparency_500));
    lineHeight = (int) a.getDimension(R.styleable.ViewPagerIndicator_lineHeight, 2);
    tabTextSize = (int) a.getDimension(R.styleable.ViewPagerIndicator_tabTextSize, 14);
    margin = (int) a.getDimension(R.styleable.ViewPagerIndicator_margin, 0);
    int lineColor = a.getColor(R.styleable.ViewPagerIndicator_lineColor, getResources().getColor(R.color.orange_500));
    if (mVisibleTabCount < 0) {
        mVisibleTabCount = 3;
    }
    a.recycle();
    mPath = new Path();
    //初始化画笔
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setColor(lineColor);
    mPaint.setStyle(Paint.Style.FILL);
    mPaint.setPathEffect(new CornerPathEffect(3));
    setOrientation(HORIZONTAL);
}
 
源代码3 项目: o2oa   文件: ViewPagerIndicator.java
public ViewPagerIndicator(Context context, AttributeSet attrs) {
    super(context, attrs);

    // 获得自定义属性,tab的数量
    TypedArray a = context.obtainStyledAttributes(attrs,
            R.styleable.ViewPagerIndicator);
    mTabVisibleCount = a.getInt(R.styleable.ViewPagerIndicator_showItem,
            COUNT_DEFAULT_TAB);
    if (mTabVisibleCount < 0)
        mTabVisibleCount = COUNT_DEFAULT_TAB;

    mTriangleColor = a.getColor(R.styleable.ViewPagerIndicator_triangleColor, COLOR_DEFAULT_TRIANGLE);
    if (mTriangleColor < 0) {
        mTriangleColor = COLOR_DEFAULT_TRIANGLE;
    }
    a.recycle();

    // 初始化画笔
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setColor(mTriangleColor);
    mPaint.setStyle(Style.FILL);
    mPaint.setPathEffect(new CornerPathEffect(3));

}
 
源代码4 项目: CurveView   文件: CurveView.java
private void init() {
        mCornerPathEffect = new CornerPathEffect(mCorner);

        mContentPaint = new Paint();
        mContentPaint.setStyle(Paint.Style.STROKE);
        mContentPaint.setColor(mContentColor);
        mContentPaint.setStrokeWidth(mStrokeWidth);
        mContentPaint.setPathEffect(mCornerPathEffect);

        mBackgroundPaint = new Paint();
//        mBackgroundPaint.setColor(mFillColor);

        mXAxisPaint = new TextPaint();
        mXAxisPaint.setColor(mAxisTextColor);
        mXAxisPaint.setTextSize(mAxisTextSize);

        mDotTextPaint = new TextPaint();
        mDotTextPaint.setColor(mDotTextColor);
        mDotTextPaint.setTextSize(mDotTextSize);

        mContentPath = new Path();
        //        mMaxVelocity = ViewConfiguration.get(getContext()).getScaledMaximumFlingVelocity();
        mMaxVelocity = 3000;
    }
 
源代码5 项目: ViewPagerHelper   文件: TabIndicator.java
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    mHeight = h;
    mWidth = w;
    mPath = new Path();
    int width = mWidth / mVisiableSize;
    if (mTabtyle == TabShapeType.TRI) {
        //画三角形
        mPaint.setPathEffect(new CornerPathEffect(2)); //使三角形更加圆润
        mPath.moveTo((width - mTabWidth) / 2, mHeight);
        mPath.lineTo((width + mTabWidth) / 2, mHeight);
        mPath.lineTo(width / 2, mHeight - mTabHeight);

    } else {
        mPath.close();
        //画条状
        mPath.moveTo((width - mTabWidth) / 2, mHeight);
        mPath.lineTo((width + mTabWidth) / 2, mHeight);
        mPath.lineTo((width + mTabWidth) / 2, mHeight - mTabHeight);
        mPath.lineTo((width - mTabWidth) / 2, mHeight - mTabHeight);
        mPath.close();
    }


}
 
源代码6 项目: OverWatchLoading   文件: OWLoadingView.java
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    viewHeight = getMeasuredHeight();
    viewWidth = getMeasuredWidth();
    if (viewWidth != 0 && viewHeight != 0) {
        center.x = viewWidth / 2f;
        center.y = viewHeight / 2f;
        float spaceRate = 1 / 100f;
        space = viewWidth <= viewHeight ? viewWidth * spaceRate : viewHeight * spaceRate;
        hexagonRadius = (float) ((viewWidth - 2 * space) / (3 * Math.sqrt(3)));
        initHexagonCenters();
        //圆角处理
        paint.setPathEffect(new CornerPathEffect(hexagonRadius * 0.1f));
        baseDataInited = true;
    }
}
 
源代码7 项目: pandroid   文件: ProgressWheel.java
/**
 * Set the properties of the paints we're using to
 * draw the progress wheel
 */
private void setupPaints() {
    if (roundStroke) {
        barPaint.setDither(true);
        barPaint.setStrokeCap(Paint.Cap.ROUND);
        barPaint.setPathEffect(new CornerPathEffect(10) );
    }

    barPaint.setColor(barColor);
    barPaint.setAntiAlias(true);
    barPaint.setStyle(Style.STROKE);
    barPaint.setStrokeWidth(barWidth);

    rimPaint.setColor(rimColor);
    rimPaint.setAntiAlias(true);
    rimPaint.setStyle(Style.STROKE);
    rimPaint.setStrokeWidth(rimWidth);
}
 
源代码8 项目: BackgroundView   文件: LeafView.java
private void init() {
    mPaint = new Paint();
    // 绘制贝塞尔曲线
    mPaint.setColor(mColor);
    mPaint.setStrokeWidth(8);
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);
    mPaint.setStyle(Paint.Style.FILL);
    mPaint.setTextSize(60);
    mPaint.setPathEffect(new CornerPathEffect(4));

    for (int i = 0; i < mData.length; i++) {
        mData[i] = new PointF();
    }
    for (int i = 0; i < mCtrl.length; i++) {
        mCtrl[i] = new PointF();
    }

}
 
源代码9 项目: BackgroundView   文件: MountainView.java
private void init() {
    mPaint = new Paint();
    // 绘制贝塞尔曲线
    mPaint.setColor(mColor);
    mPaint.setStrokeWidth(8);
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);
    mPaint.setStyle(Paint.Style.FILL);
    mPaint.setTextSize(60);
    mPaint.setPathEffect(new CornerPathEffect(4));

    for (int i = 0; i < mData.length; i++) {
        mData[i] = new PointF();
    }
    for (int i = 0; i < mCtrl.length; i++) {
        mCtrl[i] = new PointF();
    }


}
 
源代码10 项目: smart-farmer-android   文件: ViewPagerIndicator.java
public ViewPagerIndicator(Context context, AttributeSet attrs) {
    super(context, attrs);

    // 获得自定义属性,tab的数量
    TypedArray a = context.obtainStyledAttributes(attrs,
            R.styleable.ViewPagerIndicator);
    mTabVisibleCount = a.getInt(R.styleable.ViewPagerIndicator_item_count,
            COUNT_DEFAULT_TAB);
    if (mTabVisibleCount < 0)
        mTabVisibleCount = COUNT_DEFAULT_TAB;
    a.recycle();

    // 初始化画笔
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setColor(Color.parseColor("#ffffffff"));
    mPaint.setStyle(Style.FILL);
    mPaint.setPathEffect(new CornerPathEffect(3));

}
 
源代码11 项目: cidrawing   文件: SmoothStrokeMode.java
protected CiPaint assignPaint() {
    CiPaint paint = new CiPaint(drawingContext.getPaint());
    paint.setStyle(Paint.Style.STROKE);
    paint.setAntiAlias(true);
    paint.setStrokeJoin(Paint.Join.ROUND);
    paint.setStrokeCap(Paint.Cap.ROUND);
    if (smoothRadius > 0) {
        CornerPathEffect effect = new CornerPathEffect(smoothRadius);
        if (paint.getPathEffect() == null) {
            paint.setPathEffect(effect);
        } else {
            ComposePathEffect composeEffect = new ComposePathEffect(paint.getPathEffect(), effect);
            paint.setPathEffect(composeEffect);
        }
    }
    return paint;
}
 
public ViewPagerIndicator(Context context, AttributeSet attrs)
{
	super(context, attrs);

	// 获得自定义属性,tab的数量
	mTabVisibleCount = 2;
	if (mTabVisibleCount < 0)
		mTabVisibleCount = COUNT_DEFAULT_TAB;

	// 初始化画笔
	mPaint = new Paint();
	mPaint.setAntiAlias(true);
	mPaint.setColor(Color.parseColor("#ffff9a23"));
	mPaint.setColor(getContext().getResources().getColor(R.color.yellow));
	mPaint.setStyle(Style.FILL);
	mPaint.setPathEffect(new CornerPathEffect(3));

}
 
源代码13 项目: shaky-android   文件: Paper.java
public Paper(@NonNull Context context, @NonNull AttributeSet attrs) {
    super(context, attrs);

    // red brush for marking up bugs
    thinPaint.setColor(Color.RED);
    thinPaint.setAntiAlias(true);
    thinPaint.setStrokeWidth(THIN_STROKE_WIDTH);
    thinPaint.setStyle(Paint.Style.STROKE);
    thinPaint.setStrokeJoin(Paint.Join.ROUND);
    thinPaint.setPathEffect(new CornerPathEffect(PATH_SMOOTH));

    // white brush to white-out sensitive information
    thickPaint = new Paint(thinPaint);
    thickPaint.setStrokeWidth(THICK_STROKE_WIDTH);
    thickPaint.setColor(Color.WHITE);

    // set default drawing path
    currentBrush = thinPath;
}
 
源代码14 项目: zone-sdk   文件: SimpleDraw.java
private void initView() {
    mHolder = getHolder();
    mHolder.addCallback(this);
    setFocusable(true);
    setFocusableInTouchMode(true);
    this.setKeepScreenOn(true);
    mPath = new Path();
    mPaint = new Paint();
    mPaint.setColor(Color.RED);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeWidth(20);
    mPaint.setDither(true);
    mPaint.setAntiAlias(true);
    mPaint.setStrokeCap(Paint.Cap.ROUND);
    mPaint.setStrokeJoin(Paint.Join.ROUND);
    mPaint.setPathEffect(new CornerPathEffect(10)); 
    
}
 
public ViewPagerIndicator(Context context, AttributeSet attrs) {
    super(context, attrs);
    // 初始化画笔
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
    mPaint.setStyle(Style.FILL);
    mPaint.setPathEffect(new CornerPathEffect(3));

    mLinePaint = new Paint();
    mLinePaint.setAntiAlias(true);
    mLinePaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
    mLinePaint.setStyle(Style.FILL);
    mLinePaint.setStrokeWidth(10);

    mDividerLinePaint = new Paint();
    mDividerLinePaint.setAntiAlias(true);
    mDividerLinePaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
    mDividerLinePaint.setStyle(Style.FILL);
    mDividerLinePaint.setStrokeWidth(5);
}
 
public ViewPagerIndicator(Context context, AttributeSet attrs)
{
	super(context, attrs);

	// 获取可见Tab的数量
	TypedArray a = context.obtainStyledAttributes(attrs,
			R.styleable.ViewPagerIndicator);

	mTabVisibleCount = a.getInt(
			R.styleable.ViewPagerIndicator_visible_tab_count,
			COUNT_DEFAULT_TAB);
	if (mTabVisibleCount < 0)
	{
		mTabVisibleCount = COUNT_DEFAULT_TAB;
	}
	a.recycle();

	// 初始化画笔
	mPaint = new Paint();
	mPaint.setAntiAlias(true);
	mPaint.setColor(Color.parseColor("#ffffffff"));
	mPaint.setStyle(Style.FILL);
	mPaint.setPathEffect(new CornerPathEffect(3));

}
 
源代码17 项目: miappstore   文件: ViewPagerIndicator.java
public ViewPagerIndicator(Context context, AttributeSet attrs)
{
	super(context, attrs);

	// 获得自定义属性,tab的数量
	TypedArray a = context.obtainStyledAttributes(attrs,
			R.styleable.ViewPagerIndicator);
	mTabVisibleCount = a.getInt(R.styleable.ViewPagerIndicator_item_count,
			COUNT_DEFAULT_TAB);
	if (mTabVisibleCount < 0)
		mTabVisibleCount = COUNT_DEFAULT_TAB;
	a.recycle();

	// 初始化画笔
	mPaint = new Paint();
	mPaint.setAntiAlias(true);
	mPaint.setColor(Color.parseColor("#ffffffff"));
	mPaint.setStyle(Style.FILL);
	mPaint.setPathEffect(new CornerPathEffect(3));

}
 
源代码18 项目: codeexamples-android   文件: CustomButton.java
public CustomButton(Context context) {
	super(context);
	paint = new Paint(Paint.ANTI_ALIAS_FLAG);
	paint.setStyle(Style.FILL);
	paint.setColor(Color.BLACK);
	paint.setTextSize(40);

	fillPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
	fillPaint.setStyle(Style.FILL);
	fillPaint.setColor(Color.RED);
	CornerPathEffect effect = new CornerPathEffect(30);
	fillPaint.setPathEffect(effect);
	fillPaint.setStyle(Style.FILL_AND_STROKE);
	fillPaint.setShader(new LinearGradient(0F, 120, getWidth(),
			getHeight(), Color.CYAN, Color.RED, Shader.TileMode.CLAMP));

}
 
源代码19 项目: arcusandroid   文件: ActivityEventView.java
protected void init(Context context) {
    canvasHeight = 1;
    canvasWidth = 1;

    // TODO: Set font typeface
    textPaintBrush.setColor(WHITE);
    textPaintBrush.setAlpha(sixtyPercent);
    setTextHeightInSP(11);

    eventPaintBrush.setColor(WHITE);
    // If this has an opacity may need to change the +1 for width so these don't overlap
    eventPaintBrush.setStyle(Paint.Style.STROKE);

    borderAndLinePaintBrush.setStrokeWidth(2);
    borderAndLinePaintBrush.setColor(WHITE);
    borderAndLinePaintBrush.setDither(true);
    borderAndLinePaintBrush.setStyle(Paint.Style.STROKE);
    borderAndLinePaintBrush.setStrokeJoin(Paint.Join.ROUND);
    borderAndLinePaintBrush.setStrokeCap(Paint.Cap.ROUND);
    borderAndLinePaintBrush.setPathEffect(new CornerPathEffect(10));
    borderAndLinePaintBrush.setAntiAlias(true);
    borderRectangle = new RectF();
    halfSolidLineStroke = borderAndLinePaintBrush.getStrokeWidth() / 2;

    alphaPaintBrush.setColor(BLACK);
    alphaPaintBrush.setStrokeWidth(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, getResources().getDisplayMetrics()));
    alphaPaintBrush.setStyle(Paint.Style.FILL);

    setSuperscriptScaleFactor(.65f);
    setAxisSizeDP(15);
    setBucketSize(5f);

    setEndTime(System.currentTimeMillis());
    setShouldDrawBorder(true);
    setShouldDrawAxis(false);
    setBorderRadius(5);

    setUseAxisAlpha(false);
    setUseContentAlpha(false);
}
 
源代码20 项目: rn-range-slider   文件: RangeSlider.java
public void setLabelBorderRadius(float labelBorderRadius) {
    labelBorderRadius = dpToPx(labelBorderRadius);
    if (labelBorderRadius < 0) {
        labelBorderRadius = 0;
    }
    labelBorderPaint.setPathEffect(new CornerPathEffect(labelBorderRadius));
    labelPaint.setPathEffect(new CornerPathEffect(labelBorderRadius));
    ViewCompat.postInvalidateOnAnimation(this);
}
 
源代码21 项目: FimiX8-RE   文件: X8CustomChartView.java
private void initData(Context context) {
    refreshView(true);
    this.gestureDetector = new GestureDetector(context, this.onGestureListener);
    this.bitmapPaint = new Paint();
    this.paintCurve = new Paint();
    this.paintCurve.setStyle(Style.STROKE);
    this.paintCurve.setDither(true);
    this.paintCurve.setAntiAlias(true);
    this.paintCurve.setStrokeWidth(3.0f);
    this.paintCurve.setColor(context.getResources().getColor(R.color.x8_fc_all_setting_blue));
    this.paintCurve.setPathEffect(new CornerPathEffect(25.0f));
    this.backgroundBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.x8_img_exp_setting);
}
 
private void initOperator() {
    setWillNotDraw(false);
    mPaint = new Paint();
    mPaint.setColor(Color.BLUE);
    mPaint.setAlpha(255);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeCap(Paint.Cap.ROUND);
    mPaint.setStrokeWidth(DisplayUtils.dpToPixel(getContext(), 5));
    mPaint.setAntiAlias(true);
    mPaint.setPathEffect(new CornerPathEffect(DisplayUtils.dpToPixel(getContext(), 5)));

    mPath = new Path();
    updatePath(0);
}
 
源代码23 项目: GraphView   文件: GraphNodeContainerView.java
private void initPaint() {
    linePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    linePaint.setStrokeWidth(lineThickness);
    linePaint.setColor(lineColor);
    linePaint.setStyle(Paint.Style.STROKE);
    linePaint.setStrokeJoin(Paint.Join.ROUND);    // set the join to round you want
    linePaint.setPathEffect(new CornerPathEffect(10));   // set the path effect when they join.
}
 
源代码24 项目: VideoOS-Android-SDK   文件: ENPlayView.java
public ENPlayView(Context context, AttributeSet attrs) {
    super(context, attrs);

    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.play);
    int lineColor = ta.getColor(R.styleable.play_play_line_color, DEFAULT_LINE_COLOR);
    int bgLineColor = ta.getColor(R.styleable.play_play_bg_line_color, DEFAULT_BG_LINE_COLOR);
    int lineWidth = ta.getInteger(R.styleable.play_play_line_width, dp2px(DEFAULT_LINE_WIDTH));
    int bgLineWidth = ta.getInteger(R.styleable.play_play_bg_line_width, dp2px(DEFAULT_BG_LINE_WIDTH));
    ta.recycle();

    setLayerType(View.LAYER_TYPE_SOFTWARE, null);

    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeCap(Paint.Cap.ROUND);
    mPaint.setColor(lineColor);
    mPaint.setStrokeWidth(lineWidth);
    mPaint.setPathEffect(new CornerPathEffect(1));

    mBgPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mBgPaint.setStyle(Paint.Style.STROKE);
    mBgPaint.setStrokeCap(Paint.Cap.ROUND);
    mBgPaint.setColor(bgLineColor);
    mBgPaint.setStrokeWidth(bgLineWidth);

    mPath = new Path();
    mDstPath = new Path();
    mPathMeasure = new PathMeasure();

    mDuration = DEFAULT_DURATION;
}
 
源代码25 项目: VideoOS-Android-SDK   文件: ENPlayView.java
public ENPlayView(Context context, AttributeSet attrs) {
    super(context, attrs);

    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.play);
    int lineColor = ta.getColor(R.styleable.play_play_line_color, DEFAULT_LINE_COLOR);
    int bgLineColor = ta.getColor(R.styleable.play_play_bg_line_color, DEFAULT_BG_LINE_COLOR);
    int lineWidth = ta.getInteger(R.styleable.play_play_line_width, dp2px(DEFAULT_LINE_WIDTH));
    int bgLineWidth = ta.getInteger(R.styleable.play_play_bg_line_width, dp2px(DEFAULT_BG_LINE_WIDTH));
    ta.recycle();

    setLayerType(View.LAYER_TYPE_SOFTWARE, null);

    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeCap(Paint.Cap.ROUND);
    mPaint.setColor(lineColor);
    mPaint.setStrokeWidth(lineWidth);
    mPaint.setPathEffect(new CornerPathEffect(1));

    mBgPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mBgPaint.setStyle(Paint.Style.STROKE);
    mBgPaint.setStrokeCap(Paint.Cap.ROUND);
    mBgPaint.setColor(bgLineColor);
    mBgPaint.setStrokeWidth(bgLineWidth);

    mPath = new Path();
    mDstPath = new Path();
    mPathMeasure = new PathMeasure();

    mDuration = DEFAULT_DURATION;
}
 
源代码26 项目: LaunchEnr   文件: PopupContainerWithArrow.java
/**
 * Adds an arrow view pointing at the original icon.
 * @param horizontalOffset the horizontal offset of the arrow, so that it
 *                              points at the center of the original icon
 */
private View addArrowView(int horizontalOffset, int verticalOffset, int width, int height) {
    LayoutParams layoutParams = new LayoutParams(width, height);
    if (mIsLeftAligned) {
        layoutParams.gravity = Gravity.START;
        layoutParams.leftMargin = horizontalOffset;
    } else {
        layoutParams.gravity = Gravity.END;
        layoutParams.rightMargin = horizontalOffset;
    }
    if (mIsAboveIcon) {
        layoutParams.topMargin = verticalOffset;
    } else {
        layoutParams.bottomMargin = verticalOffset;
    }

    View arrowView = new View(getContext());
    if (Gravity.isVertical(((FrameLayout.LayoutParams) getLayoutParams()).gravity)) {
        // This is only true if there wasn't room for the container next to the icon,
        // so we centered it instead. In that case we don't want to show the arrow.
        arrowView.setVisibility(INVISIBLE);
    } else {
        ShapeDrawable arrowDrawable = new ShapeDrawable(TriangleShape.create(
                width, height, !mIsAboveIcon));
        Paint arrowPaint = arrowDrawable.getPaint();
        // Note that we have to use getChildAt() instead of getItemViewAt(),
        // since the latter expects the arrow which hasn't been added yet.
        PopupItemView itemAttachedToArrow = (PopupItemView)
                (getChildAt(mIsAboveIcon ? getChildCount() - 1 : 0));
        arrowPaint.setColor(itemAttachedToArrow.getArrowColor(mIsAboveIcon));
        // The corner path effect won't be reflected in the shadow, but shouldn't be noticeable.
        int radius = getResources().getDimensionPixelSize(R.dimen.popup_arrow_corner_radius);
        arrowPaint.setPathEffect(new CornerPathEffect(radius));
        arrowView.setBackground(arrowDrawable);
        arrowView.setElevation(getElevation());
    }
    addView(arrowView, mIsAboveIcon ? getChildCount() : 0, layoutParams);
    return arrowView;
}
 
源代码27 项目: BubbleAlert   文件: AlertDrawable.java
public AlertDrawable(int outerCircleRadiusDP, int textSizeSP, int cornerArc, String drawText, Context context) {
    mContext = context;

    circleRadius = ScreenUtils.unitToPixels(context, TypedValue.COMPLEX_UNIT_DIP, outerCircleRadiusDP);
    textSize = ScreenUtils.unitToPixels(context, TypedValue.COMPLEX_UNIT_SP, textSizeSP);
    mDrawText = TextUtils.isEmpty(drawText) ? " " : drawText;
    initBitmap(mDrawText);
    mBackGroundPaint = new Paint();
    mBackGroundPaint.setAntiAlias(true);
    mBackGroundPaint.setDither(true);
    mBackGroundPaint.setColor(Color.WHITE);
    mBackGroundPaint.setStyle(Paint.Style.FILL);


    mCircleFillPaint = new Paint();
    mCircleFillPaint.setAntiAlias(true);
    mCircleFillPaint.setDither(true);
    mCircleFillPaint.setColor(ContextCompat.getColor(context, R.color.colorMultiArc));
    mCircleFillPaint.setStyle(Paint.Style.FILL);

    mOuterCircleFillPaint = new Paint();
    mOuterCircleFillPaint.setAntiAlias(true);
    mOuterCircleFillPaint.setDither(true);
    mOuterCircleFillPaint.setColor(Color.WHITE);
    mOuterCircleFillPaint.setStyle(Paint.Style.FILL);
    mOuterCircleFillPaint.setTextSize(textSize);


    borderPath = new Path();
    borderRect = new Rect();

    CornerPathEffect cornerPathEffect = new CornerPathEffect(cornerArc);
    mBackGroundPaint.setPathEffect(cornerPathEffect);

    outerCircleOffset = context.getResources().getInteger(R.integer.outerCircleOffset);
}
 
源代码28 项目: Oblique   文件: ObliqueView.java
private void init(Context context, AttributeSet attrs) {
    config = new Config(context, attrs);
    paint = new Paint(ANTI_ALIAS_FLAG);
    paint.setPathEffect(new CornerPathEffect(config.getRadius()));
    pdMode = new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER);
    //Log.e("logs","init");
}
 
源代码29 项目: similarLoadingView   文件: SimilarLoadingView.java
private void initPaint() {
    paint.setAlpha(0);
    paint.setPathEffect(new CornerPathEffect(cornerRadius));
    paint.setColor(color);
    paint.setStyle(Paint.Style.FILL);
    paint.setAntiAlias(true);
}
 
源代码30 项目: Vorolay   文件: VoronoiView.java
private void initPaint() {
    p = new Paint();
    p.setAntiAlias(true);
    p.setColor(mBorderColor);
    p.setStrokeWidth(mBorderWidth);
    p.setStyle(Paint.Style.STROKE);

    if (mRoundCornersEnabled) {
        p.setStrokeJoin(Paint.Join.ROUND);
        p.setStrokeCap(Paint.Cap.SQUARE);
        p.setPathEffect(new CornerPathEffect(15));
    }
}