diff --git a/app/src/main/java/tu_darmstadt/sudoku/game/listeners/IStatsListener.java b/app/src/main/java/tu_darmstadt/sudoku/game/listeners/IStatsListener.java deleted file mode 100644 index ec479d6..0000000 --- a/app/src/main/java/tu_darmstadt/sudoku/game/listeners/IStatsListener.java +++ /dev/null @@ -1,8 +0,0 @@ -package tu_darmstadt.sudoku.game.listeners; - -/** - * Created by TMZ_LToP on 25.11.2015. - */ -public interface IStatsListener { - public void refresh(); -} 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 8bdccad..36dfaaa 100644 --- a/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java +++ b/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java @@ -98,8 +98,9 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On keyboard.setRowCount(2); Point p = new Point(); getWindowManager().getDefaultDisplay().getSize(p); + //int width = p.x; - keyboard.setKeyBoard(gameController.getSize(), p.x); + keyboard.setKeyBoard(gameController.getSize(), p.x,layout.getHeight()-p.y); //set Special keys 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 64531b8..6962ad1 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 @@ -4,9 +4,9 @@ import android.content.Context; import android.graphics.Canvas; import android.util.AttributeSet; import android.util.TypedValue; -import android.view.Gravity; import android.view.View; import android.widget.GridLayout; +import android.support.v7.widget.GridLayoutManager; import tu_darmstadt.sudoku.controller.GameController; import tu_darmstadt.sudoku.controller.Symbol; @@ -46,30 +46,43 @@ public class SudokuKeyboardLayout extends GridLayout { public SudokuKeyboardLayout(Context context, AttributeSet attrs) { super(context, attrs); this.attrs = attrs; + } - public void setKeyBoard(int size,int width) { + public void setKeyBoard(int size,int width, int height) { LayoutParams p ; buttons = new SudokuButton[size]; int number = 0; int torun = ((size)%2==0) ? (size)/2 :(size+1)/2 ; int realSize = torun; + 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(GridLayout.spec(k,1),GridLayout.spec(i, 1)); - p.setMargins(0,0,0,0); - int width2 =width/(realSize); - p.width= width2-15; + Spec rowSpec = spec(k,1); + Spec colSpec = spec(i,1); + + p = (new LayoutParams(rowSpec,colSpec)); + + + + //p = new LayoutParams(rowSpec,colSpec); + 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); + + buttons[number].setLayoutParams(p); - buttons[number].setGravity(Gravity.CENTER); + //buttons[number].setGravity(Gravity.CENTER); buttons[number].setType(SudokuButtonType.Value); // TODO settings: get SymbolEnum from settings + buttons[number].setBackgroundResource(R.drawable.mnenomic_numpad_button); buttons[number].setText(Symbol.getSymbol(symbolsToUse, number)); buttons[number].setValue(number + 1); buttons[number].setOnClickListener(listener); @@ -81,6 +94,7 @@ public class SudokuKeyboardLayout extends GridLayout { public void setGameController(GameController gc){ gameController=gc; + } public void toggleNotesEnabled() { diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuSpecialButtonLayout.java b/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuSpecialButtonLayout.java index f3daf60..a935db9 100644 --- a/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuSpecialButtonLayout.java +++ b/app/src/main/java/tu_darmstadt/sudoku/ui/view/SudokuSpecialButtonLayout.java @@ -81,14 +81,16 @@ public class SudokuSpecialButtonLayout extends LinearLayout { for (SudokuButtonType t : SudokuButtonType.getSpecialButtons()){ fixedButtons[i] = new SudokuButton(getContext(),null); p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT,1); - p.setMargins(0,0,0,0); - int width2 =width/(fixedButtonsCount); - p.width= width2-15; + p.setMargins(5,5,5,5); + + //int width2 =width/(fixedButtonsCount); + //p.width= width2-15; fixedButtons[i].setLayoutParams(p); fixedButtons[i].setGravity(Gravity.CENTER); fixedButtons[i].setType(t); fixedButtons[i].setText(SudokuButtonType.getName(t)); fixedButtons[i].setOnClickListener(listener); + fixedButtons[i].setBackgroundResource(R.drawable.numpad_highlighted_four); addView(fixedButtons[i]); i++; diff --git a/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_left_black_24dp.xml b/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_left_black_24dp.xml new file mode 100644 index 0000000..c9f7747 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_left_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_right_black_24dp.xml b/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_right_black_24dp.xml new file mode 100644 index 0000000..a3d1622 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_right_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/delete_reset_button.xml b/app/src/main/res/drawable/delete_reset_button.xml new file mode 100644 index 0000000..f2acc88 --- /dev/null +++ b/app/src/main/res/drawable/delete_reset_button.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/app/src/main/res/drawable/hints_display.xml b/app/src/main/res/drawable/hints_display.xml new file mode 100644 index 0000000..ad01d74 --- /dev/null +++ b/app/src/main/res/drawable/hints_display.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/mnenomic_numpad_button.xml b/app/src/main/res/drawable/mnenomic_numpad_button.xml new file mode 100644 index 0000000..97a13c9 --- /dev/null +++ b/app/src/main/res/drawable/mnenomic_numpad_button.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/app/src/main/res/drawable/numpad_highlighted.xml b/app/src/main/res/drawable/numpad_highlighted.xml new file mode 100644 index 0000000..7af2c1a --- /dev/null +++ b/app/src/main/res/drawable/numpad_highlighted.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/numpad_highlighted_four.xml b/app/src/main/res/drawable/numpad_highlighted_four.xml new file mode 100644 index 0000000..8b8e766 --- /dev/null +++ b/app/src/main/res/drawable/numpad_highlighted_four.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/numpad_highlighted_three.xml b/app/src/main/res/drawable/numpad_highlighted_three.xml new file mode 100644 index 0000000..fe0f0cf --- /dev/null +++ b/app/src/main/res/drawable/numpad_highlighted_three.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/numpad_highlighted_two.xml b/app/src/main/res/drawable/numpad_highlighted_two.xml new file mode 100644 index 0000000..578ee42 --- /dev/null +++ b/app/src/main/res/drawable/numpad_highlighted_two.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main_menu.xml b/app/src/main/res/layout/activity_main_menu.xml index 36a45b7..a2ab1b5 100644 --- a/app/src/main/res/layout/activity_main_menu.xml +++ b/app/src/main/res/layout/activity_main_menu.xml @@ -33,14 +33,30 @@ android:weightSum="10" android:layout_marginTop="?attr/actionBarSize" style="?android:buttonBarStyle"> - + + + + + android:elevation="10dp" + android:background="@drawable/mnenomic_numpad_button"/>