Esempio n. 1
0
  private void drawValues(Canvas canvas, int row, int col) {
    ValueSet values = puzzle.getValues(row, col);
    if (values.isEmpty()) return;

    if (preview && !puzzle.isSolved()) {
      if (puzzle.isClue(row, col)) {
        boolean show = previewClueCounter++ % 3 != 0;
        String dv = show ? String.valueOf(theme.getSymbol(values.nextValue(0))) : "?";
        canvas.drawText(dv, cellWidth / 2f, textOffset, theme.getCluePaint(preview));
      }
    } else if (values.size() == 1) {
      String dv = String.valueOf(theme.getSymbol(values.nextValue(0)));
      Paint paint = puzzle.isClue(row, col) ? theme.getCluePaint(preview) : theme.getValuePaint();
      canvas.drawText(dv, cellWidth / 2f, textOffset, paint);
    } else {
      multiValuesPainter.paintValues(canvas, values);
    }
  }
Esempio n. 2
0
  private void drawHighlightedCells(Canvas canvas, Rect clipBounds) {
    if (highlightedDigit == null || theme.getHighlightDigitsPolicy() == HighlightDigitsPolicy.NEVER)
      return;

    for (int row = 0; row < size; row++) {
      float y = row * cellHeight;
      if (y > clipBounds.bottom || y + cellHeight < clipBounds.top) continue;

      for (int col = 0; col < size; col++) {
        float x = col * cellWidth;
        if (x > clipBounds.right || x + cellWidth < clipBounds.left) continue;

        final ValueSet values = puzzle.getValues(row, col);
        if (values.contains(highlightedDigit)) {
          drawHighlightedcell(canvas, values.size(), x, y);
        }
      }
    }
  }