Java Code Examples for android.graphics.Paint#setStrokeCap()

The following examples show how to use android.graphics.Paint#setStrokeCap() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CircleCheckDrawable.java    From Genius-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes local dynamic properties from state. This should be called
 * after significant state changes, e.g. from the One True Constructor and
 * after inflating or applying a theme.
 *
 * @param tintStateList ColorStateList
 */
public CircleCheckDrawable(ColorStateList tintStateList) {
    super(tintStateList);

    mCirclePaint = new Paint(ANTI_ALIAS_FLAG);
    mCirclePaint.setStyle(Paint.Style.FILL);
    mCirclePaint.setAntiAlias(true);
    mCirclePaint.setDither(true);

    mRingPaint = new Paint();
    mRingPaint.setStyle(Paint.Style.STROKE);
    mRingPaint.setStrokeJoin(Paint.Join.ROUND);
    mRingPaint.setStrokeCap(Paint.Cap.ROUND);
    mRingPaint.setAntiAlias(true);
    mRingPaint.setDither(true);
    mRingPaint.setStrokeWidth(mBorderSize);

    onStateChange(getState());
    onStateChange(getColor(), mChecked, mChecked);
    initIntrinsic();
}
 
Example 2
Source File: PaintView.java    From djl-demo with Apache License 2.0 6 votes vote down vote up
public PaintView(Context context, AttributeSet attrs) {
    super(context, attrs);
    factory = ImageFactory.getInstance();
    paint = new Paint();
    paint.setAntiAlias(true);
    paint.setDither(true);
    paint.setColor(DEFAULT_PAINT_COLOR);
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeJoin(Paint.Join.ROUND);
    paint.setStrokeCap(Paint.Cap.ROUND);
    paint.setAlpha(0xff);
    textSize = context.getResources().getDimensionPixelSize(R.dimen.text_size);
    textPaint = new Paint();
    textPaint.setColor(Color.WHITE);
    textPaint.setAntiAlias(true);
    textPaint.setTextSize(textSize);
}
 
Example 3
Source File: SnowflakesEffect.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
public SnowflakesEffect() {
    particlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    particlePaint.setStrokeWidth(AndroidUtilities.dp(1.5f));
    particlePaint.setStrokeCap(Paint.Cap.ROUND);
    particlePaint.setStyle(Paint.Style.STROKE);

    particleThinPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    particleThinPaint.setStrokeWidth(AndroidUtilities.dp(0.5f));
    particleThinPaint.setStrokeCap(Paint.Cap.ROUND);
    particleThinPaint.setStyle(Paint.Style.STROKE);

    updateColors();

    for (int a = 0; a < 20; a++) {
        freeParticles.add(new Particle());
    }
}
 
Example 4
Source File: DLetter.java    From ReadMark with Apache License 2.0 6 votes vote down vote up
@Override
protected void initConfig(int x, int y) {
    mPaint = new Paint();
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeWidth(mStrokeWidth);
    mPaint.setAntiAlias(true);
    mPaint.setColor(Config.WHITE);
    mPaint.setStrokeCap(Paint.Cap.SQUARE);

    mRectF = new RectF(x - MAX_RADIUS_CIRCLE
            , y - MAX_RADIUS_CIRCLE
            , x + MAX_RADIUS_CIRCLE
            , y + MAX_RADIUS_CIRCLE);
    mFirPoint = new Point(x + MAX_RADIUS_CIRCLE, y - 2 * MAX_RADIUS_CIRCLE);
    mSecPoint = new Point(mFirPoint);
}
 
Example 5
Source File: SnowflakesEffect.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public SnowflakesEffect() {
    particlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    particlePaint.setStrokeWidth(AndroidUtilities.dp(1.5f));
    particlePaint.setColor(Theme.getColor(Theme.key_actionBarDefaultTitle) & 0xffe6e6e6);
    particlePaint.setStrokeCap(Paint.Cap.ROUND);
    particlePaint.setStyle(Paint.Style.STROKE);

    particleThinPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    particleThinPaint.setStrokeWidth(AndroidUtilities.dp(0.5f));
    particleThinPaint.setColor(Theme.getColor(Theme.key_actionBarDefaultTitle) & 0xffe6e6e6);
    particleThinPaint.setStrokeCap(Paint.Cap.ROUND);
    particleThinPaint.setStyle(Paint.Style.STROKE);

    for (int a = 0; a < 20; a++) {
        freeParticles.add(new Particle());
    }
}
 
Example 6
Source File: Maze.java    From Form-N-Fun with MIT License 6 votes vote down vote up
/**
 * display maze
 */

void display(Canvas c)
{
    Paint paint = new Paint();
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeJoin(Paint.Join.ROUND);
    paint.setStrokeCap(Paint.Cap.ROUND);
    paint.setColor(Color.RED);
    Path path = new Path();
    path.moveTo(rigidpoints.getPoints().get(0).x, rigidpoints.getPoints().get(0).y); //join lines
    for (int j = 1; j < rigidpoints.size(); j++)
    {
        path.lineTo(rigidpoints.getPoints().get(j).x, rigidpoints.getPoints().get(j).y);  //join lines
    }
    c.drawPath(path, paint);//draw points
}
 
Example 7
Source File: TheGlowingLoader.java    From TheGlowingLoader with Apache License 2.0 5 votes vote down vote up
private void init() {
    if (configuration == null) {
        configuration = new Configuration(getContext());
    }
    setWillNotDraw(false);
    rippleAnimator1 = new RippleAnimator(TheGlowingLoader.this, configuration);
    rippleAnimator2 = new RippleAnimator(TheGlowingLoader.this, configuration);
    lineAnimator = new LineAnimator(TheGlowingLoader.this, configuration);
    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setStrokeCap(Paint.Cap.ROUND);
}
 
Example 8
Source File: WebProgress.java    From WebProgress with Apache License 2.0 5 votes vote down vote up
private void init(Context context, AttributeSet attrs, int defStyleAttr) {
    mPaint = new Paint();
    mColor = Color.parseColor(WEB_PROGRESS_COLOR);
    mPaint.setAntiAlias(true);
    mPaint.setColor(mColor);
    mPaint.setDither(true);
    mPaint.setStrokeCap(Paint.Cap.SQUARE);

    mTargetWidth = context.getResources().getDisplayMetrics().widthPixels;
    mTargetHeight = dip2px(WEB_PROGRESS_DEFAULT_HEIGHT);
}
 
Example 9
Source File: TrackRenderer.java    From android_maplib with GNU Lesser General Public License v3.0 5 votes vote down vote up
public TrackRenderer(ILayer layer)
{
    super(layer);

    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeCap(Paint.Cap.ROUND);
}
 
Example 10
Source File: HorProBar.java    From WidgetCase with Apache License 2.0 5 votes vote down vote up
/**
 * 统一处理paint
 *
 * @param strokeWidth
 * @param color
 * @param style
 * @return
 */
private Paint getPaint(int strokeWidth, int color, Paint.Style style) {
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setStrokeWidth(strokeWidth);
    paint.setColor(color);
    paint.setAntiAlias(true);
    paint.setStrokeCap(Paint.Cap.ROUND);
    paint.setStyle(style);
    return paint;
}
 
Example 11
Source File: WheelView.java    From Prodigal with Apache License 2.0 5 votes vote down vote up
public WheelView(Context context, AttributeSet attrs) {
    super(context, attrs);
    center = new Point();
    paintIn = new Paint();
    paintOut = new Paint();
    ripplePaint = new Paint();
    paintIn.setStrokeCap(Paint.Cap.ROUND);
    paintOut.setAntiAlias(true);
    paintIn.setAntiAlias(true);

    buttonWidth = getResources().getDimensionPixelSize(R.dimen.button_width);
    buttonHeight = getResources().getDimensionPixelSize(R.dimen.button_height);
    this.setBackgroundColor(Color.TRANSPARENT);
}
 
Example 12
Source File: AnalogComplicationWatchFaceService.java    From wear-os-samples with Apache License 2.0 5 votes vote down vote up
private void initializeWatchFace() {

            mHourPaint = new Paint();
            mHourPaint.setColor(mWatchHandAndComplicationsColor);
            mHourPaint.setStrokeWidth(HOUR_STROKE_WIDTH);
            mHourPaint.setAntiAlias(true);
            mHourPaint.setStrokeCap(Paint.Cap.ROUND);
            mHourPaint.setShadowLayer(SHADOW_RADIUS, 0, 0, mWatchHandShadowColor);

            mMinutePaint = new Paint();
            mMinutePaint.setColor(mWatchHandAndComplicationsColor);
            mMinutePaint.setStrokeWidth(MINUTE_STROKE_WIDTH);
            mMinutePaint.setAntiAlias(true);
            mMinutePaint.setStrokeCap(Paint.Cap.ROUND);
            mMinutePaint.setShadowLayer(SHADOW_RADIUS, 0, 0, mWatchHandShadowColor);

            mSecondAndHighlightPaint = new Paint();
            mSecondAndHighlightPaint.setColor(mWatchHandHighlightColor);
            mSecondAndHighlightPaint.setStrokeWidth(SECOND_TICK_STROKE_WIDTH);
            mSecondAndHighlightPaint.setAntiAlias(true);
            mSecondAndHighlightPaint.setStrokeCap(Paint.Cap.ROUND);
            mSecondAndHighlightPaint.setShadowLayer(SHADOW_RADIUS, 0, 0, mWatchHandShadowColor);

            mTickAndCirclePaint = new Paint();
            mTickAndCirclePaint.setColor(mWatchHandAndComplicationsColor);
            mTickAndCirclePaint.setStrokeWidth(SECOND_TICK_STROKE_WIDTH);
            mTickAndCirclePaint.setAntiAlias(true);
            mTickAndCirclePaint.setStyle(Paint.Style.STROKE);
            mTickAndCirclePaint.setShadowLayer(SHADOW_RADIUS, 0, 0, mWatchHandShadowColor);
        }
 
Example 13
Source File: SignatureView.java    From SignatureView with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
public SignatureView(Context context, AttributeSet attrs) {
    super(context, attrs);
    this.context = context;
    this.setWillNotDraw(false);
    this.setDrawingCacheEnabled(true);

    TypedArray typedArray = context.getTheme().obtainStyledAttributes(
            attrs, R.styleable.signature, 0, 0);

    try {
        backgroundColor = typedArray.getColor(R.styleable.signature_backgroundColor,
                context.getResources().getColor(R.color.white));
        penColor = typedArray.getColor(R.styleable.signature_penColor,
                context.getResources().getColor(R.color.penRoyalBlue));
        penSize = typedArray.getDimension(R.styleable.signature_penSize,
                context.getResources().getDimension(R.dimen.pen_size));
        enableSignature = typedArray.getBoolean(R.styleable.signature_enableSignature, true);
    } finally {
        typedArray.recycle();
    }

    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setColor(penColor);
    paint.setAntiAlias(true);
    paint.setStyle(Paint.Style.FILL_AND_STROKE);
    paint.setStrokeJoin(Paint.Join.ROUND);
    paint.setStrokeCap(Paint.Cap.ROUND);
    paint.setStrokeWidth(penSize);

    paintBm = new Paint(Paint.ANTI_ALIAS_FLAG);
    paintBm.setAntiAlias(true);
    paintBm.setStyle(Paint.Style.STROKE);
    paintBm.setStrokeJoin(Paint.Join.ROUND);
    paintBm.setStrokeCap(Paint.Cap.ROUND);
    paintBm.setColor(Color.BLACK);
}
 
Example 14
Source File: ArcSeekBar.java    From arc-seekbar with Apache License 2.0 5 votes vote down vote up
private void initArcPaint() {
    mArcPaint = new Paint();
    mArcPaint.setAntiAlias(true);
    mArcPaint.setStrokeWidth(mArcWidth);
    mArcPaint.setStyle(Paint.Style.STROKE);
    mArcPaint.setStrokeCap(Paint.Cap.ROUND);
}
 
Example 15
Source File: CircularSeekBar.java    From CircularSeekBar with Apache License 2.0 4 votes vote down vote up
/**
 * Initializes the {@code Paint} objects with the appropriate styles.
 */
