Java Code Examples for android.graphics.Paint.setAlpha()

The following are Jave code examples for showing how to use setAlpha() of the android.graphics.Paint class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Tensorflow_Andriod_With_Audio_Output   File: BorderedText.java   View Source Code Vote up 6 votes
/**
 * Create a bordered text object with the specified interior and exterior colors, text size and
 * alignment.
 *
 * @param interiorColor the interior text color
 * @param exteriorColor the exterior text color
 * @param textSize text size in pixels
 */
public BorderedText(final int interiorColor, final int exteriorColor, final float textSize) {
  interiorPaint = new Paint();
  interiorPaint.setTextSize(textSize);
  interiorPaint.setColor(interiorColor);
  interiorPaint.setStyle(Style.FILL);
  interiorPaint.setAntiAlias(false);
  interiorPaint.setAlpha(255);

  exteriorPaint = new Paint();
  exteriorPaint.setTextSize(textSize);
  exteriorPaint.setColor(exteriorColor);
  exteriorPaint.setStyle(Style.FILL_AND_STROKE);
  exteriorPaint.setStrokeWidth(textSize / 8);
  exteriorPaint.setAntiAlias(false);
  exteriorPaint.setAlpha(255);

  this.textSize = textSize;
}
 
Example 2
Project: Discover   File: BallGridPulseIndicator.java   View Source Code Vote up 6 votes
@Override
public void draw(Canvas canvas, Paint paint) {
    float circleSpacing=4;
    float radius=(getWidth()-circleSpacing*4)/6;
    float x = getWidth()/ 2-(radius*2+circleSpacing);
    float y = getWidth()/ 2-(radius*2+circleSpacing);

    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            canvas.save();
            float translateX=x+(radius*2)*j+circleSpacing*j;
            float translateY=y+(radius*2)*i+circleSpacing*i;
            canvas.translate(translateX, translateY);
            canvas.scale(scaleFloats[3 * i + j], scaleFloats[3 * i + j]);
            paint.setAlpha(alphas[3 * i + j]);
            canvas.drawCircle(0, 0, radius, paint);
            canvas.restore();
        }
    }
}
 
Example 3
Project: mobile-store   File: FeatureImage.java   View Source Code Vote up 6 votes
/**
 * First try to draw whatever image was given to this view. If that doesn't exist, try to draw
 * a geometric pattern based on the palette that was given to us. If we haven't had a colour
 * assigned to us (using {@link #setColour(int)}) then clear the view by filling it with white.
 */
@Override
protected void onDraw(Canvas canvas) {
    if (getDrawable() != null) {
        super.onDraw(canvas);
    } else if (trianglePaints != null) {
        for (Paint paint : trianglePaints) {
            paint.setAlpha(currentAlpha);
        }

        canvas.drawColor(baseColour);
        for (int i = 0; i < triangles.length; i++) {
            canvas.drawPath(triangles[i], trianglePaints[i]);
        }
    } else {
        canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
    }

}
 
Example 4
Project: GravityBox   File: StatusbarBattery.java   View Source Code Vote up 6 votes
public void setColors(int mainColor, int frameColor, int chargeColor) {
    if (mBattery != null) {
        try {
            Object drawable = getDrawable();
            final int[] colors = (int[]) XposedHelpers.getObjectField(drawable, "mColors");
            colors[colors.length - 1] = mainColor;
            if (Utils.isLineageOs()) {
                Drawable frameDrawable = (Drawable) XposedHelpers.getObjectField(drawable, "mFrameDrawable");
                frameDrawable.setAlpha(mFrameAlpha);
                frameDrawable.setTint(frameColor);
                Paint paint = (Paint) XposedHelpers.getObjectField(drawable, "mTextAndBoltPaint");
                paint.setColor(chargeColor);
            } else {
                final Paint framePaint = (Paint) XposedHelpers.getObjectField(drawable, "mFramePaint");
                framePaint.setColor(frameColor);
                framePaint.setAlpha(mFrameAlpha);
                XposedHelpers.setIntField(drawable, "mChargeColor", chargeColor);
            }
            XposedHelpers.setIntField(drawable, "mIconTint", mainColor);
        } catch (Throwable t) {
            XposedBridge.log(t);
        }
    }
}
 
Example 5
Project: snu-artoon   File: BorderedText.java   View Source Code Vote up 6 votes
/**
 * Create a bordered text object with the specified interior and exterior colors, text size and
 * alignment.
 *
 * @param interiorColor the interior text color
 * @param exteriorColor the exterior text color
 * @param textSize text size in pixels
 */
public BorderedText(final int interiorColor, final int exteriorColor, final float textSize) {
  interiorPaint = new Paint();
  interiorPaint.setTextSize(textSize);
  interiorPaint.setColor(interiorColor);
  interiorPaint.setStyle(Style.FILL);
  interiorPaint.setAntiAlias(false);
  interiorPaint.setAlpha(255);

  exteriorPaint = new Paint();
  exteriorPaint.setTextSize(textSize);
  exteriorPaint.setColor(exteriorColor);
  exteriorPaint.setStyle(Style.FILL_AND_STROKE);
  exteriorPaint.setStrokeWidth(textSize / 8);
  exteriorPaint.setAntiAlias(false);
  exteriorPaint.setAlpha(255);

  this.textSize = textSize;
}
 
Example 6
Project: GitHub   File: WheelListView.java   View Source Code Vote up 5 votes
private void init(LineConfig config) {
    bgPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    bgPaint.setColor(Color.TRANSPARENT);

    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setStrokeWidth(config.getThick());
    paint.setColor(config.getColor());
    paint.setAlpha(config.getAlpha());
}
 
Example 7
Project: TableRecyclerView   File: SingleLineItemDecoration.java   View Source Code Vote up 5 votes
public SingleLineItemDecoration(int divider_height,int divider_color) {
    lineHeight = divider_height;
    lineColor = divider_color;

    paint = new Paint();

    paint.setColor(lineColor);
    paint.setAlpha(240);
}
 
Example 8
Project: AOSP-Kayboard-7.1.2   File: MainKeyboardView.java   View Source Code Vote up 5 votes
private void drawLanguageOnSpacebar(final Key key, final Canvas canvas, final Paint paint) {
    final Keyboard keyboard = getKeyboard();
    if (keyboard == null) {
        return;
    }
    final int width = key.getWidth();
    final int height = key.getHeight();
    paint.setTextAlign(Align.CENTER);
    paint.setTypeface(Typeface.DEFAULT);
    paint.setTextSize(mLanguageOnSpacebarTextSize);
    final String language = layoutLanguageOnSpacebar(paint, keyboard.mId.mSubtype, width);
    // Draw language text with shadow
    final float descent = paint.descent();
    final float textHeight = -paint.ascent() + descent;
    final float baseline = height / 2 + textHeight / 2;
    if (mLanguageOnSpacebarTextShadowRadius > 0.0f) {
        paint.setShadowLayer(mLanguageOnSpacebarTextShadowRadius, 0, 0,
                mLanguageOnSpacebarTextShadowColor);
    } else {
        paint.clearShadowLayer();
    }
    paint.setColor(mLanguageOnSpacebarTextColor);
    paint.setAlpha(mLanguageOnSpacebarAnimAlpha);
    canvas.drawText(language, width / 2, baseline - descent, paint);
    paint.clearShadowLayer();
    paint.setTextScaleX(1.0f);
}
 
Example 9
Project: AnchorImageView   File: AnchorImageView.java   View Source Code Vote up 5 votes
private void init() {
    drawRoundRectRadius = dpToPx(5);
    setScaleType(ImageView.ScaleType.FIT_XY);

    clickableStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
    clickableStroke.setStrokeWidth(1f);
    clickableStroke.setStyle(Paint.Style.STROKE);
    clickableStroke.setStrokeCap(Paint.Cap.ROUND);
    clickableStroke.setColor(Color.BLUE);

    clickFill = new Paint(Paint.ANTI_ALIAS_FLAG);
    clickFill.setStyle(Paint.Style.FILL_AND_STROKE);
    clickFill.setStrokeCap(Paint.Cap.ROUND);
    clickFill.setColor(Color.BLUE);
    clickFill.setAlpha(70);

    clickStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
    clickStroke.setStyle(Paint.Style.STROKE);
    clickStroke.setColor(Color.BLUE);
    clickStroke.setStrokeWidth(2f);
    clickStroke.setStrokeCap(Paint.Cap.ROUND);

    warnFill = new Paint(Paint.ANTI_ALIAS_FLAG);
    warnFill.setStyle(Paint.Style.FILL_AND_STROKE);
    warnFill.setStrokeCap(Paint.Cap.ROUND);
    warnFill.setColor(Color.YELLOW);
    warnFill.setAlpha(70);

    warnStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
    warnStroke.setStyle(Paint.Style.STROKE);
    warnStroke.setColor(Color.YELLOW);
    warnStroke.setStrokeWidth(2f);
    warnStroke.setStrokeCap(Paint.Cap.ROUND);

    setOnTouchListener(this);
    gestureDetector = new GestureDetector(getContext(), new OnGestureListenerAnchor(this));
}
 
Example 10
Project: kotlin-android   File: RectLayer.java   View Source Code Vote up 5 votes
@Override
public void draw(Canvas canvas) {
    super.draw(canvas);
    int width = getWidth();
    int height = getHeight();
    rect = new Rect(width/12, height/5, width * 11 / 12, height *7 /10);
    Paint p = new Paint();
    p.setColor(Color.BLACK);
    p.setStyle(Paint.Style.FILL);
    p.setAlpha(76);
    canvas.drawRect(0, 0, width, rect.top, p);
    canvas.drawRect(0, rect.bottom, width, height, p);
    canvas.drawRect(0, rect.top, rect.left, rect.bottom, p);
    canvas.drawRect(rect.right, rect.top, width, rect.bottom, p);

    p.setColor(Color.RED);
    p.setAlpha(255);
    p.setStrokeWidth(3);
    int lineVerticalPos = rect.top + (rect.height() >> 1);
    canvas.drawLine(rect.left + 10, lineVerticalPos, rect.right - 10, lineVerticalPos, p);

    p.setColor(Color.WHITE);
    p.setStrokeWidth(3);
    float[] vertice = {rect.left, rect.top, rect.right, rect.top,
            rect.right, rect.top, rect.right, rect.bottom,
            rect.right, rect.bottom, rect.left, rect.bottom,
            rect.left, rect.top, rect.left, rect.bottom};
    canvas.drawLines(vertice, p);

    p.setARGB(255, 255, 141, 22);
    p.setStrokeWidth(5);
    canvas.drawLine(rect.left, rect.top, rect.left + 40, rect.top, p);
    canvas.drawLine(rect.right - 40, rect.top, rect.right, rect.top, p);
    canvas.drawLine(rect.right, rect.top, rect.right, rect.top + 40, p);
    canvas.drawLine(rect.right, rect.bottom - 40, rect.right, rect.bottom, p);
    canvas.drawLine(rect.right - 40, rect.bottom, rect.right, rect.bottom, p);
    canvas.drawLine(rect.left, rect.bottom, rect.left + 40, rect.bottom, p);
    canvas.drawLine(rect.left, rect.bottom - 40, rect.left, rect.bottom, p);
    canvas.drawLine(rect.left, rect.top, rect.left, rect.top + 40, p);
}
 
Example 11
Project: GitHub   File: BallScaleIndicator.java   View Source Code Vote up 5 votes
@Override
public void draw(Canvas canvas, Paint paint) {
    float circleSpacing=4;
    paint.setAlpha(alpha);
    canvas.scale(scale,scale,getWidth()/2,getHeight()/2);
    paint.setAlpha(alpha);
    canvas.drawCircle(getWidth()/2,getHeight()/2,getWidth()/2-circleSpacing,paint);
}
 
Example 12
Project: Discover   File: BallSpinFadeLoaderIndicator.java   View Source Code Vote up 5 votes
@Override
public void draw(Canvas canvas, Paint paint) {
    float radius=getWidth()/10;
    for (int i = 0; i < 8; i++) {
        canvas.save();
        Point point=circleAt(getWidth(),getHeight(),getWidth()/2-radius,i*(Math.PI/4));
        canvas.translate(point.x,point.y);
        canvas.scale(scaleFloats[i],scaleFloats[i]);
        paint.setAlpha(alphas[i]);
        canvas.drawCircle(0,0,radius,paint);
        canvas.restore();
    }
}
 
Example 13
Project: SRecyclerView   File: BallSpinFadeLoaderIndicator.java   View Source Code Vote up 5 votes
@Override
public void draw(Canvas canvas, Paint paint) {
    float radius=getWidth()/10;
    for (int i = 0; i < 8; i++) {
        canvas.save();
        Point point=circleAt(getWidth(),getHeight(),getWidth()/2-radius,i*(Math.PI/4));
        canvas.translate(point.x,point.y);
        canvas.scale(scaleFloats[i],scaleFloats[i]);
        paint.setAlpha(alphas[i]);
        canvas.drawCircle(0,0,radius,paint);
        canvas.restore();
    }
}
 
Example 14
Project: LaunchEnr   File: ShadowGenerator.java   View Source Code Vote up 5 votes
public static Bitmap createPillWithShadow(int rectColor, int width, int height) {

        float shadowRadius = height * 1f / 32;
        float shadowYOffset = height * 1f / 16;

        int radius = height / 2;

        Canvas canvas = new Canvas();
        Paint blurPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
        blurPaint.setMaskFilter(new BlurMaskFilter(shadowRadius, Blur.NORMAL));

        int centerX = Math.round(width / 2 + shadowRadius);
        int centerY = Math.round(radius + shadowRadius + shadowYOffset);
        int center = Math.max(centerX, centerY);
        int size = center * 2;
        Bitmap result = Bitmap.createBitmap(size, size, Config.ARGB_8888);
        canvas.setBitmap(result);

        int left = center - width / 2;
        int top = center - height / 2;
        int right = center + width / 2;
        int bottom = center + height / 2;

        // Draw ambient shadow, center aligned within size
        blurPaint.setAlpha(AMBIENT_SHADOW_ALPHA);
        canvas.drawRoundRect(left, top, right, bottom, radius, radius, blurPaint);

        // Draw key shadow, bottom aligned within size
        blurPaint.setAlpha(KEY_SHADOW_ALPHA);
        canvas.drawRoundRect(left, top + shadowYOffset, right, bottom + shadowYOffset,
                radius, radius, blurPaint);

        // Draw the circle
        Paint drawPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
        drawPaint.setColor(rectColor);
        canvas.drawRoundRect(left, top, right, bottom, radius, radius, drawPaint);

        return result;
    }
 
Example 15
Project: MyCalendar   File: FloatingActionButtonLibrary.java   View Source Code Vote up 5 votes
private Drawable createOuterStrokeDrawable(float strokeWidth) {
  ShapeDrawable shapeDrawable = new ShapeDrawable(new OvalShape());

  final Paint paint = shapeDrawable.getPaint();
  paint.setAntiAlias(true);
  paint.setStrokeWidth(strokeWidth);
  paint.setStyle(Style.STROKE);
  paint.setColor(Color.BLACK);
  paint.setAlpha(opacityToAlpha(0.02f));

  return shapeDrawable;
}
 
