Esempio n. 1
0
 /** Updates the view when the model posts a tile move notification. */
 public void tileMoved(final Tile from, final Tile to) {
   // repeat for both tiles
   for (Tile tile : new Tile[] {from, to}) {
     TextView numericCell = numericCells[tile.getRow()][tile.getColumn()];
     assignTile(numericCell, tile);
     ImageView imageCell = imageCells[tile.getRow()][tile.getColumn()];
     assignTile(imageCell, tile);
   }
 }
Esempio n. 2
0
 private void assignTile(final TextView cell, final Tile tile) {
   final int number = tile.getNumber();
   cell.setText(0 == number ? " " : Integer.toString(number));
   cell.setTag(tile);
   cell.setBackgroundColor(
       getResources()
           .getColor(0 == number ? R.color.blank_tile : R.color.numeric_tile_background));
 }
Esempio n. 3
0
 private void assignTile(final ImageView cell, final Tile tile) {
   cell.setImageDrawable(tile.getDrawable());
   cell.setTag(tile);
 }