@@ -0,0 +1,2765 @@
+package com.annimon.jecp.android;%0D%0A%0D%0Aimport android.graphics.Canvas;%0D%0Aimport android.graphics.Paint;%0D%0Aimport android.view.SurfaceHolder;%0D%0Aimport android.view.SurfaceView;%0D%0A%0D%0A/**%0D%0A *%0D%0A * @author aNNiMON%0D%0A */%0D%0Apublic class JecpSurfaceView extends SurfaceView implements SurfaceHolder.Callback %7B%0D%0A%0D%0A    private final JecpMainActivity mActivity;%0D%0A    private final JecpGraphics mGraphics;%0D%0A%0D%0A    private final Paint mPaint;%0D%0A    private final SurfaceHolder mSurfaceHolder;%0D%0A    private final DrawingThread mThread;%0D%0A    %0D%0A    private boolean mIsInit;%0D%0A%0D%0A    public JecpSurfaceView(JecpMainActivity activity) %7B%0D%0A        super(activity);%0D%0A        mActivity = activity;%0D%0A        %0D%0A        mIsInit = false;%0D%0A%0D%0A        mSurfaceHolder = getHolder();%0D%0A        mSurfaceHolder.addCallback(JecpSurfaceView.this);%0D%0A        %0D%0A        mThread = new DrawingThread();%0D%0A        mThread.mKeepRunning = true;%0D%0A        %0D%0A        mPaint = new Paint();%0D%0A        mGraphics = new JecpGraphics(mPaint);%0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    public void surfaceCreated(SurfaceHolder holder) %7B%0D%0A        mThread.start();%0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    public void surfaceChanged(SurfaceHolder holder, int format, int newW, int newH) %7B%0D%0A        %0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    public void surfaceDestroyed(SurfaceHolder holder) %7B%0D%0A        mThread.mKeepRunning = false;%0D%0A        boolean retry = true;%0D%0A        while (retry) %7B%0D%0A            try %7B%0D%0A                mThread.join();%0D%0A                retry = false;%0D%0A            %7D catch (InterruptedException e) %7B %7D%0D%0A        %7D%0D%0A    %7D%0D%0A    %0D%0A    @Override%0D%0A    protected void onDraw(Canvas canvas) %7B%0D%0A        if (!mIsInit) %7B%0D%0A            mActivity.onStartApp(canvas.getWidth(), canvas.getHeight());%0D%0A            mIsInit = true;%0D%0A        %7D%0D%0A        %0D%0A        mGraphics.setCanvas(canvas);%0D%0A        mActivity.onPaint(mGraphics);%0D%0A    %7D%0D%0A%0D%0A    private class DrawingThread extends Thread %7B%0D%0A%0D%0A        private boolean mKeepRunning = true;%0D%0A%0D%0A        @Override%0D%0A        public void run() %7B%0D%0A            Canvas c;%0D%0A%0D%0A            while (mKeepRunning) %7B%0D%0A                // update();%0D%0A                c = null;%0D%0A%0D%0A                try %7B%0D%0A                    c = mSurfaceHolder.lockCanvas();%0D%0A                    if (c != null) %7B%0D%0A                        synchronized (mSurfaceHolder) %7B%0D%0A                            onDraw(c);%0D%0A                        %7D%0D%0A                    %7D%0D%0A                %7D finally %7B%0D%0A                    if (c != null) %7B%0D%0A                        mSurfaceHolder.unlockCanvasAndPost(c);%0D%0A                    %7D%0D%0A                %7D%0D%0A%0D%0A                try %7B%0D%0A                    Thread.sleep(5L);%0D%0A                %7D catch (InterruptedException ex) %7B%0D%0A                    Thread.currentThread().interrupt();%0D%0A                %7D%0D%0A            %7D%0D%0A        %7D%0D%0A    %7D%0D%0A%7D%0D%0A

Add SurfaceView