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:
parent
2293991a46
commit
1682c58bb7
9 changed files with 58 additions and 8 deletions
|
@ -185,17 +185,29 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan
|
|||
@Override
|
||||
public void onHighlightChanged() {
|
||||
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
|
||||
if(gameController.getValueCount(i_btn.getValue()) == gameController.getSize()) {
|
||||
i_btn.setBackgroundResource(R.drawable.numpad_highlighted_three);
|
||||
boolean numCompleted = (gameController.getValueCount(i_btn.getValue()) == gameController.getSize());
|
||||
boolean numSelected = (gameController.getSelectedValue() == i_btn.getValue());
|
||||
|
||||
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()) {
|
||||
// highlight button to indicate that the value is selected
|
||||
i_btn.setBackgroundResource(R.drawable.numpad_highlighted);
|
||||
}
|
||||
i_btn.setBackgroundResource(backgroundResId);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
11
app/src/main/res/drawable-v21/numpad_selected_complete.xml
Normal file
11
app/src/main/res/drawable-v21/numpad_selected_complete.xml
Normal 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>
|
|
@ -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 |
11
app/src/main/res/drawable/numpad_selected_complete.xml
Normal file
11
app/src/main/res/drawable/numpad_selected_complete.xml
Normal 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>
|
5
app/src/main/res/drawable/numpad_unselected_complete.xml
Normal file
5
app/src/main/res/drawable/numpad_unselected_complete.xml
Normal 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>
|
|
@ -21,6 +21,8 @@
|
|||
<item name="activeButtonColor">@color/lightblue</item>
|
||||
<item name="inactiveButtonColor">@color/middlegrey</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="backgroundTutorialSlide">@color/colorPrimaryDark</item>
|
||||
<item name="backgroundTutorialStars">@color/colorPrimaryDark</item>
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
<attr name="activeButtonColor" format="color"/>
|
||||
<attr name="menuTextColor" format="color"/>
|
||||
<attr name="highlightedButtonBorder" format="color"/>
|
||||
<attr name="completedButtonColor" format="color"/>
|
||||
<attr name="completedButtonBorder" format="color"/>
|
||||
<attr name="backgroundTutorialSlide" format="color"/>
|
||||
<attr name="backgroundTutorialStars" format="color"/>
|
||||
<attr name="blueHighlight" format="color"/>
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
<item name="activeButtonColor">@color/lightblue</item>
|
||||
<item name="inactiveButtonColor">@color/middlegrey</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="backgroundTutorialSlide">@color/colorAccent</item>
|
||||
<item name="backgroundTutorialStars">@color/white</item>
|
||||
|
|
Loading…
Reference in a new issue