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 f634316..e5d6c2f 100644 --- a/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java +++ b/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java @@ -54,19 +54,19 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On 7, 0, 0, 0, 1, 0, 3, 0, 5} , null, null);*/ gameController.loadLevel(GameType.Default_12x12, - new int[] {0, 2, 1, 0, 0, 6, 0, 0, 0, 8, 9, 0, - 10, 0,12, 0, 0, 2, 1,11, 0, 0, 0, 6, - 6, 0, 0, 4, 0,12, 0, 0, 0, 0, 2, 1, - 0, 0, 0, 5, 0, 0, 0, 4,11,10, 0, 0, - 0,10, 0, 1, 0, 0, 6, 0, 0, 0, 0, 0, - 0, 7, 0, 0,11, 0, 0, 0, 0,12, 8, 9, - 2, 1,11, 0, 0, 0, 0, 7, 0, 0, 6, 0, - 0, 0, 0, 0, 0, 5, 0, 0, 4, 0,10, 0, - 0, 0, 7, 3, 9, 0, 0, 0, 1, 0, 0, 0, - 1, 5, 0, 0, 0, 0, 4, 0,10, 0, 0,11, - 9, 0, 0, 0, 1,10, 2, 0, 0, 6, 0, 7, - 0, 6,10, 0, 0, 0, 8, 0, 0, 1,12, 0} - ,null, null); + new int[]{0, 2, 1, 0, 0, 6, 0, 0, 0, 8, 9, 0, + 10, 0, 12, 0, 0, 2, 1, 11, 0, 0, 0, 6, + 6, 0, 0, 4, 0, 12, 0, 0, 0, 0, 2, 1, + 0, 0, 0, 5, 0, 0, 0, 4, 11, 10, 0, 0, + 0, 10, 0, 1, 0, 0, 6, 0, 0, 0, 0, 0, + 0, 7, 0, 0, 11, 0, 0, 0, 0, 12, 8, 9, + 2, 1, 11, 0, 0, 0, 0, 7, 0, 0, 6, 0, + 0, 0, 0, 0, 0, 5, 0, 0, 4, 0, 10, 0, + 0, 0, 7, 3, 9, 0, 0, 0, 1, 0, 0, 0, + 1, 5, 0, 0, 0, 0, 4, 0, 10, 0, 0, 11, + 9, 0, 0, 0, 1, 10, 2, 0, 0, 6, 0, 7, + 0, 6, 10, 0, 0, 0, 8, 0, 0, 1, 12, 0} + , null, null); layout.setGame(gameController); layout.setSettings(sharedPref); @@ -76,9 +76,10 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On keyboard.removeAllViews(); keyboard.setGameController(gameController); keyboard.setColumnCount((gameController.getSize() / 2) + 1); - keyboard.setRowCount(2); + 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/SudokuKeyboardLayout.java b/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuKeyboardLayout.java index 7c62217..1c98772 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 @@ -8,6 +8,7 @@ import android.view.View; import android.widget.GridLayout; import tu_darmstadt.sudoku.controller.GameController; +import tu_darmstadt.sudoku.game.GameType; /** * Created by TMZ_LToP on 12.11.2015. @@ -18,8 +19,11 @@ public class SudokuKeyboardLayout extends GridLayout { AttributeSet attrs; SudokuButton [] buttons; + SudokuButton [] fixedButtons; GameController gameController; boolean notesEnabled=false; + SudokuButtonType [] fixedTypes = {SudokuButtonType.Do,SudokuButtonType.Undo,SudokuButtonType.NoteToggle,SudokuButtonType.Delete,SudokuButtonType.NumberOrCellFirst,SudokuButtonType.Hint}; + String [] s = {"Do","Un","fal","Del","Sh**","Hi"}; OnClickListener listener = new OnClickListener() { @Override @@ -40,6 +44,7 @@ public class SudokuKeyboardLayout extends GridLayout { break; case NoteToggle: notesEnabled = !notesEnabled; + btn.setText(String.valueOf(notesEnabled)); break; case Do: // TODO: not implemented @@ -73,11 +78,12 @@ public class SudokuKeyboardLayout extends GridLayout { public void setKeyBoard(int size,int width) { LayoutParams p ; - int fixedButtons = 0; - buttons = new SudokuButton[size+1]; + int fixedButtonsCount = 6; + buttons = new SudokuButton[size]; + fixedButtons = new SudokuButton[fixedButtonsCount]; int row = 0; int number = 0; - int torun = ((size+fixedButtons)%2==0) ? (size+fixedButtons)/2 :(size+fixedButtons+1)/2 ; + int torun = ((size)%2==0) ? (size)/2 :(size+1)/2 ; for (int k = 0; k<2;k++){ for (int i = 0; i< torun; i++){ @@ -88,18 +94,30 @@ public class SudokuKeyboardLayout extends GridLayout { p.width= width2-15; buttons[i].setLayoutParams(p); buttons[i].setGravity(Gravity.CENTER); - if (number