@Override public IBuilder round() { this.shape = new OvalShape(); return this; }
@Override public void onBindViewHolder(@NonNull ItemViewHolder itemViewHolder, int i) { final ItemData data = mDataSet.get(i); ShapeDrawable drawable = new ShapeDrawable(new OvalShape()); drawable.getPaint().setColor(data.color); itemViewHolder.icon.setBackground(drawable); itemViewHolder.icon.setImageResource(data.icon); itemViewHolder.title.setText(data.title); itemViewHolder.subTitle.setText(dateFormat.format(data.time)); }
private static Drawable generateCircleDrawable(final int color) { ShapeDrawable drawable = new ShapeDrawable(new OvalShape()); drawable.getPaint().setColor(color); return drawable; }
static ShapeDrawable getCircle(ComponentContext c) { final ShapeDrawable oval = new ShapeDrawable(new OvalShape()); oval.getPaint().setColor(Color.LTGRAY); return oval; }
private Drawable createCircleDrawable(int color) { CircleDrawable shapeDrawable = new CircleDrawable(new OvalShape()); shapeDrawable.getPaint().setColor(color); return shapeDrawable; }
private LayerDrawable makeClusterBackground() { mColoredCircleBackground = new ShapeDrawable(new OvalShape()); ShapeDrawable outline = new ShapeDrawable(new OvalShape()); outline.getPaint().setColor(0x80ffffff); // Transparent white. LayerDrawable background = new LayerDrawable(new Drawable[]{outline, mColoredCircleBackground}); int strokeWidth = (int) (mDensity * 3); background.setLayerInset(1, strokeWidth, strokeWidth, strokeWidth, strokeWidth); return background; }
/** * Creates a new circle for the Badge background. * * @param size the width and height for the circle * @param color the activeIconColor for the circle * @return a nice and adorable circle. */ @NonNull static ShapeDrawable make(@IntRange(from = 0) int size, @ColorInt int color) { ShapeDrawable indicator = new ShapeDrawable(new OvalShape()); indicator.setIntrinsicWidth(size); indicator.setIntrinsicHeight(size); indicator.getPaint().setColor(color); return indicator; } }
@SuppressWarnings("deprecation") public CircleImageView(Context context, int color) { super(context); final View thisView = this; final float density = thisView.getResources().getDisplayMetrics().density; final int shadowYOffset = (int) (density * Y_OFFSET); final int shadowXOffset = (int) (density * X_OFFSET); mShadowRadius = (int) (density * SHADOW_RADIUS); ShapeDrawable circle; if (android.os.Build.VERSION.SDK_INT >= 21) { circle = new ShapeDrawable(new OvalShape()); thisView.setElevation(SHADOW_ELEVATION * density); } else { OvalShape oval = new OvalShadow(mShadowRadius); circle = new ShapeDrawable(oval); thisView.setLayerType(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. thisView.setPadding(padding, padding, padding, padding); } circle.getPaint().setColor(color); if (Build.VERSION.SDK_INT >= 16) { thisView.setBackground(circle); } else { thisView.setBackgroundDrawable(circle); } }
int minRadius = Math.min(calculateMinRadius(shrinkingView), calculateMinRadius(endView)); ShapeDrawable circleBackground = new ShapeDrawable(new OvalShape()); circleBackground.getPaint().setColor(mColor); final View circleView = addViewToOverlay(sceneRoot, minRadius * 2, minRadius * 2,
public CircleImageView(Context context, int color, final float radius) { super(context); final float density = getContext().getResources().getDisplayMetrics().density; final int diameter = (int) (radius * density * 2); final int shadowYOffset = (int) (density * Y_OFFSET); final int shadowXOffset = (int) (density * X_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, diameter); 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().setColor(color); setBackgroundDrawable(circle); }
private void initBackground(float radius) { final float density = getContext().getResources().getDisplayMetrics().density; final int diameter = (int) (radius * density * 2); final int shadowYOffset = (int) (density * Y_OFFSET); final int shadowXOffset = (int) (density * X_OFFSET); final int color = Color.parseColor("#FFFAFAFA"); 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, diameter); 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().setColor(color); setBackgroundDrawable(circle); }
mBgCircle = new ShapeDrawable(new OvalShape()); ViewCompat.setElevation(this, SHADOW_ELEVATION * density); } else {
mBgCircle = new ShapeDrawable(new OvalShape()); ViewCompat.setElevation(this, SHADOW_ELEVATION * density); } else {
private void buildColorPickerView(View view, int colorCode) { view.setVisibility(View.VISIBLE); ShapeDrawable biggerCircle = new ShapeDrawable(new OvalShape()); biggerCircle.setIntrinsicHeight(20); biggerCircle.setIntrinsicWidth(20); biggerCircle.setBounds(new Rect(0, 0, 20, 20)); biggerCircle.getPaint().setColor(colorCode); ShapeDrawable smallerCircle = new ShapeDrawable(new OvalShape()); smallerCircle.setIntrinsicHeight(5); smallerCircle.setIntrinsicWidth(5); smallerCircle.setBounds(new Rect(0, 0, 5, 5)); smallerCircle.getPaint().setColor(Color.WHITE); smallerCircle.setPadding(10, 10, 10, 10); Drawable[] drawables = {smallerCircle, biggerCircle}; LayerDrawable layerDrawable = new LayerDrawable(drawables); view.setBackgroundDrawable(layerDrawable); }
public CircleImageView(Context context, int color, final float radius) { super(context); final float density = getContext().getResources().getDisplayMetrics().density; final int diameter = (int) (radius * density * 2); final int shadowYOffset = (int) (density * Y_OFFSET); final int shadowXOffset = (int) (density * X_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, diameter); 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().setColor(color); setBackgroundDrawable(circle); }
/** * * @param isDisplayInToolbarMenu */ public void setHighLightMode(boolean isDisplayInToolbarMenu){ isHighLightMode = true; ViewGroup.LayoutParams params = getLayoutParams(); params.width = dp2px(getContext(), 8); params.height = params.width; if(isDisplayInToolbarMenu && params instanceof FrameLayout.LayoutParams){ ((FrameLayout.LayoutParams)params).topMargin=dp2px(getContext(), 8); ((FrameLayout.LayoutParams)params).rightMargin=dp2px(getContext(), 8); } setLayoutParams(params); ShapeDrawable drawable = new ShapeDrawable(new OvalShape()); ViewCompat.setLayerType(this, ViewCompat.LAYER_TYPE_SOFTWARE, drawable.getPaint()); drawable.getPaint().setColor(backgroundColor); drawable.getPaint().setAntiAlias(true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { setBackground(drawable); } else { setBackgroundDrawable(drawable); } setText(""); setVisibility(View.VISIBLE); }
@Override public IBuilder round() { this.shape = new OvalShape(); return this; }
mBgCircle = new ShapeDrawable(new OvalShape()); ViewCompat.setElevation(this, SHADOW_ELEVATION * density); } else {
mBgCircle = new ShapeDrawable(new OvalShape()); ViewCompat.setElevation(this, SHADOW_ELEVATION * density); } else {
private Drawable createOvalDrawable(int color) { ShapeDrawable shapeDrawable = new ShapeDrawable(new OvalShape()); shapeDrawable.getPaint().setColor(color); return shapeDrawable; } }