@@ -0,0 +1,2691 @@
+package com.innofang.viewsdemo.views;%0A%0Aimport android.content.Context;%0Aimport android.graphics.Canvas;%0Aimport android.graphics.Color;%0Aimport android.graphics.Paint;%0Aimport android.util.AttributeSet;%0Aimport android.view.SurfaceHolder;%0Aimport android.view.SurfaceView;%0A%0A/**%0A * Author: Inno Fang%0A * Time: 2017/4/18 20:19%0A * Description:%0A */%0A%0A%0Apublic class ClockView extends SurfaceView%0A        implements SurfaceHolder.Callback, Runnable %7B%0A%0A    private Paint mArcPaint = new Paint();%0A    private Paint mTextPaint = new Paint();%0A    private int mHeight, mWidth;%0A    private boolean mDrawing = true;%0A    private SurfaceHolder mSurfaceHolder;%0A    private float mDailRadius = 200F;%0A    private float len = 10F;%0A%0A    public ClockView(Context context) %7B%0A        this(context, null);%0A    %7D%0A%0A    public ClockView(Context context, AttributeSet attrs) %7B%0A        super(context, attrs);%0A        mArcPaint.setStrokeWidth(5);%0A        mArcPaint.setStyle(Paint.Style.STROKE);%0A        mArcPaint.setAntiAlias(true);%0A        mArcPaint.setColor(Color.BLACK);%0A        mTextPaint.setTextSize(10);%0A        mSurfaceHolder = getHolder();%0A    %7D%0A%0A    @Override%0A    protected void onSizeChanged(int w, int h, int oldw, int oldh) %7B%0A        super.onSizeChanged(w, h, oldw, oldh);%0A        mHeight = h / 2;%0A        mWidth = w / 2;%0A    %7D%0A%0A    @Override%0A    public void surfaceCreated(SurfaceHolder holder) %7B%0A        mDrawing = true;%0A        new Thread(this).start();%0A    %7D%0A%0A    @Override%0A    public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) %7B%0A%0A    %7D%0A%0A    @Override%0A    public void surfaceDestroyed(SurfaceHolder holder) %7B%0A        mDrawing = false;%0A    %7D%0A%0A    @Override%0A    protected void onDraw(Canvas canvas) %7B%0A        super.onDraw(canvas);%0A        canvas.translate(mWidth / 2, mHeight / 2);%0A        canvas.scale(1, -1);%0A        drawDial(canvas);%0A    %7D%0A%0A    @Override%0A    public void run() %7B%0A        while (mDrawing) %7B%0A            Canvas canvas = mSurfaceHolder.lockCanvas();%0A%0A            mSurfaceHolder.unlockCanvasAndPost(canvas);%0A        %7D%0A    %7D%0A%0A    private void drawDial(Canvas canvas) %7B%0A        canvas.save();%0A        int timeIndex = 1;%0A        String timeText;%0A        for (int i = 0; i %3C 360; i += 10) %7B%0A            if (i %25 50 == 0) %7B%0A                if (i == 0) %7B%0A                    timeText = %2212%22;%0A                %7D else %7B%0A                    timeText = %22%22 + timeIndex++;%0A                %7D%0A                mArcPaint.setColor(Color.RED);%0A                mTextPaint.setColor(Color.BLACK);%0A                canvas.drawLine(0, mDailRadius, 0, mDailRadius + 2 * len, mArcPaint);%0A//                canvas.drawText(timeText, );%0A            %7D%0A        %7D%0A        canvas.restore();%0A    %7D%0A%0A%7D%0A

update ViewsDemo