Replace 'note toggle' button in CreateSudokuActivity with 'import' button

This commit is contained in:
uykek 2020-08-19 19:32:27 +02:00
parent 22e32c13dc
commit 1bf2c9ec7f
3 changed files with 9 additions and 24 deletions

View file

@ -29,7 +29,7 @@ public enum CreateSudokuButtonType {
Value(R.drawable.ic_accessibility_black_48dp), // should be non picture Value(R.drawable.ic_accessibility_black_48dp), // should be non picture
Do(R.drawable.ic_redo_black_48dp), Do(R.drawable.ic_redo_black_48dp),
Undo(R.drawable.ic_undo_black_48dp), Undo(R.drawable.ic_undo_black_48dp),
NoteToggle(R.drawable.ic_create_black_48dp), Import(R.drawable.ic_import),
Spacer(R.drawable.ic_accessibility_black_48dp),//placeholder Spacer(R.drawable.ic_accessibility_black_48dp),//placeholder
Delete(R.drawable.ic_delete_black_48dp), Delete(R.drawable.ic_delete_black_48dp),
Finalize(R.drawable.ic_finalize), Finalize(R.drawable.ic_finalize),
@ -53,7 +53,7 @@ public enum CreateSudokuButtonType {
result.add(Finalize); result.add(Finalize);
//result.add(Spacer); //result.add(Spacer);
result.add(Delete); result.add(Delete);
result.add(NoteToggle); result.add(Import);
return result; return result;
} }
public static String getName(CreateSudokuButtonType type) { public static String getName(CreateSudokuButtonType type) {
@ -61,7 +61,7 @@ public enum CreateSudokuButtonType {
case Do: return "Do"; case Do: return "Do";
case Undo: return "Un"; case Undo: return "Un";
case Finalize: return "Fi"; case Finalize: return "Fi";
case NoteToggle: return "On"; case Import: return "Im";
case Spacer: return ""; case Spacer: return "";
case Delete: return "Del"; case Delete: return "Del";
default:return "NotSet"; default:return "NotSet";

View file

@ -76,11 +76,7 @@ public class CreateSudokuSpecialButtonLayout extends LinearLayout implements IHi
case Delete: case Delete:
gameController.deleteSelectedCellsValue(); gameController.deleteSelectedCellsValue();
break; break;
case NoteToggle: case Import:
// rotates the Drawable
gameController.setNoteStatus(!gameController.getNoteStatus());
keyboard.updateNotesEnabled();
onHighlightChanged();
break; break;
case Do: case Do:
gameController.ReDo(); gameController.ReDo();
@ -179,21 +175,6 @@ public class CreateSudokuSpecialButtonLayout extends LinearLayout implements IHi
fixedButtons[i].setBackgroundResource(gameController.isRedoAvailable() ? fixedButtons[i].setBackgroundResource(gameController.isRedoAvailable() ?
R.drawable.numpad_highlighted_four : R.drawable.inactive_button); R.drawable.numpad_highlighted_four : R.drawable.inactive_button);
break; 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);
canvas.drawBitmap(bitMap, 0, 0, null);
drawable.draw(canvas);
fixedButtons[i].setImageBitmap(bitResult);
fixedButtons[i].setBackgroundResource(gameController.getNoteStatus() ? R.drawable.numpad_highlighted_three : R.drawable.numpad_highlighted_four);
keyboard.updateNotesEnabled();
break;
default: default:
break; break;
} }

View file

@ -0,0 +1,4 @@
<vector android:height="192dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="192dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="?attr/standardVectorGraphic" android:pathData="m12 2v10l2 -2h1l2 2v-10zm-9 1v19h18v-19h-3v16h-12v-13h5v-3z"/>
</vector>