@Override public void surfaceDestroyed(SurfaceHolder holder) { mHandler.removeCallbacks(mDrawFrames); if (mThread != null) { mThread.alive = false; } }
@Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { mHandler.removeCallbacks(mDrawFrames); mWidth = width; mHeight = height; mbgIn = null; calculatedItemSpacing(credits, mHeight); mThread.alive = false; while (mThread.isAlive()) { try { Thread.sleep(5); } catch (InterruptedException e) { e.printStackTrace(); } } mThread = new CreditsThread(); mThread.start(); }
private synchronized void drawFrame() { if (mThread != null) { mThread.cont = false; } Canvas canvas = null; try { canvas = mHolder.lockCanvas(null); if (canvas != null) { drawBackground(canvas); for (CreditsItem item : credits) { item.draw(canvas); } } } finally { if (canvas != null) { mHolder.unlockCanvasAndPost(canvas); } } }
@Override public void surfaceCreated(SurfaceHolder holder) { mThread = new CreditsThread(); mThread.start(); }