-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Compose resources miss "assets" resources, no way to get Res id from it's name, no way to load bitmap from stream/bytes/file #4494
Comments
I encountered the same issue in my CMP Webview library with CMP 1.6.0. Previously, I would place the HTML files in the |
Would be very useful to be able to load images inside files/ as drawables too. Or let us load drawables by their name as String. |
THank you for the enhancement. We understand your use case and will think about it. |
One of the possible variants is val myDrawable: DrawableResource = Res.getAsDrawableResource("path/to/drawable/file") |
+1 to getting resources by name |
Please, make url paths absolute for JS! NOT: composeResources/package.name/values/strings.commonMain.cvr When url is dynamically changed via window.history.pushState() resources cannot be found giving 404 error |
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks. |
I tried to upgrade compose multiplatform from 1.5.12 to 1.6.0 and found out that I can't load resources anymore :(
Resources are images with metadata which are stored like
commonMain/images/[type]/[imageId]/config.json
commonMain/[type]/[imageId]/image.png
commonMain/[type]/[imageId]/thumbnail.webp
Android has assets api to support own resource hierarchy, compose 1.5.12 successfully loads images in the same way by using path, but in 1.6.0 I only limited to single folder which is really hard to use when you have hundreds of images, which also can have the same name, for example 1.png can be avatar with id 1, and emoji with id 1, but their absolute path is different so no problem with compose 1.5
Even if I write a script which will rename all files and puts in the one folder I can't get avatar_1.png, because there is no api like context.resources.getIdentifier() on android platform
Also there is no api to load images like BitmapFactory.decodeResource on android.
Unfortunately for now I go back to the compose 1.5.12 with handmade font loading & localisation
The text was updated successfully, but these errors were encountered: