-
Notifications
You must be signed in to change notification settings - Fork 4
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
[Feature] Asset Provider #13
Conversation
block() | ||
} catch (e: FileNotFoundException) { | ||
// Throw chai exception instead | ||
throw ChaiException("${e.message} is not located in asset folder") |
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.
I'd extend this message to say which asset folder:
- Image
- Icon
- etc.
|
||
object AssetProvider { | ||
|
||
fun image(ctx: Context, path: String): Bitmap = |
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.
I want to add support for other asset types, using generics to reduce the amount of redundancy in creating a bunch of new functions
@hopeman15 are we merging this or leaving a WIP tag on it for a future reWork? |
@tamzi So this isn't done 🙈 I wanted your feedback first to decide whether or not it makes sense to pursue this. Is this what you were thinking, or doe this go in a completely different direction? |
LGTM 👋🏿 |
or in full..makes sense to pursue it! 😄 |
4b9ccec
to
7b3ac9f
Compare
@hopeman15 An interesting improvement: check discussion on this topic here: #19 |
name: Asset Provider
about: A crazy first approach for accessible assets 😅
label: 'WIP'
Description
This is just an idea to handle assets in a more accessible way. There are a few things that I still don't like, such as passing the android context around. I did limit this as best as possible and would work to eliminate it altogether so that one can access the assets without it.
ChaiImage.DCKE_MAIN
vs.ChaiImage.DCKE_MAIN(ctx)
.Anyway, let me know what you think 🙌 Let's discuss this one 🤓
How can this PR be tested?
You can test it in a few ways:
Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
./gradlew --init-script gradle/init.gradle.kts spotlessApply
to automatically apply formatting)Is this your first Pull Request?
./tools/setup.sh
Fixes #<issue_number_goes_here> 🦕
Screenshot