@Test public void shouldDisplayDrawIfNoOneWins(){ int[] XIds = new int[]{1,2,4,5,9}; int[] OIds = new int[]{3,6,7,8}; activity.refreshUI(true, null, GameSymbol.O, XIds, OIds); Assert.assertEquals("DRAW!", activity.messageTurnIndicatorValue.getText()); }
protected void refreshUI(boolean gameOverNoWinner, GameWinPattern gameWinPattern, GameSymbol winningSymbol, int[] selectedXBoxIds, int[] selectedOBoxIds) { if(gameWinPattern != null){ hapticFeedbackHelper.vibrate(hapticFeedbackHelper.getWinningPattern(toeGame.symbolIsAndroid(winningSymbol)), HapticFeedbackHelper.VIBE_PATTERN_NO_REPEAT); disableAllBoxes(); highlightWinningPattern(gameWinPattern); getMessageTurnIndicator.setText(getString(R.string.game_message_over)); messageTurnIndicatorValue.setText(getString(R.string.game_message_wins, winningSymbol.getValue())); } else if(gameOverNoWinner){ getMessageTurnIndicator.setText(getString(R.string.game_message_over)); messageTurnIndicatorValue.setText(getString(R.string.game_message_draw)); } else{ getMessageTurnIndicator.setText(getString(R.string.message_turn_indicator)); messageTurnIndicatorValue.setText(toeGame.getTurn().getValue()); startTurn(selectedXBoxIds, selectedOBoxIds); } }
GameActivity extends RoboFragmentActivity implements LoaderManager.LoaderCallbacks<Cursor> { protected void refreshUI(boolean gameOverNoWinner, GameWinPattern gameWinPattern, GameSymbol winningSymbol, int[] selectedXBoxIds, int[] selectedOBoxIds) { if(gameWinPattern != null){ hapticFeedbackHelper.vibrate(hapticFeedbackHelper.getWinningPattern(toeGame.symbolIsAndroid(winningSymbol)), HapticFeedbackHelper.VIBE_PATTERN_NO_REPEAT); disableAllBoxes(); highlightWinningPattern(gameWinPattern); getMessageTurnIndicator.setText(getString(R.string.game_message_over)); messageTurnIndicatorValue.setText(getString(R.string.game_message_wins, winningSymbol.getValue())); } else if(gameOverNoWinner){ getMessageTurnIndicator.setText(getString(R.string.game_message_over)); messageTurnIndicatorValue.setText(getString(R.string.game_message_draw)); } else{ getMessageTurnIndicator.setText(getString(R.string.message_turn_indicator)); messageTurnIndicatorValue.setText(toeGame.getTurn().getValue()); startTurn(selectedXBoxIds, selectedOBoxIds); } } }
GameActivity extends RoboFragmentActivity implements LoaderManager.LoaderCallbacks<Cursor> { protected void refreshUI(boolean gameOverNoWinner, GameWinPattern gameWinPattern, GameSymbol winningSymbol, int[] selectedXBoxIds, int[] selectedOBoxIds) { if(gameWinPattern != null){ hapticFeedbackHelper.vibrate(hapticFeedbackHelper.getWinningPattern(toeGame.symbolIsAndroid(winningSymbol)), HapticFeedbackHelper.VIBE_PATTERN_NO_REPEAT); disableAllBoxes(); highlightWinningPattern(gameWinPattern); getMessageTurnIndicator.setText(getString(R.string.game_message_over)); messageTurnIndicatorValue.setText(getString(R.string.game_message_wins, winningSymbol.getValue())); } else if(gameOverNoWinner){ getMessageTurnIndicator.setText(getString(R.string.game_message_over)); messageTurnIndicatorValue.setText(getString(R.string.game_message_draw)); } else{ getMessageTurnIndicator.setText(getString(R.string.message_turn_indicator)); messageTurnIndicatorValue.setText(toeGame.getTurn().getValue()); startTurn(selectedXBoxIds, selectedOBoxIds); } }  }
GameActivity extends RoboFragmentActivity implements LoaderManager.LoaderCallbacks<Cursor> { protected void refreshUI(boolean gameOverNoWinner, GameWinPattern gameWinPattern, GameSymbol winningSymbol, int[] selectedXBoxIds, int[] selectedOBoxIds) { if(gameWinPattern != null){ hapticFeedbackHelper.vibrate(hapticFeedbackHelper.getWinningPattern(toeGame.symbolIsAndroid(winningSymbol)), HapticFeedbackHelper.VIBE_PATTERN_NO_REPEAT); disableAllBoxes(); highlightWinningPattern(gameWinPattern); getMessageTurnIndicator.setText(getString(R.string.game_message_over)); messageTurnIndicatorValue.setText(getString(R.string.game_message_wins, winningSymbol.getValue())); } else if(gameOverNoWinner){ getMessageTurnIndicator.setText(getString(R.string.game_message_over)); messageTurnIndicatorValue.setText(getString(R.string.game_message_draw)); } else{ getMessageTurnIndicator.setText(getString(R.string.message_turn_indicator)); messageTurnIndicatorValue.setText(toeGame.getTurn().getValue()); startTurn(selectedXBoxIds, selectedOBoxIds); } }  void chooseBox(View view); void newGame(View view); @Override Loader<Cursor> onCreateLoader(int id, Bundle args); @Override void onLoadFinished(Loader<Cursor> loader, Cursor data); @Override void onLoaderReset(Loader<Cursor> loader); }
GameActivity extends RoboFragmentActivity implements LoaderManager.LoaderCallbacks<Cursor> { protected void refreshUI(boolean gameOverNoWinner, GameWinPattern gameWinPattern, GameSymbol winningSymbol, int[] selectedXBoxIds, int[] selectedOBoxIds) { if(gameWinPattern != null){ hapticFeedbackHelper.vibrate(hapticFeedbackHelper.getWinningPattern(toeGame.symbolIsAndroid(winningSymbol)), HapticFeedbackHelper.VIBE_PATTERN_NO_REPEAT); disableAllBoxes(); highlightWinningPattern(gameWinPattern); getMessageTurnIndicator.setText(getString(R.string.game_message_over)); messageTurnIndicatorValue.setText(getString(R.string.game_message_wins, winningSymbol.getValue())); } else if(gameOverNoWinner){ getMessageTurnIndicator.setText(getString(R.string.game_message_over)); messageTurnIndicatorValue.setText(getString(R.string.game_message_draw)); } else{ getMessageTurnIndicator.setText(getString(R.string.message_turn_indicator)); messageTurnIndicatorValue.setText(toeGame.getTurn().getValue()); startTurn(selectedXBoxIds, selectedOBoxIds); } }  void chooseBox(View view); void newGame(View view); @Override Loader<Cursor> onCreateLoader(int id, Bundle args); @Override void onLoadFinished(Loader<Cursor> loader, Cursor data); @Override void onLoaderReset(Loader<Cursor> loader);  }