Changes for Issue #53 (enhancement)

1. Using fill color to represent completion and border for selection.
2. Updated image numfull.png to reflect this in help page
3. The button style gets updated on completion, even if the button is selected.
This commit is contained in:
rdatta95 2020-11-01 19:36:30 +05:30
parent 2293991a46
commit 1682c58bb7
9 changed files with 58 additions and 8 deletions

View file

@ -185,17 +185,29 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan
@Override @Override
public void onHighlightChanged() { public void onHighlightChanged() {
for(SudokuButton i_btn : buttons) { for(SudokuButton i_btn : buttons) {
i_btn.setBackgroundResource(R.drawable.mnenomic_numpad_button); int backgroundResId = R.drawable.mnenomic_numpad_button;
// Highlight Yellow if we are done with that number boolean numCompleted = (gameController.getValueCount(i_btn.getValue()) == gameController.getSize());
if(gameController.getValueCount(i_btn.getValue()) == gameController.getSize()) { boolean numSelected = (gameController.getSelectedValue() == i_btn.getValue());
i_btn.setBackgroundResource(R.drawable.numpad_highlighted_three);
if(numCompleted) {
// Fill color : darkyellow
// Border (if selected) : yellow
if(numSelected) {
backgroundResId = R.drawable.numpad_selected_complete;
} else {
backgroundResId = R.drawable.numpad_unselected_complete;
}
} else {
// Fill color : lightblue
// Border (if selected) : colorPrimaryDark
if(numSelected) {
backgroundResId = R.drawable.numpad_highlighted;
} // The else scenario is taken care of by the default initialized value
} }
if(gameController.getSelectedValue() == i_btn.getValue()) { i_btn.setBackgroundResource(backgroundResId);
// highlight button to indicate that the value is selected
i_btn.setBackgroundResource(R.drawable.numpad_highlighted);
}
} }
} }

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:endColor="?attr/completedButtonColor"
android:startColor="?attr/completedButtonColor" />
<corners android:radius="6dp" />
<stroke
android:width="10px"
android:color="?attr/completedButtonBorder" />
</shape>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient android:endColor="?attr/completedButtonColor" android:startColor="?attr/completedButtonColor" />
<corners android:radius="6dp" />
</shape>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:endColor="@color/darkyellow"
android:startColor="@color/darkyellow" />
<corners android:radius="6dp" />
<stroke
android:width="10px"
android:color="@color/yellow" />
</shape>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient android:endColor="@color/darkyellow" android:startColor="@color/darkyellow" />
<corners android:radius="6dp" />
</shape>

View file

@ -21,6 +21,8 @@
<item name="activeButtonColor">@color/lightblue</item> <item name="activeButtonColor">@color/lightblue</item>
<item name="inactiveButtonColor">@color/middlegrey</item> <item name="inactiveButtonColor">@color/middlegrey</item>
<item name="highlightedButtonBorder">@color/yellow</item> <item name="highlightedButtonBorder">@color/yellow</item>
<item name="completedButtonColor">@color/darkyellow</item>
<item name="completedButtonBorder">@color/yellow</item>
<item name="android:itemBackground">@color/cardview_dark_background</item> <item name="android:itemBackground">@color/cardview_dark_background</item>
<item name="backgroundTutorialSlide">@color/colorPrimaryDark</item> <item name="backgroundTutorialSlide">@color/colorPrimaryDark</item>
<item name="backgroundTutorialStars">@color/colorPrimaryDark</item> <item name="backgroundTutorialStars">@color/colorPrimaryDark</item>

View file

@ -15,6 +15,8 @@
<attr name="activeButtonColor" format="color"/> <attr name="activeButtonColor" format="color"/>
<attr name="menuTextColor" format="color"/> <attr name="menuTextColor" format="color"/>
<attr name="highlightedButtonBorder" format="color"/> <attr name="highlightedButtonBorder" format="color"/>
<attr name="completedButtonColor" format="color"/>
<attr name="completedButtonBorder" format="color"/>
<attr name="backgroundTutorialSlide" format="color"/> <attr name="backgroundTutorialSlide" format="color"/>
<attr name="backgroundTutorialStars" format="color"/> <attr name="backgroundTutorialStars" format="color"/>
<attr name="blueHighlight" format="color"/> <attr name="blueHighlight" format="color"/>

View file

@ -19,6 +19,8 @@
<item name="activeButtonColor">@color/lightblue</item> <item name="activeButtonColor">@color/lightblue</item>
<item name="inactiveButtonColor">@color/middlegrey</item> <item name="inactiveButtonColor">@color/middlegrey</item>
<item name="highlightedButtonBorder">@color/yellow</item> <item name="highlightedButtonBorder">@color/yellow</item>
<item name="completedButtonColor">@color/darkyellow</item>
<item name="completedButtonBorder">@color/yellow</item>
<item name="actionBarTheme">@style/ToolbarStyle</item> <item name="actionBarTheme">@style/ToolbarStyle</item>
<item name="backgroundTutorialSlide">@color/colorAccent</item> <item name="backgroundTutorialSlide">@color/colorAccent</item>
<item name="backgroundTutorialStars">@color/white</item> <item name="backgroundTutorialStars">@color/white</item>