StyleTemplate.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:grouptuity 作者:
protected void preprocess()
{
    if(!(topLeftRadius==topRightRadius && bottomLeftRadius==bottomRightRadius && topLeftRadius==bottomLeftRadius))
    {
        shapeDrawable = new ShapeDrawable(new RoundRectShape(new float[]{topLeftRadius,topLeftRadius,topRightRadius,topRightRadius,bottomLeftRadius,bottomLeftRadius,bottomRightRadius,bottomRightRadius},null,null));
        shapeDrawable.setShaderFactory(new ShaderFactory(){public Shader resize(int width, int height){return new LinearGradient(0,0,0,height,primaryColor,secondaryColor,Shader.TileMode.CLAMP);}});
        innerPaint = null;
        borderPaint = null;
    }
    else
    {
        shapeDrawable = null;

        borderPaint = new Paint();
        borderPaint.setAntiAlias(true);
        borderPaint.setStyle(Style.STROKE);
        borderPaint.setStrokeWidth(borderThickness);
        borderPaint.setColor((borderThickness==0)?Color.TRANSPARENT:borderColor);

        innerPaint = new Paint();
        innerPaint.setAntiAlias(true);
        if(!innerGradient)
            innerPaint.setColor(primaryColor);

        if(shadowColor!=0)
        {
            innerPaint.setShadowLayer(shadowRadius,shadowDX,shadowDY,shadowColor);
        }

        if(!circularSides && topLeftRadius > 0)
        {
            leftPadding = (int)(topLeftRadius*0.75);
            topPadding = (int)(topLeftRadius*0.75);
            rightPadding = (int)(topLeftRadius*0.75);
            bottomPadding = (int)(topLeftRadius*0.75);
        }
    }

    leftPadding += leftContraction;
    topPadding += topContraction;
    rightPadding += rightContraction;
    bottomPadding += bottomContraction;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号