Example 16
Project: BLE-Indoor-Positioning   File: BeaconMap.java   View Source Code Vote up 4 votes
protected void drawReferenceLine(Canvas canvas) {
    float canvasPadding = canvasWidth * canvasProjection.getPaddingFactor();
    float maximumReferenceLineWidth = canvasWidth - (2 * canvasPadding);
    float maximumReferenceDistance = (float) canvasProjection.getMetersFromCanvasUnits(maximumReferenceLineWidth);
    float referenceDistance = DistanceUtil.getReasonableSmallerEvenDistance(maximumReferenceDistance);
    float referenceLineWidth = (float) canvasProjection.getCanvasUnitsFromMeters(referenceDistance);
    float referenceLinePadding = (canvasWidth - referenceLineWidth) / 2;

    Paint legendPaint = new Paint(textPaint);
    legendPaint.setAlpha(50);
    legendPaint.setTextSize(pixelsPerDip * 12);

    float referenceYOffset = canvasHeight - (pixelsPerDip * 16);
    PointF referenceStartPoint = new PointF(referenceLinePadding, referenceYOffset);
    PointF referenceEndPoint = new PointF(canvasWidth - referenceLinePadding, referenceYOffset);

    // horizontal line
    canvas.drawRect(
            referenceStartPoint.x,
            referenceStartPoint.y,
            referenceEndPoint.x,
            referenceEndPoint.y - pixelsPerDip,
            legendPaint
    );

    // left vertical line
    canvas.drawRect(
            referenceStartPoint.x,
            referenceStartPoint.y - (pixelsPerDip * 8),
            referenceStartPoint.x + pixelsPerDip,
            referenceStartPoint.y,
            legendPaint
    );

    // right vertical line
    canvas.drawRect(
            referenceEndPoint.x,
            referenceEndPoint.y - (pixelsPerDip * 8),
            referenceEndPoint.x + pixelsPerDip,
            referenceEndPoint.y,
            legendPaint
    );

    // text
    String referenceText = String.valueOf(Math.round(referenceDistance)) + " meters";
    float referenceTextWidth = legendPaint.measureText(referenceText);
    canvas.drawText(
            referenceText,
            (canvasWidth / 2) - (referenceTextWidth / 2),
            referenceStartPoint.y - (pixelsPerDip * 4),
            legendPaint
    );
}
 
Example 17
Project: GitHub   File: SimpleMonthView.java   View Source Code Vote up 4 votes
protected void initView() {
       mMonthTitlePaint = new Paint();
       mMonthTitlePaint.setFakeBoldText(true);
       mMonthTitlePaint.setAntiAlias(true);
       mMonthTitlePaint.setTextSize(MONTH_LABEL_TEXT_SIZE);
       mMonthTitlePaint.setTypeface(Typeface.create(mMonthTitleTypeface, Typeface.BOLD));
       mMonthTitlePaint.setColor(mDayTextColor);
       mMonthTitlePaint.setTextAlign(Align.CENTER);
       mMonthTitlePaint.setStyle(Style.FILL);

       mMonthTitleBGPaint = new Paint();
       mMonthTitleBGPaint.setFakeBoldText(true);
       mMonthTitleBGPaint.setAntiAlias(true);
       mMonthTitleBGPaint.setColor(mMonthTitleBGColor);
       mMonthTitleBGPaint.setTextAlign(Align.CENTER);
       mMonthTitleBGPaint.setStyle(Style.FILL);

       mSelectedCirclePaint = new Paint();
       mSelectedCirclePaint.setFakeBoldText(true);
       mSelectedCirclePaint.setAntiAlias(true);
       mSelectedCirclePaint.setColor(mTodayNumberColor);
       mSelectedCirclePaint.setTextAlign(Align.CENTER);
       mSelectedCirclePaint.setStyle(Style.FILL);
       mSelectedCirclePaint.setAlpha(SELECTED_CIRCLE_ALPHA);

       mMonthDayLabelPaint = new Paint();
       mMonthDayLabelPaint.setAntiAlias(true);
       mMonthDayLabelPaint.setTextSize(MONTH_DAY_LABEL_TEXT_SIZE);
       mMonthDayLabelPaint.setColor(mDayTextColor);
       mMonthDayLabelPaint.setTypeface(Typeface.create(mDayOfWeekTypeface, Typeface.NORMAL));
       mMonthDayLabelPaint.setStyle(Style.FILL);
       mMonthDayLabelPaint.setTextAlign(Align.CENTER);
       mMonthDayLabelPaint.setFakeBoldText(true);

       mMonthNumPaint = new Paint();
       mMonthNumPaint.setAntiAlias(true);
       mMonthNumPaint.setTextSize(MINI_DAY_NUMBER_TEXT_SIZE);
       mMonthNumPaint.setStyle(Style.FILL);
       mMonthNumPaint.setTextAlign(Align.CENTER);
       mMonthNumPaint.setFakeBoldText(false);
}
 
Example 18
Project: LaunchEnr   File: CellLayout.java   View Source Code Vote up 4 votes
@Override
protected void onDraw(Canvas canvas) {
    if (!mIsDragTarget) {
        return;
    }

    // When we're large, we are either drawn in a "hover" state (ie when dragging an item to
    // a neighboring page) or with just a normal background (if backgroundAlpha > 0.0f)
    // When we're small, we are either drawn normally or in the "accepts drops" state (during
    // a drag). However, we also drag the mini hover background *over* one of those two
    // backgrounds
    if (mBackgroundAlpha > 0.0f) {
        mBackground.draw(canvas);
    }

    final Paint paint = mDragOutlinePaint;
    for (int i = 0; i < mDragOutlines.length; i++) {
        final float alpha = mDragOutlineAlphas[i];
        if (alpha > 0) {
            final Bitmap b = (Bitmap) mDragOutlineAnims[i].getTag();
            paint.setAlpha((int)(alpha + .5f));
            canvas.drawBitmap(b, null, mDragOutlines[i], paint);
        }
    }

    if (DEBUG_VISUALIZE_OCCUPIED) {
        int[] pt = new int[2];
        ColorDrawable cd = new ColorDrawable(Color.RED);
        cd.setBounds(0, 0,  mCellWidth, mCellHeight);
        for (int i = 0; i < mCountX; i++) {
            for (int j = 0; j < mCountY; j++) {
                if (mOccupied.cells[i][j]) {
                    cellToPoint(i, j, pt);
                    canvas.save();
                    canvas.translate(pt[0], pt[1]);
                    cd.draw(canvas);
                    canvas.restore();
                }
            }
        }
    }

    for (int i = 0; i < mFolderBackgrounds.size(); i++) {
        FolderIcon.PreviewBackground bg = mFolderBackgrounds.get(i);
        cellToPoint(bg.delegateCellX, bg.delegateCellY, mTempLocation);
        canvas.save();
        canvas.translate(mTempLocation[0], mTempLocation[1]);
        bg.drawBackground(mLauncher, canvas);
        if (!bg.isClipping) {
            bg.drawBackgroundStroke(mLauncher, canvas);
        }
        canvas.restore();
    }

    if (mFolderLeaveBehind.delegateCellX >= 0 && mFolderLeaveBehind.delegateCellY >= 0) {
        cellToPoint(mFolderLeaveBehind.delegateCellX,
                mFolderLeaveBehind.delegateCellY, mTempLocation);
        canvas.save();
        canvas.translate(mTempLocation[0], mTempLocation[1]);
        mFolderLeaveBehind.drawLeaveBehind(canvas);
        canvas.restore();
    }
}
 
Example 19
Project: airgram   File: ColorPickerView.java   View Source Code Vote up 4 votes
private void init(AttributeSet attrs, int defStyle) {
    mColorWheelThickness = AndroidUtilities.dp(8);
    mColorWheelRadius = AndroidUtilities.dp(124);
    mPreferredColorWheelRadius = mColorWheelRadius;
    mColorCenterRadius = AndroidUtilities.dp(54);
    mPreferredColorCenterRadius = mColorCenterRadius;
    mColorCenterHaloRadius = AndroidUtilities.dp(60);
    mPreferredColorCenterHaloRadius = mColorCenterHaloRadius;
    mColorPointerRadius = AndroidUtilities.dp(14);
    mColorPointerHaloRadius = AndroidUtilities.dp(18);

    mAngle = (float) (-Math.PI / 2);

    Shader s = new SweepGradient(0, 0, COLORS, null);

    mColorWheelPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mColorWheelPaint.setShader(s);
    mColorWheelPaint.setStyle(Paint.Style.STROKE);
    mColorWheelPaint.setStrokeWidth(mColorWheelThickness);

    mPointerHaloPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPointerHaloPaint.setColor(Color.BLACK);
    mPointerHaloPaint.setAlpha(0x50);

    mPointerColor = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPointerColor.setColor(calculateColor(mAngle));

    mCenterNewPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mCenterNewPaint.setColor(calculateColor(mAngle));
    mCenterNewPaint.setStyle(Paint.Style.FILL);

    mCenterOldPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mCenterOldPaint.setColor(calculateColor(mAngle));
    mCenterOldPaint.setStyle(Paint.Style.FILL);

    mCenterHaloPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mCenterHaloPaint.setColor(Color.BLACK);
    mCenterHaloPaint.setAlpha(0x00);

    mCenterNewColor = calculateColor(mAngle);
    mCenterOldColor = calculateColor(mAngle);
    mShowCenterOldColor = true;
}
 
Example 20
Project: OSchina_resources_android   File: SimpleMonthView.java   View Source Code Vote up 4 votes
protected void initView() {
    mMonthTitlePaint = new Paint();
    mMonthTitlePaint.setFakeBoldText(true);
    mMonthTitlePaint.setAntiAlias(true);
    mMonthTitlePaint.setTextSize(MONTH_LABEL_TEXT_SIZE);
    mMonthTitlePaint.setTypeface(Typeface.create(mMonthTitleTypeface,
            Typeface.BOLD));
    mMonthTitlePaint.setColor(mDayTextColor);
    mMonthTitlePaint.setTextAlign(Align.CENTER);
    mMonthTitlePaint.setStyle(Style.FILL);

    mMonthTitleBGPaint = new Paint();
    mMonthTitleBGPaint.setFakeBoldText(true);
    mMonthTitleBGPaint.setAntiAlias(true);
    mMonthTitleBGPaint.setColor(mMonthTitleBGColor);
    mMonthTitleBGPaint.setTextAlign(Align.CENTER);
    mMonthTitleBGPaint.setStyle(Style.FILL);

    mSelectedCirclePaint = new Paint();
    mSelectedCirclePaint.setFakeBoldText(true);
    mSelectedCirclePaint.setAntiAlias(true);
    mSelectedCirclePaint.setColor(mTodayNumberColor);
    mSelectedCirclePaint.setTextAlign(Align.CENTER);
    mSelectedCirclePaint.setStyle(Style.FILL);
    mSelectedCirclePaint.setAlpha(SELECTED_CIRCLE_ALPHA);

    mMonthDayLabelPaint = new Paint();
    mMonthDayLabelPaint.setAntiAlias(true);
    mMonthDayLabelPaint.setTextSize(MONTH_DAY_LABEL_TEXT_SIZE);
    mMonthDayLabelPaint.setColor(mDayTextColor);
    mMonthDayLabelPaint.setTypeface(Typeface.create(mDayOfWeekTypeface,
            Typeface.NORMAL));
    mMonthDayLabelPaint.setStyle(Style.FILL);
    mMonthDayLabelPaint.setTextAlign(Align.CENTER);
    mMonthDayLabelPaint.setFakeBoldText(true);

    mMonthNumPaint = new Paint();
    mMonthNumPaint.setAntiAlias(true);
    mMonthNumPaint.setTextSize(MINI_DAY_NUMBER_TEXT_SIZE);
    mMonthNumPaint.setStyle(Style.FILL);
    mMonthNumPaint.setTextAlign(Align.CENTER);
    mMonthNumPaint.setFakeBoldText(false);
}