-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[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
Conversation
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.
There was a problem hiding this 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'sbuild.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
, andCart.kt
, have been updated to reflect the new icon handling approach, replacingImageVector
references withR.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
-
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. ↩
There was a problem hiding this 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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
painter = painterResource(id = section.icon), | |
painter = painterResource(id = section.icon), // section.icon is the resource id of the drawable |
Migrates icons from Material Icons Extended to local drawable resources. This change removes the
androidx.compose.material.iconsExtended
dependency and replacesImageVector
instances with@DrawableRes
integers throughout the codebase.