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;
}
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;
}
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;
}
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;
}
}
}
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);
}
Aggregations