Search in sources :

Example 16 with OvalShape

use of android.graphics.drawable.shapes.OvalShape in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class FloatingActionButton method createOuterStrokeDrawable.

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;
}
Also used : ShapeDrawable(android.graphics.drawable.ShapeDrawable) Paint(android.graphics.Paint) OvalShape(android.graphics.drawable.shapes.OvalShape)

Example 17 with OvalShape

use of android.graphics.drawable.shapes.OvalShape in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class FloatingActionButton method createInnerStrokesDrawable.

private Drawable createInnerStrokesDrawable(final int color, float strokeWidth) {
    if (!mStrokeVisible) {
        return new ColorDrawable(Color.TRANSPARENT);
    }
    ShapeDrawable shapeDrawable = new ShapeDrawable(new OvalShape());
    final int bottomStrokeColor = darkenColor(color);
    final int bottomStrokeColorHalfTransparent = halfTransparent(bottomStrokeColor);
    final int topStrokeColor = lightenColor(color);
    final int topStrokeColorHalfTransparent = halfTransparent(topStrokeColor);
    final Paint paint = shapeDrawable.getPaint();
    paint.setAntiAlias(true);
    paint.setStrokeWidth(strokeWidth);
    paint.setStyle(Style.STROKE);
    shapeDrawable.setShaderFactory(new ShaderFactory() {

        @Override
        public Shader resize(int width, int height) {
            return new LinearGradient(width / 2, 0, width / 2, height, new int[] { topStrokeColor, topStrokeColorHalfTransparent, color, bottomStrokeColorHalfTransparent, bottomStrokeColor }, new float[] { 0f, 0.2f, 0.5f, 0.8f, 1f }, TileMode.CLAMP);
        }
    });
    return shapeDrawable;
}
Also used : LinearGradient(android.graphics.LinearGradient) ShaderFactory(android.graphics.drawable.ShapeDrawable.ShaderFactory) ColorDrawable(android.graphics.drawable.ColorDrawable) ShapeDrawable(android.graphics.drawable.ShapeDrawable) Paint(android.graphics.Paint) OvalShape(android.graphics.drawable.shapes.OvalShape) Shader(android.graphics.Shader) SuppressLint(android.annotation.SuppressLint) Paint(android.graphics.Paint)

Example 18 with OvalShape

use of android.graphics.drawable.shapes.OvalShape 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 19 with OvalShape

use of android.graphics.drawable.shapes.OvalShape in project teaTime by ancfdy.

the class PullHeaderLayout method setActionDrawable.

public void setActionDrawable(Drawable actionDrawable) {
    mActionDrawable = actionDrawable;
    if (mActionDrawable != null) {
        if (mActionView == null) {
            final int bgColor = Utils_Flyrefresh.getThemeColorFromAttrOrRes(getContext(), R.attr.colorAccent, R.color.accent);
            final int pressedColor = Utils_Flyrefresh.darkerColor(bgColor, 0.8f);
            final ShapeDrawable bgDrawable = new ShapeDrawable(new OvalShape());
            bgDrawable.getPaint().setColor(bgColor);
            mActionView = new FloatingActionButton(getContext());
            mActionView.setRippleColor(pressedColor);
            mActionView.setBackgroundDrawable(bgDrawable);
            addView(mActionView, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
        }
        if (mFlyView == null) {
            mFlyView = new ImageView(getContext());
            mFlyView.setScaleType(ImageView.ScaleType.FIT_XY);
            addView(mFlyView, new LayoutParams(ACTION_ICON_SIZE, ACTION_ICON_SIZE));
            mFlyView.bringToFront();
            float elevation = ViewCompat.getElevation(mActionView);
            ViewCompat.setElevation(mFlyView, elevation + 1);
        }
        mFlyView.setImageDrawable(mActionDrawable);
    } else {
        if (mActionView != null) {
            removeView(mActionView);
            removeView(mFlyView);
            mActionView = null;
            mFlyView = null;
        }
    }
}
Also used : ShapeDrawable(android.graphics.drawable.ShapeDrawable) FloatingActionButton(android.support.design.widget.FloatingActionButton) ImageView(android.widget.ImageView) OvalShape(android.graphics.drawable.shapes.OvalShape)

Example 20 with OvalShape

use of android.graphics.drawable.shapes.OvalShape in project jianshi by wingjay.

the class TextPointView method setCircleBackgroundColor.

public void setCircleBackgroundColor(@ColorRes int circleColorRes) {
    ShapeDrawable circleShapeDrawable = new ShapeDrawable();
    circleShapeDrawable.setShape(new OvalShape());
    circleShapeDrawable.getPaint().setColor(ContextCompat.getColor(context, circleColorRes));
    circleView.setBackgroundDrawable(circleShapeDrawable);
}
Also used : ShapeDrawable(android.graphics.drawable.ShapeDrawable) OvalShape(android.graphics.drawable.shapes.OvalShape)

Aggregations

OvalShape (android.graphics.drawable.shapes.OvalShape)44 ShapeDrawable (android.graphics.drawable.ShapeDrawable)40 Paint (android.graphics.Paint)17 SuppressLint (android.annotation.SuppressLint)10 StateListDrawable (android.graphics.drawable.StateListDrawable)8 ColorDrawable (android.graphics.drawable.ColorDrawable)7 LayerDrawable (android.graphics.drawable.LayerDrawable)7 Drawable (android.graphics.drawable.Drawable)5 ImageView (android.widget.ImageView)5 LinearGradient (android.graphics.LinearGradient)3 Shader (android.graphics.Shader)3 ShaderFactory (android.graphics.drawable.ShapeDrawable.ShaderFactory)3 View (android.view.View)3 Bitmap (android.graphics.Bitmap)2 Rect (android.graphics.Rect)2 RectF (android.graphics.RectF)2 RoundRectShape (android.graphics.drawable.shapes.RoundRectShape)2 FloatingActionButton (android.support.design.widget.FloatingActionButton)2 LinearInterpolator (android.view.animation.LinearInterpolator)2 RelativeLayout (android.widget.RelativeLayout)2