Skip to content

[Jetsnack] Replace Material Icons with drawable resources #1592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2025

Conversation

JolandaVerhoef
Copy link
Collaborator

Migrates icons from Material Icons Extended to local drawable resources. This change removes the androidx.compose.material.iconsExtended dependency and replaces ImageVector instances with @DrawableRes integers throughout the codebase.

Migrates icons from Material Icons Extended to local drawable resources.
This change removes the `androidx.compose.material.iconsExtended` dependency and replaces `ImageVector` instances with `@DrawableRes` integers throughout the codebase.
@JolandaVerhoef JolandaVerhoef requested a review from a team as a code owner July 4, 2025 15:08
@JolandaVerhoef JolandaVerhoef requested review from MagicalMeghan and riggaroo and removed request for MagicalMeghan July 4, 2025 15:08
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @JolandaVerhoef, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request implements a significant refactoring of how icons are managed within the Jetsnack application. The core change involves migrating from the androidx.compose.material.iconsExtended dependency to using local drawable resources. This transition aims to reduce external library reliance, potentially improve build times, and provide more direct control over the application's icon assets by embedding them directly.

Highlights

  • Dependency Removal: The androidx.compose.material.iconsExtended library has been removed from the project's build.gradle.kts dependencies, reducing the application's external footprint.
  • Icon Type Migration: The application's icon handling has been refactored from using ImageVector instances (provided by Material Icons) to utilizing @DrawableRes integers, which point to local drawable resources.
  • Custom Drawable Assets: A comprehensive set of custom XML drawable files has been introduced into the res/drawable directory. These files replicate the visual appearance of the Material Icons previously used, ensuring consistent UI without external dependencies.
  • Widespread Codebase Updates: Numerous UI components and data models across the application, including Filter.kt, Filters.kt, GradientTintedIconButton.kt, QuantitySelector.kt, DestinationBar.kt, FilterScreen.kt, Home.kt, and Cart.kt, have been updated to reflect the new icon handling approach, replacing ImageVector references with R.drawable IDs.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request migrates the Jetsnack app to use local drawable resources instead of Material Icons Extended. This improves performance by removing a large dependency and using drawables, and the code changes reflect this by replacing ImageVector with @DrawableRes Int and using painterResource to load the drawables.


@Stable
class Filter(val name: String, enabled: Boolean = false, val icon: ImageVector? = null) {
class Filter(val name: String, enabled: Boolean = false, @DrawableRes val icon: Int? = null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider making icon a non-nullable Int with a default value instead of a nullable Int. This would simplify usage and avoid null checks where the icon is always expected to be present. If there are cases where an icon is truly optional, then the current approach is acceptable.

Suggested change
class Filter(val name: String, enabled: Boolean = false, @DrawableRes val icon: Int? = null) {
class Filter(val name: String, enabled: Boolean = false, @DrawableRes val icon: Int = R.drawable.default_icon) {

@@ -209,7 +205,7 @@ fun JetsnackBottomBar(
JetsnackBottomNavigationItem(
icon = {
Icon(
imageVector = section.icon,
painter = painterResource(id = section.icon),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It would be useful to add a comment explaining why section.icon is being used as the id for painterResource. This would help future developers understand the relationship between the HomeSections enum and the drawable resources.

Suggested change
painter = painterResource(id = section.icon),
painter = painterResource(id = section.icon), // section.icon is the resource id of the drawable

@JolandaVerhoef JolandaVerhoef merged commit 035c113 into main Jul 7, 2025
2 checks passed
@JolandaVerhoef JolandaVerhoef deleted the jv/jetsnack-new-icons branch July 7, 2025 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants