-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add ImageVector support to the preference datastore ui #2
Conversation
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.
Thanks a lot for the changes.
I have reviewed them and am currently a bit torn apart about the way you've implemented the image vector support. What if we take a bit of convenience away from the composables and only expose the following attributes:
icon: @Composable (() -> Unit)? = null,
iconSpaceReserved: Boolean,
on each composable that has an icon? Basically we (almost) eliminate the need for maybeJetIcon, we only need the ({ })
composable if iconSpaceReserved=true. What we definitely save is duplication of all composables which reduces maintainability issues going on. In the FlorisBoard code base we can introduce a convenience function which makes an icon composable from a drawable id or an ImageVector. Would also solve the awkward need to specify imageVector=null on the composable if I see it correctly.
You do not need to mark any of the old functions as deprecated as jetpref has not had any stable release yet so breaking API changes are expected.
41cee15
to
ef7b65f
Compare
I've thought about it a bit and I think I've found a good option via the JetIcon interface. |
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.
Thanks a lot for the changes! I've had a look at the changes and like the JetIcon idea! There are some issues/questions though that need clarification or fixing. (See comments)
datastore-ui/src/main/kotlin/dev/patrickgold/jetpref/datastore/ui/JetIcon.kt
Show resolved
Hide resolved
datastore-ui/src/main/kotlin/dev/patrickgold/jetpref/datastore/ui/DialogSliderPreference.kt
Outdated
Show resolved
Hide resolved
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.
Thanks for the fix, I've re-reviewed your incoming changes. After this iteration I think the code should be ready to merge
datastore-ui/src/main/kotlin/dev/patrickgold/jetpref/datastore/ui/JetIcon.kt
Outdated
Show resolved
Hide resolved
datastore-ui/src/main/kotlin/dev/patrickgold/jetpref/datastore/ui/JetIcon.kt
Outdated
Show resolved
Hide resolved
datastore-ui/src/main/kotlin/dev/patrickgold/jetpref/datastore/ui/JetIcon.kt
Show resolved
Hide resolved
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.
Reviewed again and tested out locally, everything checks out fine, merging into main. Thanks for the efforts!
For test using you'd have to use snapshots, here temporarily enable the jitpack repo in the core repo and then use the version table from here to grab a snapshot version (easier than using maven snapshots) |
This is required to fully switch to ImageVectors in the https://github.com/florisboard/florisboard project.
The old method of using Drawable Ids is still supported.
Consideration may be given to deprecating these methods.