SPEAKER NOTES:
Welcome to Wednesday's demo! Yesterday we solved the critical data persistence problem with ViewModels. Today we make the scorecard look professional using Material Design 3 and the Hope Foundation brand identity.
Hook: "Your app works, but does it feel like Hope Foundation? Let's add their brand."
Context: Maria wants the scorecard to feel like part of the Hope Foundation family. We'll apply their official colors (green #2E7D32, gold #FFC107) and create a cohesive, professional design.
SPEAKER NOTES:
We'll start with the principles and components of Material Design 3.
SPEAKER NOTES:
Then we'll use the Material Theme Builder to generate colors for the Hope Foundation brand.
SPEAKER NOTES:
Finally, we'll make the scorecard responsive to different screen sizes and orientations.
SPEAKER NOTES:
Material Design is Google's design system. Material 3 (M3) is the latest version, and it powers modern Android apps.
SPEAKER NOTES:
Material Design is a comprehensive design system created by Google.
SPEAKER NOTES:
When every Android app follows the same design patterns, users have a familiar experience. They know how buttons work, how to navigate, what interactions mean what.
SPEAKER NOTES:
Material 2 was used for years, but Material 3 introduced Material You with dynamic colors and better personalization.
SPEAKER NOTES:
Material You can automatically extract colors from a device's wallpaper (on Android 12+). But we can override this with brand colors.
SPEAKER NOTES:
Material Design provides templates for every UI element: buttons, cards, navigation, dialogs, etc.
SPEAKER NOTES:
Make sure you import from `material3`, not `material`. We're using Material 3.
Available components:
- Button, FilledButton, OutlinedButton, TextButton
- Card, ElevatedCard, OutlinedCard
- TextField, OutlinedTextField
- TopAppBar, BottomAppBar
- NavigationBar, NavigationRail
- FloatingActionButton
- Scaffold (for layout structure)
- And many more...
SPEAKER NOTES:
MaterialTheme is a composable that provides theme values to all components inside it. Any component can access these values using MaterialTheme.colorScheme, MaterialTheme.typography, etc.
SPEAKER NOTES:
Notice we never hardcode colors or text styles. We always use MaterialTheme values. This way, when the theme changes (dark mode, brand update), the entire app updates automatically.
SPEAKER NOTES:
Now let's create a theme that represents the Hope Foundation brand identity.
SPEAKER NOTES:
Material 3 has specific color roles. Each has a purpose.
SPEAKER NOTES:
Primary is the dominant brand color. For Hope Foundation, that's their green #2E7D32.
OnPrimary is the color of text/icons that appear on top of the primary color.
SPEAKER NOTES:
PrimaryContainer is a lighter shade used for less prominent elements. OnPrimaryContainer is the text color for that container.
SPEAKER NOTES:
Secondary is typically a complementary color. For Hope Foundation, that's their gold #FFC107.
SPEAKER NOTES:
Error is important for golf scoring. We can use error color to show scores above par.
SPEAKER NOTES:
We define:
1. The brand colors (Hope Green, Hope Gold)
2. All the theme color variants for light mode
These aren't random—they're generated using color theory to ensure readability and accessibility.
SPEAKER NOTES:
Dark mode colors are different from light mode. We use lighter shades because the background is dark. The gold becomes more peachy to be readable on black.
This is generated using Material Theme Builder, which ensures proper contrast.
SPEAKER NOTES:
We create complete color schemes using the lightColorScheme and darkColorScheme builder functions. These handle all the color roles at once.
SPEAKER NOTES:
This composable wraps the app theme. It checks if the system is in dark mode and uses the appropriate color scheme.
We pass typography and shapes (we'll define those next) to complete the theme.
SPEAKER NOTES:
Typography in Material Design has specific roles: displayLarge, headlineMedium, titleLarge, bodyLarge, etc.
Note labelLarge is extra large (24sp) because golf scores need to be visible in bright sunlight. This is a real-world consideration for this app.
SPEAKER NOTES:
Material Design shapes define corner radii. Small corners look modern, while larger corners feel more relaxed. We use these shapes consistently across the app.
SPEAKER NOTES:
Wrap your screen content in CharityGolfTrackerTheme. Now all components automatically use the Hope Foundation colors.
Notice: we use MaterialTheme.colorScheme.primaryContainer for the top bar background. We never hardcode colors.
SPEAKER NOTES:
Use @Preview annotations with different uiMode values to see both light and dark themes. This ensures your design works in both modes.
In Android Studio, you'll see both preview windows side by side.
SPEAKER NOTES:
Material Theme Builder does all the color science for you. It generates harmonious color palettes and ensures proper contrast for accessibility.
You don't have to manually define all the colors—the builder generates them!
SPEAKER NOTES:
Material Design 3 isn't just about colors. It also includes responsive design patterns. Our scorecard needs to work on phones, tablets, and foldable devices.
SPEAKER NOTES:
The Hope Foundation app might be used on:
- Small phones (4.5 inches)
- Large phones (6+ inches)
- Tablets (10 inches)
- Foldables (depends on fold state)
We need to adapt the layout for each.
SPEAKER NOTES:
A layout that looks great on a portrait phone might be cramped on a landscape tablet. We need to respond to these changes.
SPEAKER NOTES:
Android provides WindowSizeClass to detect screen size at runtime. We can use this to adapt our layout.
These aren't arbitrary numbers—they're breakpoints where UI patterns typically change.
SPEAKER NOTES:
Height matters too, though it's less commonly used.
SPEAKER NOTES:
A compact height means limited vertical space. A scrollable layout might be needed.
SPEAKER NOTES:
At the root of your app, detect the window size and choose the appropriate layout.
SPEAKER NOTES:
On a phone, we use a single column. The holes are scrollable, and the summary is fixed at the bottom.
SPEAKER NOTES:
On a tablet, we have enough width for a two-column layout. Holes on the left, always-visible summary on the right.
SPEAKER NOTES:
Use Android Studio's preview to test on phone, tablet, foldable sizes.
SPEAKER NOTES:
These modifiers make layouts flexible. Never hardcode pixel widths—use layout weights instead.
SPEAKER NOTES:
Column for vertical stacking, Row for horizontal. Nest them as needed.
SPEAKER NOTES:
These are lazy composables—they only compose the visible items, saving memory.
SPEAKER NOTES:
Rotation is a configuration change, but now your ViewModel preserves state while the layout adapts.
SPEAKER NOTES:
This is the complete picture:
1. The app is wrapped in CharityGolfTrackerTheme
2. We detect the window size
3. We choose the appropriate layout
4. All colors come from the theme
5. ViewModel preserves state across all these changes
Maria's scorecard now:
- Survives rotation and configuration changes ✓
- Uses Hope Foundation colors ✓
- Works on any device size ✓
- Looks professional ✓
SPEAKER NOTES:
These three things together create a professional, production-quality app that works everywhere:
- Data isn't lost when the screen rotates
- The app looks cohesive and branded
- The interface adapts to different devices
Next week we'll add lists and navigation to this foundation!
SPEAKER NOTES:
Friday you'll do the real work. Start from the template, add ViewModel, add theming, make it adaptive.
Come with questions. I'll circulate and help debug issues.