diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java index 4350307..4b6578f 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java @@ -23,6 +23,7 @@ import android.app.DialogFragment; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; @@ -198,6 +199,11 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig difficultyBar.setRating(GameDifficulty.getValidDifficultyList().indexOf(lastChosenDifficulty) + 1); } + if(Configuration.SCREENLAYOUT_SIZE_SMALL == (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK)) { + difficultyBar.setScaleX(0.75f); + difficultyBar.setScaleY(0.75f); + } + // on first create always check for loadable levels! SharedPreferences.Editor editor = settings.edit(); editor.putBoolean("savesChanged", true); diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/CreateSudokuSpecialButtonLayout.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/CreateSudokuSpecialButtonLayout.java index 299cca3..60c65da 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/CreateSudokuSpecialButtonLayout.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/view/CreateSudokuSpecialButtonLayout.java @@ -23,6 +23,7 @@ import android.app.DialogFragment; import android.app.FragmentManager; import android.content.Context; import android.content.DialogInterface; +import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.drawable.Drawable; @@ -58,6 +59,7 @@ public class CreateSudokuSpecialButtonLayout extends LinearLayout implements IHi Canvas canvas; FragmentManager fragmentManager; Context context; + float buttonMargin; OnClickListener listener = new OnClickListener() { @Override @@ -95,6 +97,11 @@ public class CreateSudokuSpecialButtonLayout extends LinearLayout implements IHi public CreateSudokuSpecialButtonLayout(Context context, AttributeSet attrs) { super(context, attrs); + + TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CreateSudokuSpecialButtonLayout); + buttonMargin = a.getDimension(R.styleable.CreateSudokuSpecialButtonLayout_createSudokuSpecialKeyboardMargin, 5f); + a.recycle(); + setWeightSum(fixedButtonsCount); this.context = context; } @@ -117,7 +124,7 @@ public class CreateSudokuSpecialButtonLayout extends LinearLayout implements IHi if(gameController != null) { gameController.registerHighlightChangedListener(this); } - fixedButtons = new CreateSudokuSpecialButton[fixedButtonsCount]; + fixedButtons = new CreateSudokuSpecialButton[fixedButtonsCount]; LayoutParams p; int i = 0; //ArrayList type = (ArrayList) SudokuButtonType.getSpecialButtons(); @@ -127,9 +134,9 @@ public class CreateSudokuSpecialButtonLayout extends LinearLayout implements IHi p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1); } else { p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1); - fixedButtons[i].setPadding(25, 0, 25, 0); + fixedButtons[i].setPadding((int)buttonMargin*5, 0, (int)buttonMargin*5, 0); } - p.setMargins(5, 5, 5, 5); + p.setMargins((int)buttonMargin, (int)buttonMargin, (int)buttonMargin, (int)buttonMargin); //int width2 =width/(fixedButtonsCount); //p.width= width2-15; 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 fa7149c..22fae0a 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 @@ -17,7 +17,9 @@ package org.secuso.privacyfriendlysudoku.ui.view; import android.content.Context; +import android.content.res.TypedArray; import android.graphics.Canvas; +import android.graphics.Color; import android.util.AttributeSet; import android.util.TypedValue; import android.view.Gravity; @@ -42,6 +44,7 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan Symbol symbolsToUse = Symbol.Default; float normalTextSize = 20; // in sp LinearLayout [] layouts = new LinearLayout[2]; + float buttonMargin; OnClickListener listener = new OnClickListener() { @Override @@ -58,6 +61,11 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan public SudokuKeyboardLayout(Context context, AttributeSet attrs) { super(context, attrs); this.attrs = attrs; + + TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SudokuKeyboardLayout); + buttonMargin = a.getDimension(R.styleable.SudokuKeyboardLayout_sudokuKeyboardMargin, 5f); + normalTextSize = a.getDimension(R.styleable.SudokuKeyboardLayout_sudokuKeyboardTextSize, 20f); + a.recycle(); } public void setSymbols(Symbol s) { @@ -85,7 +93,7 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan 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); + p.setMargins(0, (int) buttonMargin, 0, (int) buttonMargin); layouts[i] = new LinearLayout(getContext(),null); layouts[i].setLayoutParams(p); layouts[i].setWeightSum(numberOfButtonsPerRow); @@ -106,7 +114,7 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan } else { p = new LayoutParams(LayoutParams.MATCH_PARENT, 0, 1); } - p.setMargins(5,5,5,5); + p.setMargins((int) buttonMargin, (int) buttonMargin, (int) buttonMargin, (int) buttonMargin); buttons[buttonIndex].setLayoutParams(p); /* removed GridLayout because of bad scaling will use now a Linearlayout Spec rowSpec = spec(k,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 b51d1fc..06316ec 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 @@ -23,6 +23,7 @@ import android.app.DialogFragment; import android.app.FragmentManager; import android.content.Context; import android.content.DialogInterface; +import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.drawable.Drawable; @@ -59,6 +60,7 @@ public class SudokuSpecialButtonLayout extends LinearLayout implements IHighligh Canvas canvas; FragmentManager fragmentManager; Context context; + float buttonMargin; OnClickListener listener = new OnClickListener() { @Override @@ -111,6 +113,11 @@ public class SudokuSpecialButtonLayout extends LinearLayout implements IHighligh public SudokuSpecialButtonLayout(Context context, AttributeSet attrs) { super(context, attrs); + + TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SudokuSpecialButtonLayout); + buttonMargin = a.getDimension(R.styleable.SudokuSpecialButtonLayout_sudokuSpecialKeyboardMargin, 5f); + a.recycle(); + setWeightSum(fixedButtonsCount); this.context = context; } @@ -140,8 +147,8 @@ public class SudokuSpecialButtonLayout extends LinearLayout implements IHighligh } else { p = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0, 1); } - fixedButtons[i].setPadding(25, 0, 25, 0); - p.setMargins(5, 5, 5, 5); + fixedButtons[i].setPadding((int)buttonMargin*5, 0, (int)buttonMargin*5, 0); + p.setMargins((int)buttonMargin, (int)buttonMargin, (int)buttonMargin, (int)buttonMargin); //int width2 =width/(fixedButtonsCount); //p.width= width2-15; diff --git a/app/src/main/res/drawable-hdpi/numpad_highlighted.xml b/app/src/main/res/drawable-hdpi/numpad_highlighted.xml new file mode 100644 index 0000000..7af2c1a --- /dev/null +++ b/app/src/main/res/drawable-hdpi/numpad_highlighted.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/numpad_highlighted_four.xml b/app/src/main/res/drawable-hdpi/numpad_highlighted_four.xml new file mode 100644 index 0000000..8b8e766 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/numpad_highlighted_four.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/numpad_highlighted_three.xml b/app/src/main/res/drawable-hdpi/numpad_highlighted_three.xml new file mode 100644 index 0000000..fe0f0cf --- /dev/null +++ b/app/src/main/res/drawable-hdpi/numpad_highlighted_three.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/numpad_selected_complete.xml b/app/src/main/res/drawable-hdpi/numpad_selected_complete.xml new file mode 100644 index 0000000..889373e --- /dev/null +++ b/app/src/main/res/drawable-hdpi/numpad_selected_complete.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/app/src/main/res/drawable-night-hdpi/numpad_highlighted_four.xml b/app/src/main/res/drawable-night-hdpi/numpad_highlighted_four.xml new file mode 100644 index 0000000..29b7638 --- /dev/null +++ b/app/src/main/res/drawable-night-hdpi/numpad_highlighted_four.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-night-v21/numpad_highlighted_four.xml b/app/src/main/res/drawable-night-v21/numpad_highlighted_four.xml index 87ce8d9..17cc223 100644 --- a/app/src/main/res/drawable-night-v21/numpad_highlighted_four.xml +++ b/app/src/main/res/drawable-night-v21/numpad_highlighted_four.xml @@ -6,6 +6,6 @@ android:startColor="?attr/activeButtonColor" /> \ No newline at end of file diff --git a/app/src/main/res/drawable-v21/numpad_highlighted.xml b/app/src/main/res/drawable-v21/numpad_highlighted.xml index 2c00338..f63774f 100644 --- a/app/src/main/res/drawable-v21/numpad_highlighted.xml +++ b/app/src/main/res/drawable-v21/numpad_highlighted.xml @@ -6,6 +6,6 @@ android:startColor="?attr/activeButtonColor" /> \ No newline at end of file diff --git a/app/src/main/res/drawable-v21/numpad_highlighted_four.xml b/app/src/main/res/drawable-v21/numpad_highlighted_four.xml index 87ce8d9..17cc223 100644 --- a/app/src/main/res/drawable-v21/numpad_highlighted_four.xml +++ b/app/src/main/res/drawable-v21/numpad_highlighted_four.xml @@ -6,6 +6,6 @@ android:startColor="?attr/activeButtonColor" /> \ No newline at end of file diff --git a/app/src/main/res/drawable-v21/numpad_highlighted_three.xml b/app/src/main/res/drawable-v21/numpad_highlighted_three.xml index 05aa808..80e1a27 100644 --- a/app/src/main/res/drawable-v21/numpad_highlighted_three.xml +++ b/app/src/main/res/drawable-v21/numpad_highlighted_three.xml @@ -6,6 +6,6 @@ android:startColor="?attr/activeButtonColor" /> \ No newline at end of file diff --git a/app/src/main/res/drawable-v21/numpad_selected_complete.xml b/app/src/main/res/drawable-v21/numpad_selected_complete.xml index 62dd7f4..f2863e2 100644 --- a/app/src/main/res/drawable-v21/numpad_selected_complete.xml +++ b/app/src/main/res/drawable-v21/numpad_selected_complete.xml @@ -6,6 +6,6 @@ android:startColor="?attr/completedButtonColor" /> diff --git a/app/src/main/res/drawable/numfirst.png b/app/src/main/res/drawable/numfirst.png index 5e3d2e5..867fcf3 100644 Binary files a/app/src/main/res/drawable/numfirst.png and b/app/src/main/res/drawable/numfirst.png differ diff --git a/app/src/main/res/drawable/numfull.png b/app/src/main/res/drawable/numfull.png index 384c4ad..bd9997e 100644 Binary files a/app/src/main/res/drawable/numfull.png and b/app/src/main/res/drawable/numfull.png differ diff --git a/app/src/main/res/drawable/numpad_highlighted.xml b/app/src/main/res/drawable/numpad_highlighted.xml index 7af2c1a..dccbe96 100644 --- a/app/src/main/res/drawable/numpad_highlighted.xml +++ b/app/src/main/res/drawable/numpad_highlighted.xml @@ -6,6 +6,6 @@ android:startColor="@color/lightblue" /> \ 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 index 8b8e766..79da624 100644 --- a/app/src/main/res/drawable/numpad_highlighted_four.xml +++ b/app/src/main/res/drawable/numpad_highlighted_four.xml @@ -6,6 +6,6 @@ android:startColor="@color/lightblue" /> \ 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 index fe0f0cf..c05857e 100644 --- a/app/src/main/res/drawable/numpad_highlighted_three.xml +++ b/app/src/main/res/drawable/numpad_highlighted_three.xml @@ -6,6 +6,6 @@ android:startColor="@color/lightblue" /> \ No newline at end of file diff --git a/app/src/main/res/drawable/numpad_selected_complete.xml b/app/src/main/res/drawable/numpad_selected_complete.xml index 889373e..3c9dd64 100644 --- a/app/src/main/res/drawable/numpad_selected_complete.xml +++ b/app/src/main/res/drawable/numpad_selected_complete.xml @@ -6,6 +6,6 @@ android:startColor="@color/green" /> diff --git a/app/src/main/res/drawable/numpad_unselected_complete.xml b/app/src/main/res/drawable/numpad_unselected_complete.xml index 5bcd57c..a449008 100644 --- a/app/src/main/res/drawable/numpad_unselected_complete.xml +++ b/app/src/main/res/drawable/numpad_unselected_complete.xml @@ -1,5 +1,5 @@ - + diff --git a/app/src/main/res/layout-hdpi/content_game_view.xml b/app/src/main/res/layout-hdpi/content_game_view.xml new file mode 100644 index 0000000..134c0bf --- /dev/null +++ b/app/src/main/res/layout-hdpi/content_game_view.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout-hdpi/content_game_view_create_sudoku.xml b/app/src/main/res/layout-hdpi/content_game_view_create_sudoku.xml new file mode 100644 index 0000000..cb69830 --- /dev/null +++ b/app/src/main/res/layout-hdpi/content_game_view_create_sudoku.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/content_game_view.xml b/app/src/main/res/layout/content_game_view.xml index 134c0bf..62b1709 100644 --- a/app/src/main/res/layout/content_game_view.xml +++ b/app/src/main/res/layout/content_game_view.xml @@ -1,17 +1,17 @@ - + tools:context="org.secuso.privacyfriendlysudoku.ui.GameActivity" + tools:layout_editor_absoluteY="56dp"> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/sudokuLayout"> - + tools:context="org.secuso.privacyfriendlysudoku.ui.GameActivity" + tools:layout_editor_absoluteY="56dp"> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/sudokuLayout"> + + + + + + + + diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml index 3dfda28..478412b 100644 --- a/app/src/main/res/values-night/styles.xml +++ b/app/src/main/res/values-night/styles.xml @@ -1,7 +1,7 @@ - + + + +