Closed murraycu closed 9 years ago
I dug around in the Android themes and styles to try to understand how the ripple works on normal buttons, and tried to do something similar, but all I get is the normal button ripple with no visible checked state, even if my selector is nearly empty: https://github.com/murraycu/android-galaxyzoo/commit/07b027d4bf51ff9e964a3fcecf4413c613868652
Since this change https://github.com/murraycu/android-galaxyzoo/commit/a8b3fd474cb4792473654077a8e42d5be1055868 even the regular buttons (such as Done, or Smooth) didn't have the ripple. This adds it back to the regular buttons: https://github.com/murraycu/android-galaxyzoo/commit/39b84cece2f383eaa86d3abcb4f8313379705765
And this adds the ripple to the ToggleButtons: https://github.com/murraycu/android-galaxyzoo/commit/65235c5df272e8015aee7f73f32a0901de6dfc38
On the "Odd" question, there are toggle buttons for "Ring", "Lens or arc", etc. When running on Android 5.0 (API 21) these should have the ripple effect. A ToggleButton with the normal style would have the ripple effect, but ours doesn't because we have specified a different background for the checked state, by using a style, because the default style is so unsuitable:
https://github.com/murraycu/android-galaxyzoo/blob/master/app/src/main/res/values/styles.xml#L77
whose background drawable is a:
https://github.com/murraycu/android-galaxyzoo/blob/master/app/src/main/res/drawable/question_answer_checkbox_background.xml
That style is specified in the ToggleButton's layout XML: https://github.com/murraycu/android-galaxyzoo/blob/master/app/src/main/res/layout/question_answer_checkbox.xml
It works for the regular buttons, such as "Done", which just uses: style="?android:attr/borderlessButtonStyle" in it's layout xml: https://github.com/murraycu/android-galaxyzoo/blob/master/app/src/main/res/layout/question_answer_button.xml Incidentally, we don't use a style for that because there is no way to use an attribute (the borderlessButtonStyle) as a style parent.