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

Implement more extensions to access android resources #110

Closed
MarinaShaposhnikova opened this issue Jan 3, 2024 · 0 comments · Fixed by #111
Closed

Implement more extensions to access android resources #110

MarinaShaposhnikova opened this issue Jan 3, 2024 · 0 comments · Fixed by #111
Assignees
Labels
enhancement New feature or request

Comments

@MarinaShaposhnikova
Copy link

Steps to reproduce:

  1. Open ContextUtils.kt
  2. Observe only 3 ext methods
  3. Call Vacxe

Expected Results:

  • What did you expect to happen?

I would like to have more extension to use because right now the codebase is not consistent.
We use the ext method getResourceString to access the string, but if we would like to access the string with args or a quantity string, we have to either have our own ext or invoke InstrumentationRegistry directly.

Relevant Code:

fun getQuantityString(@PluralsRes resId: Int, quantity: Int) = 
 InstrumentationRegistry.getInstrumentation().targetContext.resources.getQuantityString(
              resId,
              quantity,
          )
fun getResourceString(@StringRes resId: Int, vararg args: Any) = 
  InstrumentationRegistry.getInstrumentation().targetContext.resources.getString(
              resId,
              args,
          ) 

PR with reproduction on Sample App

  • See: #
@Vacxe Vacxe self-assigned this Jan 3, 2024
@Vacxe Vacxe added the enhancement New feature or request label Jan 3, 2024
@Vacxe Vacxe closed this as completed in #111 Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants