Example usage for android.graphics.drawable ShapeDrawable getPaint

List of usage examples for android.graphics.drawable ShapeDrawable getPaint

Introduction

In this page you can find the example usage for android.graphics.drawable ShapeDrawable getPaint.

Prototype

public Paint getPaint() 

Source Link

Document

Returns the Paint used to draw the shape.

Usage

From source file:gov.sfmta.sfpark.AnnotationsOverlay.java

public AnnotationsOverlay(Drawable defaultMarker, Context context) {
    super(boundCenterBottom(defaultMarker));
    mContext = context;//  www .  j  a v  a 2 s.co m

    iconArray = new Drawable[8];

    ShapeDrawable invisible = new ShapeDrawable(new RectShape());
    invisible.getPaint().setColor(0x00000000);

    iconArray[0] = invisible;
    iconArray[1] = mContext.getResources().getDrawable(R.drawable.invalid_garage);
    iconArray[2] = mContext.getResources().getDrawable(R.drawable.garage_availability_high);
    iconArray[3] = mContext.getResources().getDrawable(R.drawable.garage_availability_medium);
    iconArray[4] = mContext.getResources().getDrawable(R.drawable.garage_availability_low);
    iconArray[5] = mContext.getResources().getDrawable(R.drawable.garage_price_low);
    iconArray[6] = mContext.getResources().getDrawable(R.drawable.garage_price_medium);
    iconArray[7] = mContext.getResources().getDrawable(R.drawable.garage_price_high);

    boundCenterBottom(iconArray[0]);
    boundCenterBottom(iconArray[1]);
    boundCenterBottom(iconArray[2]);
    boundCenterBottom(iconArray[3]);
    boundCenterBottom(iconArray[4]);
    boundCenterBottom(iconArray[5]);
    boundCenterBottom(iconArray[6]);
    boundCenterBottom(iconArray[7]);

    action = 0;
    last_action = 0;
}

From source file:com.gj.administrator.gjerp.view.CircleIndicator.java

private void createMovingItem() {
    OvalShape circle = new OvalShape();
    ShapeDrawable drawable = new ShapeDrawable(circle);
    movingItem = new ShapeHolder(drawable);
    Paint paint = drawable.getPaint();
    paint.setColor(mIndicatorSelectedBackground);
    paint.setAntiAlias(true);//from   ww  w .  j a va2  s .com

    switch (mIndicatorMode) {
    case INSIDE:
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_ATOP));
        break;
    case OUTSIDE:
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER));
        break;
    case SOLO:
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
        break;
    }

    movingItem.setPaint(paint);
}

From source file:com.gj.administrator.gjerp.view.CircleIndicator.java

private void createTabItems() {
    for (int i = 0; i < viewPager.getAdapter().getCount(); i++) {
        OvalShape circle = new OvalShape();
        ShapeDrawable drawable = new ShapeDrawable(circle);
        ShapeHolder shapeHolder = new ShapeHolder(drawable);
        Paint paint = drawable.getPaint();
        paint.setColor(mIndicatorBackground);
        paint.setAntiAlias(true);//from   ww w . j a va  2 s. c om
        shapeHolder.setPaint(paint);
        tabItems.add(shapeHolder);
    }
}

From source file:com.blueprint.widget.CircleImageView.java

CircleImageView(Context context, int color) {
    super(context);
    final float density = getContext().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 (elevationSupported()) {
        circle = new ShapeDrawable(new OvalShape());
        ViewCompat.setElevation(this, SHADOW_ELEVATION * density);
    } else {//from ww w. j av  a 2  s .  c  om
        OvalShape oval = new OvalShadow(mShadowRadius);
        circle = new ShapeDrawable(oval);
        setLayerType(View.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);
    ViewCompat.setBackground(this, circle);
}

From source file:br.com.leoleal.swipetorefresh.CircleImageView.java

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());
        setElevation(SHADOW_ELEVATION * density);
    } else {/*from  w w  w .  j a  va  2  s  .c o  m*/
        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);
}

From source file:com.suyou.media.ui.widget.refresh.CircleImageView.java

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 {/* w ww  .j av  a2  s.c o  m*/
        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);
}

From source file:com.congxiaoyao.xber_admin.widget.CircleImageView.java

CircleImageView(Context context, int color) {
    super(context);
    final float density = getContext().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 (elevationSupported()) {
        circle = new ShapeDrawable(new OvalShape());
        ViewCompat.setElevation(this, SHADOW_ELEVATION * density);
    } else {//from ww w .ja v a  2  s.c o  m
        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().setColor(color);
    ViewCompat.setBackground(this, circle);
}

From source file:org.alex.refreshlayout.view.CircleImageView.java

public CircleImageView(Context context, int color) {
    super(context);
    final float density = getContext().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 (elevationSupported()) {
        circle = new ShapeDrawable(new OvalShape());
        ViewCompat.setElevation(this, SHADOW_ELEVATION * density);
    } else {/*from  w ww  . j a va2 s . co  m*/
        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().setColor(color);
    ViewCompat.setBackground(this, circle);
}

From source file:anabolicandroids.chanobol.util.swipebottom.CircleImageView.java

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 {//from   ww  w .  jav a 2s. c o m
        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 = (int) mShadowRadius;
        // set padding so the inner image sits correctly within the shadow.
        setPadding(padding, padding, padding, padding);
    }
    circle.getPaint().setColor(color);
    setBackgroundDrawable(circle);
}

From source file:com.cheng.animationstudy.customview.googleimitatecode.SwipyCircleImageView.java

public SwipyCircleImageView(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 {//from w  w  w . j  av a2  s . co m
        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 = (int) mShadowRadius;
        // set padding so the inner image sits correctly within the shadow.
        setPadding(padding, padding, padding, padding);
    }
    circle.getPaint().setColor(color);
    setBackgroundDrawable(circle);
}