@Override protected void onBoardClick( final PositionView positionPrevious, final PositionView positionCurrent) { if (!board.isBoardLocked()) { final Coordinate coordinatePrevious = positionPrevious.getCoordinate(); final Position previous = board.getPosition(coordinatePrevious); positionPrevious.unselect(); final Coordinate coordinateCurrent = positionCurrent.getCoordinate(); final Position current = board.getPosition(coordinateCurrent); if (board.move(previous, current)) { flush(); getSherlockActivity().supportInvalidateOptionsMenu(); final byte boardStatus = ((Board) board).isBoardInCheckOrCheckmate(); switch (boardStatus) { case Board.BOARD_NORMAL: // doing nothing in this case is fine for now break; case Board.BOARD_CHECK: boardIsInCheck(); break; case Board.BOARD_CHECKMATE: boardIsInCheckmate(); break; } } clearSelectedPositions(); } }
@Override protected void onBoardClick(final PositionView positionCurrent) { if (board.isBoardLocked()) { clearSelectedPositions(); } else { final Coordinate coordinateCurrent = positionCurrent.getCoordinate(); final Position current = board.getPosition(coordinateCurrent); if (current.hasPiece() && current.getPiece().isTeamPlayer()) { positionCurrent.select(); } else { clearSelectedPositions(); } } }