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 dda5249..e3368aa 100644
--- a/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java
+++ b/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java
@@ -105,8 +105,8 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
keyboard = (SudokuKeyboardLayout) findViewById(R.id.sudokuKeyboardLayout);
keyboard.removeAllViews();
keyboard.setGameController(gameController);
- keyboard.setColumnCount((gameController.getSize() / 2) + 1);
- keyboard.setRowCount(2);
+ //keyboard.setColumnCount((gameController.getSize() / 2) + 1);
+ //keyboard.setRowCount(2);
Point p = new Point();
getWindowManager().getDefaultDisplay().getSize(p);
@@ -243,6 +243,7 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
return true;
}
+
@Override
public void onSolved() {
gameSolved = true;
diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/StatsActivity.java b/app/src/main/java/tu_darmstadt/sudoku/ui/StatsActivity.java
index 5a8bb85..b3a0d49 100644
--- a/app/src/main/java/tu_darmstadt/sudoku/ui/StatsActivity.java
+++ b/app/src/main/java/tu_darmstadt/sudoku/ui/StatsActivity.java
@@ -210,9 +210,9 @@ public class StatsActivity extends AppCompatActivity {
}
private void updateGeneralIfo(int time, int games, int hints){
- totalHints =hints;
- totalGames =games;
- totalTime =time;
+ totalHints +=hints;
+ totalGames +=games;
+ totalTime +=time;
}
private void setGeneralInfo(){
TextView generalInfoView;
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 31eab07..5b85b30 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
@@ -11,8 +11,13 @@ import android.graphics.Canvas;
import android.os.Bundle;
import android.util.AttributeSet;
import android.util.TypedValue;
+import android.view.Gravity;
import android.view.View;
+import android.view.ViewGroup;
+import android.view.WindowManager;
import android.widget.GridLayout;
+import android.widget.GridView;
+import android.widget.LinearLayout;
import java.util.LinkedList;
@@ -26,13 +31,14 @@ import tu_darmstadt.sudoku.ui.listener.IDeleteDialogFragmentListener;
*/
-public class SudokuKeyboardLayout extends GridLayout implements IHighlightChangedListener {
+public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChangedListener {
AttributeSet attrs;
SudokuButton [] buttons;
GameController gameController;
Symbol symbolsToUse = Symbol.Default;
float normalTextSize = 0;
+ LinearLayout [] layouts = new LinearLayout[2];
OnClickListener listener = new OnClickListener() {
@Override
@@ -51,7 +57,6 @@ public class SudokuKeyboardLayout extends GridLayout implements IHighlightChange
public SudokuKeyboardLayout(Context context, AttributeSet attrs) {
super(context, attrs);
this.attrs = attrs;
-
}
public void setSymbols(Symbol s) {
@@ -62,20 +67,39 @@ public class SudokuKeyboardLayout extends GridLayout implements IHighlightChange
}
public void setKeyBoard(int size,int width, int height) {
- LayoutParams p ;
+ LayoutParams p;
buttons = new SudokuButton[size];
int number = 0;
int torun = (size % 2 == 0) ? size/2 :(size+1)/2 ;
int realSize = torun;
+
+ //set layout parameters and init Layouts
+ for (int i = 0; i < 2; i++) {
+ p = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,0,1);
+ //if (i == 0) p.bottomMargin=10; else p.topMargin=10;
+ p.setMargins(0,5,0,5);
+ layouts[i] = new LinearLayout(getContext(),null);
+ layouts[i].setLayoutParams(p);
+ layouts[i].setWeightSum(torun);
+ layouts[i].setOrientation(LinearLayout.HORIZONTAL);
+ addView(layouts[i]);
+ }
+
//int width2 =(width-(realSize*30))/(realSize);
+
+
for (int k = 0; k<2;k++){
for (int i = 0; i< torun; i++){
if (number == size) {
break;
}
buttons[number] = new SudokuButton(getContext(),null);
+ p = new LayoutParams(0, LayoutParams.MATCH_PARENT,1);
+ p.setMargins(5,5,5,5);
+ buttons[number].setLayoutParams(p);
+ /* removed GridLayout because of bad scaling will use now a Linearlayout
Spec rowSpec = spec(k,1);
Spec colSpec = spec(i,1);
@@ -85,17 +109,20 @@ public class SudokuKeyboardLayout extends GridLayout implements IHighlightChange
p.setMargins((i == 0) ? 0 : 5,5,5,5);
p.width = (width - (int)((getResources().getDimension(R.dimen.activity_horizontal_margin))*2)) / realSize;
p.width = p.width - 10;
- p.setGravity(LayoutParams.WRAP_CONTENT);
+ //p.setGravity(Gravity.FILL_VERTICAL);
+ //p.setGravity(Gravity.FILL);
+ // p.setGravity(LayoutParams.WRAP_CONTENT);
+ */
-
- buttons[number].setLayoutParams(p);
+ // buttons[number].setLayoutParams(p);
//buttons[number].setGravity(Gravity.CENTER);
buttons[number].setType(SudokuButtonType.Value);
+ buttons[number].setTextColor(getResources().getColor(R.color.white));
buttons[number].setBackgroundResource(R.drawable.mnenomic_numpad_button);
buttons[number].setText(Symbol.getSymbol(symbolsToUse, number));
buttons[number].setValue(number + 1);
buttons[number].setOnClickListener(listener);
- addView(buttons[number]);
+ layouts[k].addView(buttons[number]);
number++;
}
}
@@ -158,4 +185,9 @@ public class SudokuKeyboardLayout extends GridLayout implements IHighlightChange
}
}
}
+ public void fixHeight (){
+ int i = getHeight();
+ i = buttons[0].getHeight();
+ i = buttons[5].getHeight();
+ }
}
diff --git a/app/src/main/res/layout/activity_main_menu.xml b/app/src/main/res/layout/activity_main_menu.xml
index 3254703..6e98d1d 100644
--- a/app/src/main/res/layout/activity_main_menu.xml
+++ b/app/src/main/res/layout/activity_main_menu.xml
@@ -100,6 +100,7 @@
android:stepSize="1" />