Search in sources :

Example 6 with ShapeDrawable

use of android.graphics.drawable.ShapeDrawable 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 7 with ShapeDrawable

use of android.graphics.drawable.ShapeDrawable in project Bitocle by mthli.

the class DefaultHeaderTransformer method applyProgressBarSettings.

private void applyProgressBarSettings() {
    if (mHeaderProgressBar != null) {
        ShapeDrawable shape = new ShapeDrawable();
        shape.setShape(new RectShape());
        shape.getPaint().setColor(mProgressDrawableColor);
        ClipDrawable clipDrawable = new ClipDrawable(shape, Gravity.CENTER, ClipDrawable.HORIZONTAL);
        mHeaderProgressBar.setProgressDrawable(clipDrawable);
    }
}
Also used : RectShape(android.graphics.drawable.shapes.RectShape) ShapeDrawable(android.graphics.drawable.ShapeDrawable) ClipDrawable(android.graphics.drawable.ClipDrawable)

Example 8 with ShapeDrawable

use of android.graphics.drawable.ShapeDrawable in project MaterialLibrary by DeveloperPaul123.

the class MaterialFABMenuItem method getShapeDrawable.

private Drawable getShapeDrawable(int color) {
    ShapeDrawable shapeDrawable = new ShapeDrawable(new OvalShape());
    final Paint fillPaint = shapeDrawable.getPaint();
    fillPaint.setAntiAlias(true);
    fillPaint.setColor(color);
    return shapeDrawable;
}
Also used : ShapeDrawable(android.graphics.drawable.ShapeDrawable) Paint(android.graphics.Paint) OvalShape(android.graphics.drawable.shapes.OvalShape)

Example 9 with ShapeDrawable

use of android.graphics.drawable.ShapeDrawable 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)

Example 10 with ShapeDrawable

use of android.graphics.drawable.ShapeDrawable in project UltimateAndroid by cymcsg.

the class AddFloatingActionButton method getIconDrawable.

@Override
Drawable getIconDrawable() {
    final float iconSize = getDimension(R.dimen.fab_icon_size);
    final float iconHalfSize = iconSize / 2f;
    final float plusSize = getDimension(R.dimen.fab_plus_icon_size);
    final float plusHalfStroke = getDimension(R.dimen.fab_plus_icon_stroke) / 2f;
    final float plusOffset = (iconSize - plusSize) / 2f;
    final Shape shape = new Shape() {

        @Override
        public void draw(Canvas canvas, Paint paint) {
            canvas.drawRect(plusOffset, iconHalfSize - plusHalfStroke, iconSize - plusOffset, iconHalfSize + plusHalfStroke, paint);
            canvas.drawRect(iconHalfSize - plusHalfStroke, plusOffset, iconHalfSize + plusHalfStroke, iconSize - plusOffset, paint);
        }
    };
    ShapeDrawable drawable = new ShapeDrawable(shape);
    final Paint paint = drawable.getPaint();
    paint.setColor(mPlusColor);
    paint.setStyle(Style.FILL);
    paint.setAntiAlias(true);
    return drawable;
}
Also used : Shape(android.graphics.drawable.shapes.Shape) Canvas(android.graphics.Canvas) ShapeDrawable(android.graphics.drawable.ShapeDrawable) Paint(android.graphics.Paint)

Aggregations

ShapeDrawable (android.graphics.drawable.ShapeDrawable)131 OvalShape (android.graphics.drawable.shapes.OvalShape)64 Paint (android.graphics.Paint)38 Drawable (android.graphics.drawable.Drawable)30 LayerDrawable (android.graphics.drawable.LayerDrawable)28 SuppressLint (android.annotation.SuppressLint)20 RoundRectShape (android.graphics.drawable.shapes.RoundRectShape)20 StateListDrawable (android.graphics.drawable.StateListDrawable)18 ClipDrawable (android.graphics.drawable.ClipDrawable)17 Bitmap (android.graphics.Bitmap)16 BitmapDrawable (android.graphics.drawable.BitmapDrawable)16 BitmapShader (android.graphics.BitmapShader)15 AnimationDrawable (android.graphics.drawable.AnimationDrawable)14 ColorDrawable (android.graphics.drawable.ColorDrawable)11 RectShape (android.graphics.drawable.shapes.RectShape)10 Resources (android.content.res.Resources)8 Shape (android.graphics.drawable.shapes.Shape)8 Canvas (android.graphics.Canvas)6 Shader (android.graphics.Shader)6 ImageView (android.widget.ImageView)6