private void initPaints() {
    mCirclePaint = new Paint();
    mCirclePaint.setAntiAlias(true);
    mCirclePaint.setDither(true);
    mCirclePaint.setColor(mCircleColor);
    mCirclePaint.setStrokeWidth(mCircleStrokeWidth);
    mCirclePaint.setStyle(Paint.Style.STROKE);
    mCirclePaint.setStrokeJoin(Paint.Join.ROUND);
    mCirclePaint.setStrokeCap(mCircleStyle);

    mCircleFillPaint = new Paint();
    mCircleFillPaint.setAntiAlias(true);
    mCircleFillPaint.setDither(true);
    mCircleFillPaint.setColor(mCircleFillColor);
    mCircleFillPaint.setStyle(Paint.Style.FILL);

    mCircleProgressPaint = new Paint();
    mCircleProgressPaint.setAntiAlias(true);
    mCircleProgressPaint.setDither(true);
    mCircleProgressPaint.setColor(mCircleProgressColor);
    mCircleProgressPaint.setStrokeWidth(mCircleStrokeWidth);
    mCircleProgressPaint.setStyle(Paint.Style.STROKE);
    mCircleProgressPaint.setStrokeJoin(Paint.Join.ROUND);
    mCircleProgressPaint.setStrokeCap(mCircleStyle);

    if (!mDisableProgressGlow) {
        mCircleProgressGlowPaint = new Paint();
        mCircleProgressGlowPaint.set(mCircleProgressPaint);
        mCircleProgressGlowPaint.setMaskFilter(new BlurMaskFilter((PROGRESS_GLOW_RADIUS_DP * DPTOPX_SCALE), BlurMaskFilter.Blur.NORMAL));
    }

    mPointerPaint = new Paint();
    mPointerPaint.setAntiAlias(true);
    mPointerPaint.setDither(true);
    mPointerPaint.setColor(mPointerColor);
    mPointerPaint.setStrokeWidth(mPointerStrokeWidth);
    mPointerPaint.setStyle(Paint.Style.STROKE);
    mPointerPaint.setStrokeJoin(Paint.Join.ROUND);
    mPointerPaint.setStrokeCap(mCircleStyle);

    mPointerHaloPaint = new Paint();
    mPointerHaloPaint.set(mPointerPaint);
    mPointerHaloPaint.setColor(mPointerHaloColor);
    mPointerHaloPaint.setAlpha(mPointerAlpha);
    mPointerHaloPaint.setStrokeWidth(mPointerStrokeWidth + mPointerHaloWidth * 2f);

    mPointerHaloBorderPaint = new Paint();
    mPointerHaloBorderPaint.set(mPointerPaint);
    mPointerHaloBorderPaint.setStrokeWidth(mPointerHaloBorderWidth);
    mPointerHaloBorderPaint.setStyle(Paint.Style.STROKE);

}
 
Example 16
Source File: MoonPhaseView.java    From GeometricWeather with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void initPaint() {
    paint = new Paint();
    paint.setAntiAlias(true);
    paint.setStrokeCap(Paint.Cap.ROUND);
}
 
