Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void onCreate(Bundle icicle) {
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
this.renderer = new PlayboardRenderer(ShortyzApplication.getInstance().getBoard(), metrics.densityDpi, metrics.widthPixels,
!prefs.getBoolean("supressHints", false),
!prefs.getBoolean("supressHints", false), prefs.getBoolean("showErrorsIndicator", false),
ContextCompat.getColor(this, R.color.boxColor), ContextCompat.getColor(this, R.color.blankColor),
ContextCompat.getColor(this, R.color.errorColor));

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/totsp/crossword/PlayActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public boolean onKey(View view, int i, KeyEvent keyEvent) {

ShortyzApplication.getInstance().setBoard(new Playboard(puz, movement, prefs.getBoolean("preserveCorrectLettersInShowErrors", false)));
ShortyzApplication.getInstance().setRenderer(new PlayboardRenderer(getBoard(), metrics.densityDpi, metrics.widthPixels,
!prefs.getBoolean("supressHints", false),
!prefs.getBoolean("supressHints", false), prefs.getBoolean("showErrorsIndicator", false),
ContextCompat.getColor(this, R.color.boxColor), ContextCompat.getColor(this, R.color.blankColor),
ContextCompat.getColor(this, R.color.errorColor)));

Expand Down
19 changes: 17 additions & 2 deletions app/src/main/java/com/totsp/crossword/view/PlayboardRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class PlayboardRenderer {
private final Paint blackBox = new Paint();
private final Paint blackCircle = new Paint();
private final Paint blackLine = new Paint();
private final Paint blueLine = new Paint();
private final Paint cheated = new Paint();
private final Paint currentLetterBox = new Paint();
private final Paint currentLetterHighlight = new Paint();
Expand All @@ -37,12 +38,13 @@ public class PlayboardRenderer {
private float dpi;
private float scale = 1.0F;
private boolean hintHighlight;
private boolean indicateShowErrors;
private int widthPixels;
private final int boxColor;
private final int blankColor;
private final int errorColor;

public PlayboardRenderer(Playboard board, float dpi, int widthPixels, boolean hintHighlight,
public PlayboardRenderer(Playboard board, float dpi, int widthPixels, boolean hintHighlight, boolean indicateShowErrors,
int boxColor, int blankColor, int errorColor) {
this.boxColor = boxColor;
this.blankColor = blankColor;
Expand All @@ -52,8 +54,11 @@ public PlayboardRenderer(Playboard board, float dpi, int widthPixels, boolean hi
this.widthPixels = widthPixels;
this.board = board;
this.hintHighlight = hintHighlight;
this.indicateShowErrors = indicateShowErrors;
blackLine.setColor(blankColor);
blackLine.setStrokeWidth(2.0F);
blueLine.setColor(Color.parseColor("#0000ff"));
blueLine.setStrokeWidth(4.0F);

numberText.setTextAlign(Align.LEFT);
numberText.setColor(blankColor);
Expand Down Expand Up @@ -294,7 +299,10 @@ private void drawBox(Canvas canvas, int x, int y, int row, int col, int boxSize,

Rect r = new Rect(x + 1, y + 1, (x + boxSize) - 1, (y + boxSize) - 1);

Paint boxBorderLine;

if (box == null) {
boxBorderLine = this.blackLine;
canvas.drawRect(r, this.blackBox);
} else {
// Background colors
Expand All @@ -312,6 +320,13 @@ private void drawBox(Canvas canvas, int x, int y, int row, int col, int boxSize,
canvas.drawRect(r, this.white);
}

// Borderline colors
if (this.board.isShowErrors() && this.indicateShowErrors && inCurrentWord) {
boxBorderLine = this.blueLine;
} else {
boxBorderLine = this.blackLine;
}

if (box.isAcross() || box.isDown()) {
canvas.drawText(Integer.toString(box.getClueNumber()), x + 2, y + numberTextSize + 2, this.numberText);
}
Expand Down Expand Up @@ -339,7 +354,7 @@ private void drawBox(Canvas canvas, int x, int y, int row, int col, int boxSize,
}

Paint boxColor = (((highlight.across == col) && (highlight.down == row)) && (currentWord != null))
? this.currentLetterBox : this.blackLine;
? this.currentLetterBox : boxBorderLine;

// Draw left
if ((col != (highlight.across + 1)) || (row != highlight.down)) {
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@
android:summary="Prevents the pink boxes indicating 'hints' in the form of reveals or show errors."
android:key="supressHints"
/>

<com.jenzz.materialpreference.CheckBoxPreference
android:title="Show Errors Indicator"
android:defaultValue="false"
android:summary="Changes the border color of the boxes in the selected word when 'Show Errors' is enabled."
android:key="showErrorsIndicator"
/>

<com.jenzz.materialpreference.CheckBoxPreference
android:title="Delete on Cleanup"
Expand Down