Skip to content
This repository has been archived by the owner on Nov 14, 2018. It is now read-only.

Add context extensions for getBoolean, getInteger, getDimension. #434

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add context extensions for getBoolean, getInteger, getDimension. #434

wants to merge 2 commits into from

Conversation

@JakeWharton
Copy link
Contributor

These are resources. Why should we put them on context?

@CosminMihuMDC
Copy link
Author

CosminMihuMDC commented Mar 13, 2018

@JakeWharton

We already have Context.getString by default in Android Framework. (see https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/content/Context.java#LC555)
So, it could be a good idea to have also other simple methods from Resources in Context to be easily accessed like getString.

Thanks.

@JakeWharton
Copy link
Contributor

Then I think we should either deprecate that method or add these to Context in the framework.

@romainguy
Copy link
Collaborator

getString() exists on Context because it's a very common task to do, a lot more than getBoolean() for instance.

@CosminMihuMDC
Copy link
Author

@romainguy You're right. getBoolean and getInteger are not so often used. On the other hand, getDimension could be really useful as getString is.

@JakeWharton
Copy link
Contributor

But there's two useful variants of retrieving dimensions and you've (arguably) included the less-useful variant despite it's more appealing name.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants