Search in sources :

Example 1 with RoundRectShape

use of android.graphics.drawable.shapes.RoundRectShape in project FlexibleAdapter by davideas.

the class DrawableUtils method getRippleMask.

private static Drawable getRippleMask(@ColorInt int color) {
    float[] outerRadii = new float[8];
    // 3 is the radius of final ripple, instead of 3 we can give required final radius
    Arrays.fill(outerRadii, 3);
    RoundRectShape r = new RoundRectShape(outerRadii, null, null);
    ShapeDrawable shapeDrawable = new ShapeDrawable(r);
    shapeDrawable.getPaint().setColor(color);
    return shapeDrawable;
}
Also used : RoundRectShape(android.graphics.drawable.shapes.RoundRectShape) ShapeDrawable(android.graphics.drawable.ShapeDrawable)

Example 2 with RoundRectShape

use of android.graphics.drawable.shapes.RoundRectShape in project android-viewbadger by jgilfelt.

the class BadgeView method getDefaultBackground.

private ShapeDrawable getDefaultBackground() {
    int r = dipToPixels(DEFAULT_CORNER_RADIUS_DIP);
    float[] outerR = new float[] { r, r, r, r, r, r, r, r };
    RoundRectShape rr = new RoundRectShape(outerR, null, null);
    ShapeDrawable drawable = new ShapeDrawable(rr);
    drawable.getPaint().setColor(badgeColor);
    return drawable;
}
Also used : RoundRectShape(android.graphics.drawable.shapes.RoundRectShape) ShapeDrawable(android.graphics.drawable.ShapeDrawable)

Example 3 with RoundRectShape

use of android.graphics.drawable.shapes.RoundRectShape in project FastAdapter by mikepenz.

the class FastAdapterUIUtils method getRippleMask.

/**
     * helper to create an ripple mask with the given color and radius
     *
     * @param color  the color
     * @param radius the radius
     * @return the mask drawable
     */
private static Drawable getRippleMask(int color, int radius) {
    float[] outerRadius = new float[8];
    Arrays.fill(outerRadius, radius);
    RoundRectShape r = new RoundRectShape(outerRadius, null, null);
    ShapeDrawable shapeDrawable = new ShapeDrawable(r);
    shapeDrawable.getPaint().setColor(color);
    return shapeDrawable;
}
Also used : RoundRectShape(android.graphics.drawable.shapes.RoundRectShape) ShapeDrawable(android.graphics.drawable.ShapeDrawable)

Example 4 with RoundRectShape

use of android.graphics.drawable.shapes.RoundRectShape in project PhotoNoter by yydcdut.

the class TextDrawable method drawBorder.

/**
     * 画边界
     *
     * @param canvas
     */
private void drawBorder(Canvas canvas) {
    RectF rect = new RectF(getBounds());
    //上下左右都加个borderThickness / 2长度
    rect.inset(borderThickness / 2, borderThickness / 2);
    if (shape instanceof OvalShape) {
        //椭圆
        canvas.drawOval(rect, borderPaint);
    } else if (shape instanceof RoundRectShape) {
        //圆角Rect
        canvas.drawRoundRect(rect, radius, radius, borderPaint);
    } else {
        //Rect
        canvas.drawRect(rect, borderPaint);
    }
}
Also used : RectF(android.graphics.RectF) RoundRectShape(android.graphics.drawable.shapes.RoundRectShape) OvalShape(android.graphics.drawable.shapes.OvalShape)

Example 5 with RoundRectShape

use of android.graphics.drawable.shapes.RoundRectShape in project AndroidDevelop by 7449.

the class BadgeView method getDefaultBackground.

private ShapeDrawable getDefaultBackground() {
    int r = dipToPixels(DEFAULT_CORNER_RADIUS_DIP);
    float[] outerR = new float[] { r, r, r, r, r, r, r, r };
    RoundRectShape rr = new RoundRectShape(outerR, null, null);
    ShapeDrawable drawable = new ShapeDrawable(rr);
    drawable.getPaint().setColor(badgeColor);
    return drawable;
}
Also used : RoundRectShape(android.graphics.drawable.shapes.RoundRectShape) ShapeDrawable(android.graphics.drawable.ShapeDrawable) SuppressLint(android.annotation.SuppressLint)

Aggregations

RoundRectShape (android.graphics.drawable.shapes.RoundRectShape)14 ShapeDrawable (android.graphics.drawable.ShapeDrawable)12 RectF (android.graphics.RectF)3 TypedArray (android.content.res.TypedArray)2 Drawable (android.graphics.drawable.Drawable)2 InsetDrawable (android.graphics.drawable.InsetDrawable)2 LayerDrawable (android.graphics.drawable.LayerDrawable)2 StateListDrawable (android.graphics.drawable.StateListDrawable)2 OvalShape (android.graphics.drawable.shapes.OvalShape)2 Attributes (com.cengalabs.flatui.Attributes)2 SuppressLint (android.annotation.SuppressLint)1 Typeface (android.graphics.Typeface)1 TouchEffectAnimator (com.cengalabs.flatui.TouchEffectAnimator)1