@Override public void onTouchEvent(MotionEvent event) { backgroundRenderer.updateRect(); // if (touchEnabled) { // // float x = event.getX(); // float y = event.getY(); // SurfaceHolder holder = getSurfaceHolder(); // Canvas canvas = null; // try { // canvas = holder.lockCanvas(); // if (canvas != null) { // // canvas.drawColor(Color.BLACK); // // circles.clear(); // // circles.add(new MyPoint(String.valueOf(circles.size() // // + 1), x, y)); // // drawCircles(canvas, circles); // // } // } finally { // if (canvas != null) // holder.unlockCanvasAndPost(canvas); // } // super.onTouchEvent(event); // } }
private void draw() { mStartTime = System.currentTimeMillis(); SurfaceHolder holder = getSurfaceHolder(); Canvas canvas = null; try { canvas = holder.lockCanvas(); if (canvas != null) { backgroundRenderer.doDraw(canvas); // circularClockRenderer.doDraw(canvas); } } finally { if (canvas != null) holder.unlockCanvasAndPost(canvas); } mElapsed = System.currentTimeMillis() - mStartTime; mStartTime = System.currentTimeMillis(); handler.removeCallbacks(drawRunner); if (visible) { handler.postDelayed(drawRunner, 100); } }
@Override public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int height) { // circularClockRenderer.updateRect(width, height); backgroundRenderer.updateRect(width, height); super.onSurfaceChanged(holder, format, width, height); }