Skip to content
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

Use wrappers for system resources like Colors, Images and Styles #626

Open
vpodlesnyak opened this issue Jan 20, 2023 · 0 comments
Open
Labels
1.x.x expected somewhere in a future release component:resources

Comments

@vpodlesnyak
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Using type alias is more resource effective but also makes it hard to write unit tests and support configuration changes.

In case of a wrapper it'd be possible to write unit tests instead of instrumented tests as values could be compared by resource id

Describe the solution you'd like
Create wrappers like

interface KalugaColor {
   val value: PlatformSpecificColor
}

class DefaultKalugaColor(private val id: String) {
    override fun equals(other: Any?): Boolean = ... // compare by id
    override fun toString(): String = // print debug info, like id and maybe hex representation
    
    val value: PlatformSpecificColor get() = // load color by id every time to seamlessly support config change, the loading itself is cached on the system level
}
@Daeda88 Daeda88 added the 1.x.x expected somewhere in a future release label Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x.x expected somewhere in a future release component:resources
Projects
None yet
Development

No branches or pull requests

2 participants