diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java b/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java index c7efdf1..06cbca3 100644 --- a/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java +++ b/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java @@ -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); /* diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuFieldLayout.java b/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuFieldLayout.java index b4c6493..7482b98 100644 --- a/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuFieldLayout.java +++ b/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuFieldLayout.java @@ -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; diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuKeyboardLayout.java b/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuKeyboardLayout.java index 7785c09..412c8cc 100644 --- a/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuKeyboardLayout.java +++ b/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuKeyboardLayout.java @@ -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]); } }