From f6948f8aeb29bb75562c1ddf29a0c2acfb269abe Mon Sep 17 00:00:00 2001 From: uykek Date: Mon, 10 Aug 2020 11:53:49 +0200 Subject: [PATCH] Add comments to the CreateSudokuSpecialButtonLayout and SudokuSpecialButtonLayout class --- .../ui/view/CreateSudokuSpecialButtonLayout.java | 4 ++++ .../ui/view/SudokuSpecialButtonLayout.java | 4 ++++ 2 files changed, 8 insertions(+) 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 3bf982a..3301968 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 @@ -181,6 +181,7 @@ public class CreateSudokuSpecialButtonLayout extends LinearLayout implements IHi break; case NoteToggle: Drawable drawable = ContextCompat.getDrawable(context, fixedButtons[i].getType().getResID()); + // prepare canvas for the rotation of the note drawable setUpVectorDrawable(drawable); canvas.rotate(gameController.getNoteStatus() ? 45.0f : 0.0f, bitMap.getWidth()/2, bitMap.getHeight()/2); @@ -199,6 +200,9 @@ public class CreateSudokuSpecialButtonLayout extends LinearLayout implements IHi } } + /* + Set up the vector drawables so that they can be properly displayed despite using theme attributes for their fill color + */ private void setUpVectorDrawable(Drawable drawable) { drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); bitMap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), 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 eef4a34..090e361 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 @@ -194,6 +194,7 @@ public class SudokuSpecialButtonLayout extends LinearLayout implements IHighligh break; case NoteToggle: Drawable drawable = ContextCompat.getDrawable(context, fixedButtons[i].getType().getResID()); + // prepare canvas for the rotation of the note drawable setUpVectorDrawable(drawable); canvas.rotate(gameController.getNoteStatus() ? 45.0f : 0.0f, bitMap.getWidth()/2, bitMap.getHeight()/2); @@ -212,6 +213,9 @@ public class SudokuSpecialButtonLayout extends LinearLayout implements IHighligh } } + /* + Set up the vector drawables so that they can be properly displayed despite using theme attributes for their fill color + */ private void setUpVectorDrawable(Drawable drawable) { drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); bitMap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),