From cdd095f22340815598307d6bd00f2ee12d0b857e Mon Sep 17 00:00:00 2001 From: Hossain Khan Date: Sat, 6 Dec 2025 15:28:22 -0500 Subject: [PATCH] docs: Add guidance for Icons class and vector drawables - Document custom Icons class that replaces deprecated androidx.compose.material.icons - Add step-by-step instructions for adding new icons via Material Symbols - Explain icon categories (Default, Outlined, AutoMirrored) - Warn against using deprecated Material Icons package - Reference issue #226 for context Related to #226 --- .github/copilot-instructions.md | 11 +++++++++++ CLAUDE.md | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index c95532f..810378e 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -170,6 +170,17 @@ See `RELEASE_CHECKLIST.md` for complete release process. - **Always run:** `./gradlew formatKotlin` before committing - **Check only:** `./gradlew lintKotlin` (doesn't modify files) +## Icons & Vector Drawables + +- **Custom Icons Class:** `ink.trmnl.android.ui.icons.Icons` (replaces deprecated `androidx.compose.material.icons`) +- **Adding New Icons:** + 1. Download icon from [Material Symbols](https://fonts.google.com/icons) + 2. Convert to Android Vector Drawable (use Vector Asset Studio in Android Studio) + 3. Add drawable to `app/src/main/res/drawable/` + 4. Expose via `Icons` class with appropriate category (Default, Outlined, AutoMirrored) +- **Usage:** `Icons.Default.Settings`, `Icons.Outlined.Warning`, `Icons.AutoMirrored.Filled.ArrowBack` +- **Never use:** `androidx.compose.material.icons.Icons` (deprecated package) + ## Testing - **Unit Tests:** `app/src/test/` (Robolectric, MockK, Truth assertions) diff --git a/CLAUDE.md b/CLAUDE.md index 41a8e39..4ed6dc2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -216,6 +216,25 @@ The project uses optimized Gradle settings based on best practices from the [Now - Check: `./gradlew lintKotlin` (no modifications) - Only customization: Allow PascalCase for `@Composable` functions +## Icons & Vector Drawables + +**Custom Icons Class:** `ink.trmnl.android.ui.icons.Icons` replaces deprecated `androidx.compose.material.icons` + +- **Location:** `app/src/main/java/ink/trmnl/android/ui/icons/Icons.kt` +- **Structure:** Nested objects matching Material Icons API + - `Icons.Default.*` - Filled icons (CheckCircle, Clear, DateRange, PlayArrow, Refresh, Settings, Share, Warning) + - `Icons.Outlined.*` - Outlined variants (Info, Warning) + - `Icons.AutoMirrored.Filled.*` - Auto-mirrored for RTL (ArrowBack, ArrowForward, List) + +**Adding New Icons:** +1. Download from [Google Fonts Material Symbols](https://fonts.google.com/icons) +2. Convert to Android Vector Drawable (use Vector Asset Studio in Android Studio) +3. Save to `app/src/main/res/drawable/ic_[name]_[size]dp.xml` +4. Expose in `Icons.kt` with `@Composable get() = ImageVector.vectorResource(id = R.drawable.ic_name)` +5. Place in appropriate category (Default/Outlined/AutoMirrored) + +**Never use:** `androidx.compose.material.icons.Icons` (deprecated, issue #226) + ## Testing - Unit tests: `app/src/test/` (Robolectric 4.14.1, MockK 1.14.2, Truth 1.4.4)