public void run() { if (!mBoard.gameOver()) ++mGameData.seconds_elapsed; int seconds = (int) (mGameData.seconds_elapsed); int minutes = (int) (seconds / 60); seconds -= 60 * minutes; int hours = (int) (minutes / 60); minutes -= 60 * hours; int days = (int) (hours / 24); hours -= 24 * days; String s = ""; if (days > 0) s += String.format("%dd ", days); if (hours > 0) s += String.format("%dh ", hours); s += String.format("%d:%02d", minutes, seconds); if (!mBoardData.challenge_mode && mGameData.mistake_count > 0) s += String.format( ", %d %s", mGameData.mistake_count, mGameData.mistake_count > 1 ? "misses" : "miss"); mTimeLabel.setText(s); if (mBoard.gameOver()) { mGameData.seconds_elapsed = -1; mGameData.mistake_count = 0; } else mTimerHandler.postDelayed(this, 1000); }
public void run() { if (mMovePos.equals(mDownPos)) { if (!mComputeScroll && mBoard.toggleLock(mDownPos)) { handlePendingFeedbacks(); mBoard.setCursor(mDownPos.i, mDownPos.j); invalidate(); } } mDownPos.reset(); }