Merge remote-tracking branch 'origin/master'

Conflicts:
	app/src/main/java/tu_darmstadt/sudoku/view/SudokuCellView.java
This commit is contained in:
Christopher Beckmann 2015-11-12 14:23:46 +01:00
commit fcf095c3dd
2 changed files with 34 additions and 2 deletions

View file

@ -41,6 +41,16 @@ public class GameController {
this.gameType = type; this.gameType = type;
setGameType(type); setGameType(type);
gameField = new GameField(size, sectionHeight, sectionWidth); gameField = new GameField(size, sectionHeight, sectionWidth);
setValue(0, 1, 8); setValue(0, 4, 2);
setValue(0, 5, 6); setValue(0, 6, 7);
setValue(0, 7, 3); setValue(0, 8, 4);
setNote(6, 3, 1); setNote(6, 3, 2); setNote(6, 3, 3); setNote(6, 3, 4);
setNote(6, 3, 5); setNote(6, 3, 6); setNote(6, 3, 7); setNote(6, 3, 8);
setNote(6, 3, 9);
setNote(7, 3, 2); setNote(7, 3, 3); setNote(7, 3, 4);
setNote(7, 3, 5); setNote(7, 3, 7); setNote(7, 3, 8);
setNote(7, 3, 9);
} }
private GameField solve(GameField gameField) { private GameField solve(GameField gameField) {

View file

@ -10,6 +10,7 @@ import android.util.AttributeSet;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import java.util.jar.Attributes; import java.util.jar.Attributes;
@ -120,9 +121,30 @@ public class SudokuCellView extends View {
} }
public void drawValue(Canvas canvas) { public void drawValue(Canvas canvas) {
if(mGameCell.getValue() == 0) return;
Paint p = new Paint(); Paint p = new Paint();
int j= 3;
int k = 3;
if(mGameCell.getValue() == 0) {
for (int i = 0; i < mGameCell.getNotes().length; i++) {
if (mGameCell.getNotes()[i]) {
p.setTypeface(Typeface.SANS_SERIF);
p.setTextSize(mWidth * 3 / 12);
p.setTextAlign(Paint.Align.RIGHT);
canvas.drawText(String.valueOf(i+1),(mWidth*1/12)*k,(mWidth*1/12)*j,p);
k+=4;
if (k > 11) {
k = 3;
j +=4;
}
/*canvas.drawText(String.valueOf(1), (mWidth * 1 / 12)*3, (mWidth* 1 / 12)*3, p);
canvas.drawText(String.valueOf(2),(mWidth*1/12)*7, (mWidth* 1 / 12)*7,p );
canvas.drawText(String.valueOf(3),(mWidth*1/12)*11, (mWidth* 1 / 12)*11,p );*/
}
}
return;
}
if (mGameCell.isFixed()) { if (mGameCell.isFixed()) {
p.setTypeface(Typeface.DEFAULT_BOLD); p.setTypeface(Typeface.DEFAULT_BOLD);
} }