use of android.graphics.drawable.shapes.OvalShape in project StylishMusicPlayer by ryanhoo.
the class ShadowImageView method init.
private void init() {
final float density = getContext().getResources().getDisplayMetrics().density;
final int shadowXOffset = (int) (density * X_OFFSET);
final int shadowYOffset = (int) (density * Y_OFFSET);
mShadowRadius = (int) (density * SHADOW_RADIUS);
ShapeDrawable circle;
if (elevationSupported()) {
circle = new ShapeDrawable(new OvalShape());
ViewCompat.setElevation(this, SHADOW_ELEVATION * density);
} else {
OvalShape oval = new OvalShadow(mShadowRadius);
circle = new ShapeDrawable(oval);
ViewCompat.setLayerType(this, ViewCompat.LAYER_TYPE_SOFTWARE, circle.getPaint());
circle.getPaint().setShadowLayer(mShadowRadius, shadowXOffset, shadowYOffset, KEY_SHADOW_COLOR);
final int padding = mShadowRadius;
// set padding so the inner image sits correctly within the shadow.
setPadding(padding, padding, padding, padding);
}
circle.getPaint().setAntiAlias(true);
circle.getPaint().setColor(DEFAULT_BACKGROUND_COLOR);
setBackground(circle);
mRotateAnimator = ObjectAnimator.ofFloat(this, "rotation", 0f, 360f);
mRotateAnimator.setDuration(7200);
mRotateAnimator.setInterpolator(new LinearInterpolator());
mRotateAnimator.setRepeatMode(ValueAnimator.RESTART);
mRotateAnimator.setRepeatCount(ValueAnimator.INFINITE);
}
use of android.graphics.drawable.shapes.OvalShape in project material-dialogs by afollestad.
the class CircleView method createSelector.
private Drawable createSelector(int color) {
ShapeDrawable darkerCircle = new ShapeDrawable(new OvalShape());
darkerCircle.getPaint().setColor(translucentColor(shiftColorUp(color)));
StateListDrawable stateListDrawable = new StateListDrawable();
stateListDrawable.addState(new int[] { android.R.attr.state_pressed }, darkerCircle);
return stateListDrawable;
}
use of android.graphics.drawable.shapes.OvalShape in project SublimePicker by vikramkakkar.
the class SUtils method createImageViewShape.
// Base icon bg shape
private static Drawable createImageViewShape(int color) {
OvalShape ovalShape = new OvalShape();
ShapeDrawable shapeDrawable = new ShapeDrawable(ovalShape);
shapeDrawable.getPaint().setColor(color);
return shapeDrawable;
}
use of android.graphics.drawable.shapes.OvalShape in project AndroidChromium by JackyAndroid.
the class DownloadNotificationService method getLargeNotificationIcon.
private Bitmap getLargeNotificationIcon(Bitmap bitmap) {
Resources resources = mContext.getResources();
int height = (int) resources.getDimension(android.R.dimen.notification_large_icon_height);
int width = (int) resources.getDimension(android.R.dimen.notification_large_icon_width);
final OvalShape circle = new OvalShape();
circle.resize(width, height);
final Paint paint = new Paint();
paint.setColor(ApiCompatibilityUtils.getColor(resources, R.color.google_blue_grey_500));
final Bitmap result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(result);
circle.draw(canvas, paint);
float leftOffset = (width - bitmap.getWidth()) / 2f;
float topOffset = (height - bitmap.getHeight()) / 2f;
if (leftOffset >= 0 && topOffset >= 0) {
canvas.drawBitmap(bitmap, leftOffset, topOffset, null);
} else {
// Scale down the icon into the notification icon dimensions
canvas.drawBitmap(bitmap, new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()), new Rect(0, 0, width, height), null);
}
return result;
}
use of android.graphics.drawable.shapes.OvalShape in project FloatingActionButton by Clans.
the class FloatingActionButton method createCircleDrawable.
private Drawable createCircleDrawable(int color) {
CircleDrawable shapeDrawable = new CircleDrawable(new OvalShape());
shapeDrawable.getPaint().setColor(color);
return shapeDrawable;
}
Aggregations