UI Notes added

This commit is contained in:
Gongxter 2015-11-12 14:13:31 +01:00
parent a8486fe5a2
commit 1b6738f375

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;
@ -29,6 +30,7 @@ public class SudokuCellView extends View {
int mCol; int mCol;
boolean touched; boolean touched;
boolean selected; boolean selected;
public boolean[] notes;
public SudokuCellView(Context context) { public SudokuCellView(Context context) {
@ -50,6 +52,7 @@ public class SudokuCellView extends View {
mWidth = width; mWidth = width;
mRow = gameCell.getRow(); mRow = gameCell.getRow();
mCol = gameCell.getCol(); mCol = gameCell.getCol();
notes = gameCell.getNotes();
} }
@Override @Override
@ -91,16 +94,37 @@ 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);
} }
p.setAntiAlias(true); p.setAntiAlias(true);
p.setTextSize(Math.min(mWidth * 3 / 4, mWidth * 3 / 4)); p.setTextSize(Math.min(mWidth * 3 / 4, mWidth * 3 / 4));
p.setTextAlign(Paint.Align.CENTER); p.setTextAlign(Paint.Align.CENTER);
canvas.drawText(String.valueOf(mGameCell.getValue()), mWidth/2, mWidth/2 + mWidth/4, p); canvas.drawText(String.valueOf(mGameCell.getValue()), mWidth / 2, mWidth / 2 + mWidth / 4, p);
} }
public int getColumn() { public int getColumn() {