Challenge 2: A Custom App Theme — Solution
// res/values/colors.xml
#3DDC84#0F1117
// res/values/themes.xml
// AndroidManifest.xml — inside
...
// activity_main.xml — an UNSTYLED default Button, no "style" attribute at all
Notes:
- Because AndroidManifest.xml's tag sets android:theme to
Theme.MyFirstApp, EVERY Activity in the app (and every View inside
those Activities) inherits colorPrimary and colorOnPrimary
automatically — no per-Activity or per-View theme reference needed.
- Running the app shows the plain, unstyled Button in activity_main.xml
automatically tinted with brand_primary and its text in
brand_on_primary — a standard Material Button reads colorPrimary from
the active theme by default, which is the whole point of a theme
versus Challenge 1's per-View style.
- parent="Theme.MaterialComponents.DayNight" (rather than a non-DayNight
parent) is what makes this theme automatically participate in dark
mode switching, setting up Challenge 3's values-night behavior to work
correctly.