use of android.graphics.drawable.ShapeDrawable in project FastAdapter by mikepenz.
the class FastAdapterUIUtils method getRippleMask.
/**
* helper to create an ripple mask with the given color and radius
*
* @param color the color
* @param radius the radius
* @return the mask drawable
*/
private static Drawable getRippleMask(int color, int radius) {
float[] outerRadius = new float[8];
Arrays.fill(outerRadius, radius);
RoundRectShape r = new RoundRectShape(outerRadius, null, null);
ShapeDrawable shapeDrawable = new ShapeDrawable(r);
shapeDrawable.getPaint().setColor(color);
return shapeDrawable;
}
use of android.graphics.drawable.ShapeDrawable in project actor-platform by actorapp.
the class ShareMenuButtonFactory method get.
public static StateListDrawable get(int color, Context context) {
ShapeDrawable bg = new ShapeDrawable(new OvalShape());
int padding = Screen.dp(5);
bg.getPaint().setColor(color);
ShapeDrawable bgPressed = new ShapeDrawable(new OvalShape());
bgPressed.getPaint().setColor(ActorStyle.getDarkenArgb(color, 0.95));
StateListDrawable states = new StateListDrawable();
states.addState(new int[] { android.R.attr.state_pressed }, new InsetDrawable(bgPressed, padding));
states.addState(StateSet.WILD_CARD, new InsetDrawable(bg, padding));
return states;
}
use of android.graphics.drawable.ShapeDrawable in project android_frameworks_base by ParanoidAndroid.
the class PlaybackGraphs method drawVerticalShiftedShapes.
public void drawVerticalShiftedShapes(Canvas canvas, ArrayList<ShapeDrawable> shapes) {
// Shapes drawn here are drawn relative to the viewRect
Rect viewRect = shapes.get(shapes.size() - 1).getBounds();
canvas.translate(0, 5 * PlaybackView.TILE_SCALE - viewRect.top);
for (ShapeDrawable shape : mShapes) {
shape.draw(canvas);
}
for (ShapeDrawable shape : shapes) {
shape.draw(canvas);
}
}
use of android.graphics.drawable.ShapeDrawable in project AndroidDevelop by 7449.
the class BadgeView method getDefaultBackground.
private ShapeDrawable getDefaultBackground() {
int r = dipToPixels(DEFAULT_CORNER_RADIUS_DIP);
float[] outerR = new float[] { r, r, r, r, r, r, r, r };
RoundRectShape rr = new RoundRectShape(outerR, null, null);
ShapeDrawable drawable = new ShapeDrawable(rr);
drawable.getPaint().setColor(badgeColor);
return drawable;
}
use of android.graphics.drawable.ShapeDrawable in project UltimateAndroid by cymcsg.
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