diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuKeyboardLayout.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuKeyboardLayout.java index f54aca5..3b8f603 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuKeyboardLayout.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuKeyboardLayout.java @@ -22,6 +22,7 @@ import android.util.AttributeSet; import android.util.TypedValue; import android.view.Gravity; import android.view.View; +import android.view.ViewGroup; import android.widget.LinearLayout; import org.secuso.privacyfriendlysudoku.controller.GameController; @@ -81,7 +82,7 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan if(orientation == LinearLayout.HORIZONTAL) { p = new LayoutParams(LayoutParams.MATCH_PARENT, 0, 1); } else { - p = new LayoutParams(0, LayoutParams.MATCH_PARENT, 1); + p = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT, 1); } //if (i == 0) p.bottomMargin=10; else p.topMargin=10; p.setMargins(0, 5, 0, 5); @@ -128,6 +129,7 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan buttons[buttonIndex].setBackgroundResource(R.drawable.mnenomic_numpad_button); buttons[buttonIndex].setPadding(0, 0, 0, 0); buttons[buttonIndex].setGravity(Gravity.CENTER); + buttons[buttonIndex].setMinHeight((int) (normalTextSize * 2)); buttons[buttonIndex].setText(Symbol.getSymbol(symbolsToUse, buttonIndex)); buttons[buttonIndex].setTextSize(TypedValue.COMPLEX_UNIT_SP, normalTextSize); buttons[buttonIndex].setValue(buttonIndex + 1); diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuSpecialButtonLayout.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuSpecialButtonLayout.java index bf01a21..b51d1fc 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuSpecialButtonLayout.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/SudokuSpecialButtonLayout.java @@ -136,11 +136,11 @@ public class SudokuSpecialButtonLayout extends LinearLayout implements IHighligh for (SudokuButtonType t : getSpecialButtons()){ fixedButtons[i] = new SudokuSpecialButton(getContext(),null); if(orientation == LinearLayout.HORIZONTAL) { - p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1); + p = new LayoutParams(0, LayoutParams.MATCH_PARENT, 1); } else { - p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1); - fixedButtons[i].setPadding(25, 0, 25, 0); + p = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0, 1); } + fixedButtons[i].setPadding(25, 0, 25, 0); p.setMargins(5, 5, 5, 5); //int width2 =width/(fixedButtonsCount); @@ -148,28 +148,16 @@ public class SudokuSpecialButtonLayout extends LinearLayout implements IHighligh if(t == Spacer) { fixedButtons[i].setVisibility(View.INVISIBLE); } - /*if(t == SudokuButtonType.Do && !gameController.isRedoAvailable()) { - fixedButtons[i].setEnabled(false); - } - if(t == SudokuButtonType.Undo && !gameController.isUndoAvailable()) { - fixedButtons[i].setEnabled(false); - }*/ + fixedButtons[i].setLayoutParams(p); fixedButtons[i].setType(t); - fixedButtons[i].setImageDrawable(getResources().getDrawable(t.getResID())); - // fixedButtons[i].setText(SudokuButtonType.getName(t)); - fixedButtons[i].setScaleType(ImageView.ScaleType.CENTER); + fixedButtons[i].setImageDrawable(ContextCompat.getDrawable(context, fixedButtons[i].getType().getResID())); + fixedButtons[i].setScaleType(ImageView.ScaleType.FIT_XY); fixedButtons[i].setAdjustViewBounds(true); fixedButtons[i].setOnClickListener(listener); fixedButtons[i].setBackgroundResource(R.drawable.numpad_highlighted_four); addView(fixedButtons[i]); - if(fixedButtons[i].getVisibility() == View.VISIBLE) { - Drawable drawable = ContextCompat.getDrawable(context, fixedButtons[i].getType().getResID()); - setUpVectorDrawable(drawable); - drawable.draw(canvas); - fixedButtons[i].setImageBitmap(bitResult); - } i++; } diff --git a/app/src/main/res/layout-land/content_game_view.xml b/app/src/main/res/layout-land/content_game_view.xml index d9310a1..2af36d7 100644 --- a/app/src/main/res/layout-land/content_game_view.xml +++ b/app/src/main/res/layout-land/content_game_view.xml @@ -1,54 +1,63 @@ - + tools:context="org.secuso.privacyfriendlysudoku.ui.GameActivity"> + android:layout_weight="1" + android:layout_marginStart="0dp" + android:gravity="center" + android:orientation="vertical" + android:weightSum="1" + app:layout_constraintHorizontal_weight="1" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@+id/sudokuLayout" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + android:layout_marginLeft="0dp" /> + android:focusable="true" + android:gravity="center" + app:layout_constraintHorizontal_weight="4" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintDimensionRatio="h,1:1" + app:layout_constraintEnd_toStartOf="@+id/sudokuKeyboardLayout" + app:layout_constraintHorizontal_bias="0.5" + app:layout_constraintStart_toEndOf="@+id/sudokuSpecialLayout" + app:layout_constraintTop_toTopOf="parent" /> + android:weightSum="2" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.5" + app:layout_constraintHorizontal_weight="2" + app:layout_constraintStart_toEndOf="@+id/sudokuLayout" + app:layout_constraintTop_toTopOf="parent" /> - + diff --git a/app/src/main/res/layout-land/content_game_view_create_sudoku.xml b/app/src/main/res/layout-land/content_game_view_create_sudoku.xml index edba24d..7fb15c7 100644 --- a/app/src/main/res/layout-land/content_game_view_create_sudoku.xml +++ b/app/src/main/res/layout-land/content_game_view_create_sudoku.xml @@ -1,57 +1,63 @@ - + tools:context="org.secuso.privacyfriendlysudoku.ui.GameActivity"> + + + android:focusable="true" + android:gravity="center" + app:layout_constraintHorizontal_weight="4" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintDimensionRatio="h,1:1" + app:layout_constraintEnd_toStartOf="@+id/sudokuKeyboardLayout" + app:layout_constraintHorizontal_bias="0.5" + app:layout_constraintStart_toEndOf="@+id/createSudokuLayout" + app:layout_constraintTop_toTopOf="parent" /> - + - - - - - - + diff --git a/app/src/main/res/layout/content_game_view.xml b/app/src/main/res/layout/content_game_view.xml index 59b10f7..134c0bf 100644 --- a/app/src/main/res/layout/content_game_view.xml +++ b/app/src/main/res/layout/content_game_view.xml @@ -1,50 +1,59 @@ - + android:focusable="true" + android:gravity="center" + app:layout_constraintBottom_toTopOf="@+id/sudokuButtonLayout" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + android:weightSum="3" + app:layout_constraintTop_toBottomOf="@id/sudokuLayout" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent"> - - + android:orientation="vertical" + android:weightSum="2" /> - - + android:layout_weight="1" + android:weightSum="1" /> - + diff --git a/app/src/main/res/layout/content_game_view_create_sudoku.xml b/app/src/main/res/layout/content_game_view_create_sudoku.xml index ff2d71c..cb69830 100644 --- a/app/src/main/res/layout/content_game_view_create_sudoku.xml +++ b/app/src/main/res/layout/content_game_view_create_sudoku.xml @@ -1,50 +1,59 @@ - + android:focusable="true" + android:gravity="center" + app:layout_constraintBottom_toTopOf="@+id/sudokuButtonLayout" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + android:weightSum="3" + app:layout_constraintTop_toBottomOf="@id/sudokuLayout" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent"> - - + android:orientation="vertical" + android:weightSum="2" /> - - + android:layout_weight="1" + android:weightSum="1" /> - +