Hotfix für Fixed Button Row now only available buttons are shown height fixed by Chris

This commit is contained in:
Gongxter 2015-11-15 13:10:29 +01:00
parent 8a170f88bf
commit fddd7d742b
3 changed files with 6 additions and 4 deletions

View file

@ -68,8 +68,6 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
keyboard.setColumnCount(Math.max(((gameController.getSize() / 2) + 1),keyboard.fixedButtonsCount));
keyboard.setRowCount(3);
Point p = new Point();
getWindowManager().getDefaultDisplay().getSize(p);
keyboard.getLayoutParams().height = (int)(p.y*0.3);
//int width = p.x;
keyboard.setKeyBoard(gameController.getSize(), p.x);
/*

View file

@ -20,7 +20,7 @@ public class SudokuFieldLayout extends RelativeLayout {
private GameController gameController;
private int sectionHeight;
private int sectionWidth;
public int sectionWidth;
private int gameCellWidth;
private int gameCellHeight;
private SharedPreferences settings;

View file

@ -84,13 +84,14 @@ public class SudokuKeyboardLayout extends GridLayout {
int row = 0;
int number = 0;
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 i = 0; i< torun; i++){
buttons[i] = new SudokuButton(getContext(),null);
p = new LayoutParams(GridLayout.spec(k,1),GridLayout.spec(i, 1));
p.setMargins(0,0,0,0);
int width2 =width/(torun);
int width2 =width/(realSize);
p.width= width2-15;
buttons[i].setLayoutParams(p);
buttons[i].setGravity(Gravity.CENTER);
@ -100,6 +101,9 @@ public class SudokuKeyboardLayout extends GridLayout {
buttons[i].setOnClickListener(listener);
number++;
if (number > size) {
break;
}
addView(buttons[i]);
}
}