ground-android
ground-android copied to clipboard
[Code health] Consolidate and clean up styles
All components should ideally use Material theming; specific instances of color attributes can be removed.
https://material.io/develop/android/theming/color
@shobhitagarwal1612 @JSunde Any idea when we should be using ?attr/colorFoo vs @color/colorBar? I don't quite understand yet how the two interact, would be good to establish a common approach.
This article seems to recommend ?attr over @color, although it doesn't seem to go into much detail as to why that is recommended. https://medium.com/androiddevelopers/android-styling-common-theme-attributes-8f7c50c9eaba
Specifically we recommended using theme attributes to provide a point of indirection to resources, so that you can vary them (e.g. in [dark theme](https://developer.android.com/guide/topics/ui/look-and-feel/darktheme))
This enables us to create fewer layouts or styles, isolating changes within a theme. In practice, you largely want to vary colors by theme and as such you should always* refer to colors via theme attributes.
https://medium.com/androiddevelopers/android-styling-prefer-theme-attributes-412caa748774
@shobhitagarwal1612 @JSunde Proposed structure of new consolidated styles, by example:
https://github.com/google/ground-android/blob/f0efc1ee87be18657023917f46ad6e933c1d1aee/ground/src/main/res/values/styles.xml#L218-L252