Example 17
Source File: FeaturedStickerSetCell.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public FeaturedStickerSetCell(Context context) {
    super(context);

    progressPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    progressPaint.setColor(Theme.getColor(Theme.key_featuredStickers_buttonProgress));
    progressPaint.setStrokeCap(Paint.Cap.ROUND);
    progressPaint.setStyle(Paint.Style.STROKE);
    progressPaint.setStrokeWidth(AndroidUtilities.dp(2));

    textView = new TextView(context);
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 100 : 71, 10, LocaleController.isRTL ? 71 : 100, 0));

    valueTextView = new TextView(context);
    valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setLines(1);
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setEllipsize(TextUtils.TruncateAt.END);
    valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 100 : 71, 35, LocaleController.isRTL ? 71 : 100, 0));

    imageView = new BackupImageView(context);
    imageView.setAspectFit(true);
    addView(imageView, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 12, 8, LocaleController.isRTL ? 12 : 0, 0));

    addButton = new TextView(context) {
        @Override
        protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
            if (drawProgress || !drawProgress && progressAlpha != 0) {
                progressPaint.setAlpha(Math.min(255, (int) (progressAlpha * 255)));
                int x = getMeasuredWidth() - AndroidUtilities.dp(11);
                progressRect.set(x, AndroidUtilities.dp(3), x + AndroidUtilities.dp(8), AndroidUtilities.dp(8 + 3));
                canvas.drawArc(progressRect, angle, 220, false, progressPaint);
                invalidate((int) progressRect.left - AndroidUtilities.dp(2), (int) progressRect.top - AndroidUtilities.dp(2), (int) progressRect.right + AndroidUtilities.dp(2), (int) progressRect.bottom + AndroidUtilities.dp(2));
                long newTime = System.currentTimeMillis();
                if (Math.abs(lastUpdateTime - System.currentTimeMillis()) < 1000) {
                    long delta = (newTime - lastUpdateTime);
                    float dt = 360 * delta / 2000.0f;
                    angle += dt;
                    angle -= 360 * (angle / 360);
                    if (drawProgress) {
                        if (progressAlpha < 1.0f) {
                            progressAlpha += delta / 200.0f;
                            if (progressAlpha > 1.0f) {
                                progressAlpha = 1.0f;
                            }
                        }
                    } else {
                        if (progressAlpha > 0.0f) {
                            progressAlpha -= delta / 200.0f;
                            if (progressAlpha < 0.0f) {
                                progressAlpha = 0.0f;
                            }
                        }
                    }
                }
                lastUpdateTime = newTime;
                invalidate();
            }
        }
    };
    addButton.setGravity(Gravity.CENTER);
    addButton.setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText));
    addButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    addButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    addButton.setBackgroundDrawable(Theme.createSimpleSelectorRoundRectDrawable(AndroidUtilities.dp(4), Theme.getColor(Theme.key_featuredStickers_addButton), Theme.getColor(Theme.key_featuredStickers_addButtonPressed)));
    addButton.setText(LocaleController.getString("Add", R.string.Add).toUpperCase());
    addButton.setPadding(AndroidUtilities.dp(17), 0, AndroidUtilities.dp(17), 0);
    addView(addButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 28, Gravity.TOP | (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT), LocaleController.isRTL ? 14 : 0, 18, LocaleController.isRTL ? 0 : 14, 0));

    checkImage = new ImageView(context);
    checkImage.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_featuredStickers_addedIcon), PorterDuff.Mode.MULTIPLY));
    checkImage.setImageResource(R.drawable.sticker_added);
    addView(checkImage, LayoutHelper.createFrame(19, 14));
}
 
Example 18
Source File: Clock.java    From Clock-view with Apache License 2.0 4 votes vote down vote up
private void drawDegrees(Canvas canvas) {

        if (!showDegrees)
            return;

        Paint paint = new Paint();
        paint.setAntiAlias(true);
        paint.setStyle(Paint.Style.FILL_AND_STROKE);
        paint.setStrokeCap(Paint.Cap.ROUND);
        paint.setStrokeWidth(size * DEFAULT_DEGREE_STROKE_WIDTH);
        paint.setColor(degreesColor);

        int rPadded = centerX - (int) (size * (DEFAULT_BORDER_THICKNESS + 0.03f));
        int rEnd = centerX - (int) (size * (DEFAULT_BORDER_THICKNESS + 0.06f));

        for (int i = 0; i < FULL_ANGLE; i = i + degreesStep.getId()) {

            if ((i % REGULAR_ANGLE) != 0 && (i % 15) != 0)
                paint.setAlpha(CUSTOM_ALPHA);
            else {
                paint.setAlpha(FULL_ALPHA);
            }

            int startX = (int) (centerX + rPadded * Math.cos(Math.toRadians(i)));
            int startY = (int) (centerX - rPadded * Math.sin(Math.toRadians(i)));

            int stopX = (int) (centerX + rEnd * Math.cos(Math.toRadians(i)));
            int stopY = (int) (centerX - rEnd * Math.sin(Math.toRadians(i)));

            switch (degreesType) {

                case circle:
                    canvas.drawCircle(stopX, stopY, size * DEFAULT_DEGREE_STROKE_WIDTH, paint);
                    break;

                case square:
                    canvas.drawRect(startX, startY, startX + (size * DEFAULT_DEGREE_STROKE_WIDTH), startY + (size * DEFAULT_DEGREE_STROKE_WIDTH), paint);
                    break;

                default:
                    canvas.drawLine(startX, startY, stopX, stopY, paint);
                    break;
            }
        }
    }
 
