Search in sources :

Example 36 with ShapeDrawable

use of android.graphics.drawable.ShapeDrawable in project material-hijri-calendarview by eltohamy.

the class DayView method generateCircleDrawable.

private static Drawable generateCircleDrawable(final int color) {
    ShapeDrawable drawable = new ShapeDrawable(new OvalShape());
    drawable.setShaderFactory(new ShapeDrawable.ShaderFactory() {

        @Override
        public Shader resize(int width, int height) {
            return new LinearGradient(0, 0, 0, 0, color, color, Shader.TileMode.REPEAT);
        }
    });
    return drawable;
}
Also used : LinearGradient(android.graphics.LinearGradient) ShapeDrawable(android.graphics.drawable.ShapeDrawable) OvalShape(android.graphics.drawable.shapes.OvalShape) Shader(android.graphics.Shader) SuppressLint(android.annotation.SuppressLint)

Example 37 with ShapeDrawable

use of android.graphics.drawable.ShapeDrawable in project wigle-wifi-wardriving by wiglenet.

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;
}
Also used : LayerDrawable(android.graphics.drawable.LayerDrawable) ShapeDrawable(android.graphics.drawable.ShapeDrawable) OvalShape(android.graphics.drawable.shapes.OvalShape) Point(com.google.maps.android.geometry.Point) SuppressLint(android.annotation.SuppressLint)

Example 38 with ShapeDrawable

use of android.graphics.drawable.ShapeDrawable in project android by testpress.

the class ExploreSpinnerAdapter method setUpNormalDropdownView.

private void setUpNormalDropdownView(int position, TextView textView) {
    textView.setText(getTitle(position));
    ShapeDrawable colorDrawable = (ShapeDrawable) textView.getCompoundDrawables()[2];
    int color = getColor(position);
    if (color == 0) {
        if (colorDrawable != null) {
            textView.setCompoundDrawables(null, null, null, null);
        }
    } else {
        if (mDotSize == 0) {
            mDotSize = resources.getDimensionPixelSize(R.dimen.tag_color_dot_size);
        }
        if (colorDrawable == null) {
            colorDrawable = new ShapeDrawable(new OvalShape());
            colorDrawable.setIntrinsicWidth(mDotSize);
            colorDrawable.setIntrinsicHeight(mDotSize);
            colorDrawable.getPaint().setStyle(Paint.Style.FILL);
            textView.setCompoundDrawablesWithIntrinsicBounds(null, null, colorDrawable, null);
        }
        colorDrawable.getPaint().setColor(color);
    }
}
Also used : ShapeDrawable(android.graphics.drawable.ShapeDrawable) OvalShape(android.graphics.drawable.shapes.OvalShape) Paint(android.graphics.Paint)

Example 39 with ShapeDrawable

use of android.graphics.drawable.ShapeDrawable in project Osmand by osmandapp.

the class WaypointDialogHelper method getCustomDividers.

private List<Drawable> getCustomDividers(Context ctx, List<Object> points, boolean nightMode) {
    int color = ContextCompat.getColor(ctx, nightMode ? R.color.dashboard_divider_dark : R.color.dashboard_divider_light);
    Shape fullDividerShape = new ListDividerShape(color, 0);
    Shape halfDividerShape = new ListDividerShape(color, AndroidUtils.dpToPx(ctx, 56f));
    Shape headerDividerShape = new ListDividerShape(color, AndroidUtils.dpToPx(ctx, 16f));
    final ShapeDrawable fullDivider = new ShapeDrawable(fullDividerShape);
    final ShapeDrawable halfDivider = new ShapeDrawable(halfDividerShape);
    final ShapeDrawable headerDivider = new ShapeDrawable(headerDividerShape);
    int divHeight = AndroidUtils.dpToPx(ctx, 1f);
    fullDivider.setIntrinsicHeight(divHeight);
    halfDivider.setIntrinsicHeight(divHeight);
    headerDivider.setIntrinsicHeight(divHeight);
    List<Drawable> res = new ArrayList<>();
    for (int i = 0; i < points.size(); i++) {
        Object obj = points.get(i);
        Object objNext = i + 1 < points.size() ? points.get(i + 1) : null;
        if (objNext == null) {
            break;
        }
        boolean labelView = (obj instanceof Integer);
        boolean bottomDividerViewNext = (objNext instanceof Boolean) && !((Boolean) objNext);
        boolean locationPoint = (obj instanceof LocationPointWrapper);
        boolean locationPointNext = (objNext instanceof LocationPointWrapper);
        Drawable d = null;
        if (locationPointNext) {
            d = locationPoint ? halfDivider : fullDivider;
        } else if (objNext instanceof RadiusItem && labelView) {
            d = headerDivider;
        } else if (locationPoint && !bottomDividerViewNext) {
            d = fullDivider;
        }
        res.add(d);
    }
    return res;
}
Also used : ListDividerShape(net.osmand.plus.views.controls.ListDividerShape) Shape(android.graphics.drawable.shapes.Shape) Drawable(android.graphics.drawable.Drawable) ShapeDrawable(android.graphics.drawable.ShapeDrawable) ArrayList(java.util.ArrayList) LocationPointWrapper(net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper) ListDividerShape(net.osmand.plus.views.controls.ListDividerShape) TargetPoint(net.osmand.plus.TargetPointsHelper.TargetPoint) LocationPoint(net.osmand.data.LocationPoint) SuppressLint(android.annotation.SuppressLint) FavouritePoint(net.osmand.data.FavouritePoint) ShapeDrawable(android.graphics.drawable.ShapeDrawable)

Example 40 with ShapeDrawable

use of android.graphics.drawable.ShapeDrawable in project android_packages_apps_OmniGears by omnirom.

the class ColorSelectPreference method createRectShape.

private static ShapeDrawable createRectShape(int width, int height, int color) {
    ShapeDrawable shape = new ShapeDrawable(new RectShape());
    shape.setIntrinsicHeight(height);
    shape.setIntrinsicWidth(width);
    shape.getPaint().setColor(color);
    return shape;
}
Also used : RectShape(android.graphics.drawable.shapes.RectShape) ShapeDrawable(android.graphics.drawable.ShapeDrawable)

Aggregations

ShapeDrawable (android.graphics.drawable.ShapeDrawable)131 OvalShape (android.graphics.drawable.shapes.OvalShape)64 Paint (android.graphics.Paint)38 Drawable (android.graphics.drawable.Drawable)30 LayerDrawable (android.graphics.drawable.LayerDrawable)28 SuppressLint (android.annotation.SuppressLint)20 RoundRectShape (android.graphics.drawable.shapes.RoundRectShape)20 StateListDrawable (android.graphics.drawable.StateListDrawable)18 ClipDrawable (android.graphics.drawable.ClipDrawable)17 Bitmap (android.graphics.Bitmap)16 BitmapDrawable (android.graphics.drawable.BitmapDrawable)16 BitmapShader (android.graphics.BitmapShader)15 AnimationDrawable (android.graphics.drawable.AnimationDrawable)14 ColorDrawable (android.graphics.drawable.ColorDrawable)11 RectShape (android.graphics.drawable.shapes.RectShape)10 Resources (android.content.res.Resources)8 Shape (android.graphics.drawable.shapes.Shape)8 Canvas (android.graphics.Canvas)6 Shader (android.graphics.Shader)6 ImageView (android.widget.ImageView)6