Enable resource loading from android.resource URI.#292
Enable resource loading from android.resource URI.#292dnkoutso merged 1 commit intosquare:masterfrom aravance:master
Conversation
|
Thumbs up for this pull request ! |
|
We are reviewing the possibility to add this to next version. Please hold. Code LGTM, but we will need to have some tests for this. |
|
|
We don't really do ETAs. Our open source projects are done in free time so it's all dependent on how much we each have. We try to keep releases regular but I really have no idea when the next one will be. |
|
This can make it for 2.2 but will need tests and ensure the build is green (paste built result here). Ping @aravance |
|
I added some unit tests to verify some elements of the android.resource uri scheme. Any comments or recommendations are welcome. I'm fairly new to real Android unit testing. I plan to try to put it into practice where I work soon, so learning is a good thing. I'm not sure what you mean by "the build is green." It builds successfully: 158 tests, 0 failures, 0 errors, 2 skipped. I have OkHttpDownloaderTest and UrlConnectionDownloadTest @ignored on my machine because they seem to be timing out on my machine. They have to be ignored on my machine with or without this change set. |
There was a problem hiding this comment.
private static final String PACKAGE
|
Thanks! please rebase squash into one commit. It seems like CLA is signed so this can go in! |
|
Reviewing this. |
|
A few minor comments left and I'll merge this. We're ramping up for 2.2 release. |
|
Can you please explain a bit more the use case of this? Are you trying to load bitmaps for other packages? In this case why not use a content provider with a URI? |
|
In my particular use case, I am loading images from the same package, but the android.resource uri format is not currently fully supported. I have images from USB as well as from package resource that I want to show together, and using one uniform method of access is preferred, i.e. URI. I figured while I was implementing the full support for the local package, I would go ahead and implement support comparable to that of ContentResolver. See ContentResolver.openAssetFileDescriptor(Uri, String). I could foresee a use case where one does not have control over a package but knows what is contained therein and wants to access it via URI. |
|
We are reviewing this for merging for 2.2. |
There was a problem hiding this comment.
Method name should be something like getResourceResult.
|
We want to merge this but I am a bit concerned around the extra allocation for While it appears to be nitpicking we want to minimize object allocation as to maintain good performance. You think you can break it up into two methods that provide the resources and the id to use instead? |
|
I like this. You have two |
|
Those snuck their way back in again? Working on multiple machines... I'll
|
|
Thanks! |
Added full support for the android.resource style URI as outlined at the link below.
http://developer.android.com/reference/android/content/ContentResolver.html#openAssetFileDescriptor(android.net.Uri, java.lang.String)