示例#1
0
 /** Handles user's clicks and taps on the board. */
 public void onClick(View v) {
   final Object tag = v.getTag();
   if (null == previewTimer && tag instanceof Tile) {
     final Board board = getBoardModel();
     final Move move = board.permittedMoveFor((Tile) tag);
     if (null != move) {
       board.move(move);
       if (game.isSolved()) congratulate();
     } else {
       wrongClick();
     }
   }
 }
示例#2
0
 protected void dimImmovableTiles(boolean on) {
   final Board board = getBoardModel();
   final int boardSize = board.getSize();
   final int color = getResources().getColor(R.color.tile_dimmer);
   for (int r = 0; r < boardSize; r++)
     for (int c = 0; c < boardSize; c++) {
       final ImageView cell = imageCells[r][c];
       final Object tag = cell.getTag();
       if (tag instanceof Tile
           && null == board.permittedMoveFor((Tile) tag)
           && 0 != ((Tile) tag).getNumber()) {
         if (on) cell.setColorFilter(color);
         else cell.clearColorFilter();
       }
     }
 }