use of android.graphics.drawable.ShapeDrawable in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class FloatingActionButton method createCircleDrawable.
private Drawable createCircleDrawable(int color, float strokeWidth) {
int alpha = Color.alpha(color);
int opaqueColor = opaque(color);
ShapeDrawable fillDrawable = new ShapeDrawable(new OvalShape());
final Paint paint = fillDrawable.getPaint();
paint.setAntiAlias(true);
paint.setColor(opaqueColor);
Drawable[] layers = { fillDrawable, createInnerStrokesDrawable(opaqueColor, strokeWidth) };
LayerDrawable drawable = alpha == 255 || !mStrokeVisible ? new LayerDrawable(layers) : new TranslucentLayerDrawable(alpha, layers);
int halfStrokeWidth = (int) (strokeWidth / 2f);
drawable.setLayerInset(1, halfStrokeWidth, halfStrokeWidth, halfStrokeWidth, halfStrokeWidth);
return drawable;
}
use of android.graphics.drawable.ShapeDrawable in project coins-android by bubelov.
the class StaticClusterRenderer method makeClusterBackground.
private LayerDrawable makeClusterBackground() {
mColoredCircleBackground = new ShapeDrawable(new OvalShape());
ShapeDrawable outline = new ShapeDrawable(new OvalShape());
// Transparent white.
outline.getPaint().setColor(Color.WHITE);
LayerDrawable background = new LayerDrawable(new Drawable[] { outline, mColoredCircleBackground });
int strokeWidth = (int) (mDensity * 1.5f);
background.setLayerInset(1, strokeWidth, strokeWidth, strokeWidth, strokeWidth);
return background;
}
use of android.graphics.drawable.ShapeDrawable in project MaterialAbout by jrvansuita.
the class RippleUtil method getRippleMask.
private static Drawable getRippleMask(int color) {
float[] outerRadii = new float[8];
// 3 is radius of final ripple,
// instead of 3 you 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;
}
use of android.graphics.drawable.ShapeDrawable in project android_packages_apps_crDroidSettings by crdroidandroid.
the class ColorPickerPreference method createOvalShape.
private static ShapeDrawable createOvalShape(int size, int color) {
ShapeDrawable shape = new ShapeDrawable(new OvalShape());
shape.setIntrinsicHeight(size);
shape.setIntrinsicWidth(size);
shape.getPaint().setColor(color);
return shape;
}
use of android.graphics.drawable.ShapeDrawable in project android_packages_apps_crDroidSettings by crdroidandroid.
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;
}
Aggregations