use of android.graphics.drawable.ShapeDrawable in project android-maps-utils by googlemaps.
the class DefaultClusterRenderer method makeClusterBackground.
private LayerDrawable makeClusterBackground() {
mColoredCircleBackground = new ShapeDrawable(new OvalShape());
ShapeDrawable outline = new ShapeDrawable(new OvalShape());
// Transparent white.
outline.getPaint().setColor(0x80ffffff);
LayerDrawable background = new LayerDrawable(new Drawable[] { outline, mColoredCircleBackground });
int strokeWidth = (int) (mDensity * 3);
background.setLayerInset(1, strokeWidth, strokeWidth, strokeWidth, strokeWidth);
return background;
}
use of android.graphics.drawable.ShapeDrawable in project StylishMusicPlayer by ryanhoo.
the class AlbumImageView method init.
private void init() {
mDensity = getContext().getResources().getDisplayMetrics().density;
final int shadowXOffset = (int) (mDensity * X_OFFSET);
final int shadowYOffset = (int) (mDensity * Y_OFFSET);
mShadowRadius = (int) (mDensity * SHADOW_RADIUS);
ShapeDrawable circle;
if (elevationSupported()) {
circle = new ShapeDrawable(new OvalShape());
ViewCompat.setElevation(this, SHADOW_ELEVATION * mDensity);
} 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_ALBUM_COLOR);
setBackground(circle);
mPaint.setAntiAlias(true);
mPaint.setTextAlign(Paint.Align.CENTER);
mPaint.setStyle(Paint.Style.FILL);
mPaint.setColor(DEFAULT_ALBUM_COLOR);
mPaint.setTextSize(ALBUM_CIRCLE_TEXT_SIZE * mDensity);
mRotateAnimator = ObjectAnimator.ofFloat(this, "rotation", 0f, 360f);
mRotateAnimator.setDuration(3600);
mRotateAnimator.setInterpolator(new LinearInterpolator());
mRotateAnimator.setRepeatMode(ValueAnimator.RESTART);
mRotateAnimator.setRepeatCount(ValueAnimator.INFINITE);
}
use of android.graphics.drawable.ShapeDrawable 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.ShapeDrawable in project Euclid by Yalantis.
the class EuclidActivity method buildAvatarCircleOverlay.
/**
* This method creates a view with empty/transparent circle in it's center. This view is used
* to cover the profile avatar.
*
* @return - ShapeDrawable object.
*/
private ShapeDrawable buildAvatarCircleOverlay() {
int radius = 666;
ShapeDrawable overlay = new ShapeDrawable(new RoundRectShape(null, new RectF(sScreenWidth / 2 - dpToPx(getCircleRadiusDp() * 2), sProfileImageHeight / 2 - dpToPx(getCircleRadiusDp() * 2), sScreenWidth / 2 - dpToPx(getCircleRadiusDp() * 2), sProfileImageHeight / 2 - dpToPx(getCircleRadiusDp() * 2)), new float[] { radius, radius, radius, radius, radius, radius, radius, radius }));
overlay.getPaint().setColor(getResources().getColor(R.color.gray));
return overlay;
}
use of android.graphics.drawable.ShapeDrawable 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;
}
Aggregations