@@ -0,0 +1,2577 @@
+package com.android.yj.viewlib;%0A%0Aimport android.content.Context;%0Aimport android.graphics.Canvas;%0Aimport android.graphics.Color;%0Aimport android.graphics.Paint;%0Aimport android.graphics.RectF;%0Aimport android.util.AttributeSet;%0Aimport android.view.View;%0A%0A/**%0A * Created by bertyj on 2017/6/2.%0A */%0A%0Apublic class SmileyView extends View %7B%0A    private Paint mCirclePaint;%0A    private Paint mEyeAndMouthPaint;%0A%0A    private float mCenterX;%0A    private float mCenterY;%0A    private float mRadius;%0A    private RectF mArcBounds = new RectF();%0A%0A    public SmileyView(Context context) %7B%0A        this(context, null);%0A    %7D%0A%0A    public SmileyView(Context context, AttributeSet attrs) %7B%0A        this(context, attrs, 0);%0A    %7D%0A%0A    public SmileyView(Context context, AttributeSet attrs, int defStyleAttr) %7B%0A        super(context, attrs, defStyleAttr);%0A        initPaints();%0A    %7D%0A%0A    @Override%0A    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) %7B%0A        int w = MeasureSpec.getSize(widthMeasureSpec);%0A        int h = MeasureSpec.getSize(heightMeasureSpec);%0A%0A        int size = Math.min(w, h);%0A        setMeasuredDimension(size, size);%0A    %7D%0A%0A    @Override%0A    protected void onDraw(Canvas canvas) %7B%0A        // draw face%0A        canvas.drawCircle(mCenterX, mCenterY, mRadius, mCirclePaint);%0A        // draw eyes%0A        float eyeRadius = mRadius / 5f;%0A        float eyeOffsetX = mRadius / 3f;%0A        float eyeOffsetY = mRadius / 3f;%0A        canvas.drawCircle(mCenterX - eyeOffsetX, mCenterY - eyeOffsetY, eyeRadius, mEyeAndMouthPaint);%0A        canvas.drawCircle(mCenterX + eyeOffsetX, mCenterY - eyeOffsetY, eyeRadius, mEyeAndMouthPaint);%0A        // draw mouth%0A        float mouthInset = mRadius / 3f;%0A        mArcBounds.set(mouthInset, mouthInset, mRadius * 2 - mouthInset, mRadius * 2 - mouthInset);%0A        canvas.drawArc(mArcBounds, 45f, 90f, false, mEyeAndMouthPaint);%0A    %7D%0A%0A    @Override%0A    protected void onSizeChanged(int w, int h, int oldw, int oldh) %7B%0A        mCenterX = w / 2f;%0A        mCenterY = h / 2f;%0A        mRadius = Math.min(w, h) / 2f;%0A    %7D%0A%0A    private void initPaints() %7B%0A        mCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG);%0A        mCirclePaint.setStyle(Paint.Style.FILL);%0A        mCirclePaint.setColor(Color.YELLOW);%0A        mEyeAndMouthPaint = new Paint(Paint.ANTI_ALIAS_FLAG);%0A        mEyeAndMouthPaint.setStyle(Paint.Style.STROKE);%0A        mEyeAndMouthPaint.setStrokeWidth(16 * getResources().getDisplayMetrics().density);%0A        mEyeAndMouthPaint.setStrokeCap(Paint.Cap.ROUND);%0A        mEyeAndMouthPaint.setColor(Color.BLACK);%0A    %7D%0A%0A%7D%0A

Add smiley view.