Hotfix für Fixed Button Row now only available buttons are shown height fixed by Chris
This commit is contained in:
parent
8a170f88bf
commit
fddd7d742b
3 changed files with 6 additions and 4 deletions
|
@ -68,8 +68,6 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
keyboard.setColumnCount(Math.max(((gameController.getSize() / 2) + 1),keyboard.fixedButtonsCount));
|
keyboard.setColumnCount(Math.max(((gameController.getSize() / 2) + 1),keyboard.fixedButtonsCount));
|
||||||
keyboard.setRowCount(3);
|
keyboard.setRowCount(3);
|
||||||
Point p = new Point();
|
Point p = new Point();
|
||||||
getWindowManager().getDefaultDisplay().getSize(p);
|
|
||||||
keyboard.getLayoutParams().height = (int)(p.y*0.3);
|
|
||||||
//int width = p.x;
|
//int width = p.x;
|
||||||
keyboard.setKeyBoard(gameController.getSize(), p.x);
|
keyboard.setKeyBoard(gameController.getSize(), p.x);
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class SudokuFieldLayout extends RelativeLayout {
|
||||||
|
|
||||||
private GameController gameController;
|
private GameController gameController;
|
||||||
private int sectionHeight;
|
private int sectionHeight;
|
||||||
private int sectionWidth;
|
public int sectionWidth;
|
||||||
private int gameCellWidth;
|
private int gameCellWidth;
|
||||||
private int gameCellHeight;
|
private int gameCellHeight;
|
||||||
private SharedPreferences settings;
|
private SharedPreferences settings;
|
||||||
|
|
|
@ -84,13 +84,14 @@ public class SudokuKeyboardLayout extends GridLayout {
|
||||||
int row = 0;
|
int row = 0;
|
||||||
int number = 0;
|
int number = 0;
|
||||||
int torun = ((size)%2==0) ? (size)/2 :(size+1)/2 ;
|
int torun = ((size)%2==0) ? (size)/2 :(size+1)/2 ;
|
||||||
|
int realSize = Math.max(torun,fixedButtonsCount);
|
||||||
|
|
||||||
for (int k = 0; k<2;k++){
|
for (int k = 0; k<2;k++){
|
||||||
for (int i = 0; i< torun; i++){
|
for (int i = 0; i< torun; i++){
|
||||||
buttons[i] = new SudokuButton(getContext(),null);
|
buttons[i] = new SudokuButton(getContext(),null);
|
||||||
p = new LayoutParams(GridLayout.spec(k,1),GridLayout.spec(i, 1));
|
p = new LayoutParams(GridLayout.spec(k,1),GridLayout.spec(i, 1));
|
||||||
p.setMargins(0,0,0,0);
|
p.setMargins(0,0,0,0);
|
||||||
int width2 =width/(torun);
|
int width2 =width/(realSize);
|
||||||
p.width= width2-15;
|
p.width= width2-15;
|
||||||
buttons[i].setLayoutParams(p);
|
buttons[i].setLayoutParams(p);
|
||||||
buttons[i].setGravity(Gravity.CENTER);
|
buttons[i].setGravity(Gravity.CENTER);
|
||||||
|
@ -100,6 +101,9 @@ public class SudokuKeyboardLayout extends GridLayout {
|
||||||
buttons[i].setOnClickListener(listener);
|
buttons[i].setOnClickListener(listener);
|
||||||
|
|
||||||
number++;
|
number++;
|
||||||
|
if (number > size) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
addView(buttons[i]);
|
addView(buttons[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue