Suggested change in ListViewImageManager.getImageFromId

10 views
Skip to first unread message

roee88

unread,
Jul 3, 2011, 11:55:23 AM7/3/11
to android-appwidget-extensions
Currently for opening image resources Drawable.createFromStream is
used.
However createFromStream should only be used for raw resources and not
for density aware image drawables.

If possible could someone please apply the following patch (requires
API >= 4).
Thanks,
Roee.


Index: src/mobi/intuitit/android/widget/ListViewImageManager.java
===================================================================
--- src/mobi/intuitit/android/widget/ListViewImageManager.java
(revision 91)
+++ src/mobi/intuitit/android/widget/ListViewImageManager.java
(working copy)
@@ -107,10 +107,12 @@
if (LOGD)
Log.d(TAG, "image ID decoded");

- InputStream rawResource =
ctx.getResources().openRawResource(imgId);
+ Resources resources = ctx.getResources();
+ TypedValue value = new TypedValue ();
+ InputStream rawResource = resources.openRawResource(imgId, value);
try
{
- drawable = Drawable.createFromStream(rawResource,
ctx.getResources().getResourceName(imgId));
+ drawable = Drawable.createFromResourceStream(resources, value,
rawResource, resources.getResourceName(imgId));
}
finally
{

AnderWeb Webbs

unread,
Jul 4, 2011, 2:44:16 AM7/4/11
to android-appwid...@googlegroups.com

It looks good to me but Boombuler must approve :)

Florian Sundermann

unread,
Jul 4, 2011, 7:52:22 AM7/4/11
to android-appwid...@googlegroups.com
Looks good to me... Francois what do you think?

2011/7/4 AnderWeb Webbs <ande...@gmail.com>:

Francois DESLANDES

unread,
Jul 6, 2011, 3:04:44 AM7/6/11
to android-appwid...@googlegroups.com
I'll make some test during next week-end ;)


2011/7/4 Florian Sundermann <boom...@googlemail.com>



--
Francois Deslandes @ Pure widgets - Android widgets

Reply all
Reply to author
Forward
0 new messages