Example 19
Source File: RecordButton.java    From Fatigue-Detection with MIT License 4 votes vote down vote up
void init() {
    touchable=recordable=true;
    BOUNDING_BOX_SIZE = DisplayUtils.getRefLength(mContext,100.0F);
    OUT_CIRCLE_WIDTH = DisplayUtils.getRefLength(mContext,2.3F);
    OUTER_CIRCLE_WIDTH_INC=DisplayUtils.getRefLength(mContext,4.3F);
    INNER_CIRCLE_RADIUS = DisplayUtils.getRefLength(mContext,32.0F);
    colorRecord = getResources().getColor(R.color.app_color);
    colorWhite = getResources().getColor(R.color.white);
    colorWhiteP60 = getResources().getColor(R.color.white_sixty_percent);
    colorBlackP40 = getResources().getColor(R.color.black_forty_percent);
    colorBlackP80 = getResources().getColor(R.color.black_eighty_percent);
    colorTranslucent = getResources().getColor(R.color.circle_shallow_translucent_bg);
    processBarPaint = new Paint();
    processBarPaint.setColor(colorRecord);
    processBarPaint.setAntiAlias(true);
    processBarPaint.setStrokeWidth(OUT_CIRCLE_WIDTH);
    processBarPaint.setStyle(Style.STROKE);
    processBarPaint.setStrokeCap(Cap.ROUND);
    outMostWhiteCirclePaint = new Paint();
    outMostWhiteCirclePaint.setColor(colorWhite);
    outMostWhiteCirclePaint.setAntiAlias(true);
    outMostWhiteCirclePaint.setStrokeWidth(OUT_CIRCLE_WIDTH);
    outMostWhiteCirclePaint.setStyle(Style.STROKE);
    centerCirclePaint = new Paint();
    centerCirclePaint.setColor(colorWhiteP60);
    centerCirclePaint.setAntiAlias(true);
    centerCirclePaint.setStyle(Style.FILL_AND_STROKE);
    outBlackCirclePaint = new Paint();
    outBlackCirclePaint.setColor(colorBlackP40);
    outBlackCirclePaint.setAntiAlias(true);
    outBlackCirclePaint.setStyle(Style.STROKE);
    outBlackCirclePaint.setStrokeWidth(1.0F);
    outMostBlackCirclePaint = new Paint();
    outMostBlackCirclePaint.setColor(colorBlackP80);
    outMostBlackCirclePaint.setAntiAlias(true);
    outMostBlackCirclePaint.setStyle(Style.STROKE);
    outMostBlackCirclePaint.setStrokeWidth(1.0F);
    translucentPaint = new Paint();
    translucentPaint.setColor(colorTranslucent);
    translucentPaint.setAntiAlias(true);
    translucentPaint.setStyle(Style.FILL_AND_STROKE);
    centerX = (BOUNDING_BOX_SIZE / 2);
    centerY = (BOUNDING_BOX_SIZE / 2);
    outMostCircleRadius = DisplayUtils.getRefLength(mContext,37.0F);
    outBlackCircleRadiusInc = DisplayUtils.getRefLength(mContext,7.0F);
    innerCircleRadiusWhenRecord = DisplayUtils.getRefLength(mContext,35.0F);
    innerCircleRadiusToDraw = INNER_CIRCLE_RADIUS;
    outBlackCircleRadius = (outMostCircleRadius - OUT_CIRCLE_WIDTH / 2.0F);
    outMostBlackCircleRadius = (outMostCircleRadius + OUT_CIRCLE_WIDTH / 2.0F);
    startAngle270 = 270.0F;
    percentInDegree = 0.0F;
    outMostCircleRect = new RectF(centerX - outMostCircleRadius, centerY - outMostCircleRadius, centerX + outMostCircleRadius, centerY + outMostCircleRadius);
    touchTimeHandler = new TouchTimeHandler(Looper.getMainLooper(), updateUITask);
}
 
Example 20
Source File: Circle.java    From TheGlowingLoader with Apache License 2.0 4 votes vote down vote up
private void init() {
    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setStrokeCap(Paint.Cap.ROUND);
    paint.setStyle(Paint.Style.FILL);
}