[TIMOB-15200] Android: ImageView.image from XHR no longer shows new image
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-09-18T18:59:30.000+0000 |
Affected Version/s | n/a |
Fix Version/s | 2013 Sprint 19, 2013 Sprint 19 API, Release 3.1.3, Release 3.2.0 |
Components | Android |
Labels | imageView, qe-closed-3.1.3, qe-testadded |
Reporter | Nic Jansma |
Assignee | Ping Wang |
Created | 2013-09-15T23:43:08.000+0000 |
Updated | 2013-10-09T15:41:23.000+0000 |
Description
After installing SDK 3.1.3.v20130913160104 to verify the fix for TIMOB-14777
i.e. https://github.com/appcelerator/titanium_mobile/pull/4657
I have found that setting the .image property on an ImageView does not show the actual image.
Here's a reduced repro (that can be placed into FirstView.js after creating a new project, for example):
var win = Ti.UI.createWindow();
function FirstView() {
var imageView = Ti.UI.createImageView();
var xhr = Ti.Network.createHTTPClient();
xhr.onload = function() {
imageView.image = xhr.responseData;
};
xhr.open('GET', 'http://nicj.net/wd-icon-small.png');
xhr.send();
return imageView;
}
var v = FirstView();
win.add(v);
win.open();
On SDK 3.1.2, the logo shows up.
On SDK 3.1.3.v20130913160104, the logo does not show up.
The XHR.onload event does fire, but it appears setting imageView.image has no effect.
I suspect that it may be related to the fix I mention TIMOB-14777.
Attachments
File | Date | Size |
---|---|---|
3.1.2.GA.png | 2013-09-18T16:51:25.000+0000 | 33808 |
3.1.3.png | 2013-09-18T16:51:25.000+0000 | 23929 |
I have this issue too. I assume that in TiUIImageView.java (lines 140 and 227)
returns null, when an image is set from a blob. With the fix mentioned in the description, the image bitmap will never be set in this case.
Pull Request for my fix: https://github.com/appcelerator/titanium_mobile/pull/4710
The bug is reproducible with: Appcelerator Studio, build: 3.1.3.201309132456 Titanium SDK, build: 3.1.3.v20130917141554 CLI 3.1.2 Alloy 1.2.2-cr code-processor 1.0.3-cr GalaxyS3 Android version 4.0.4 See screenshots
master PR: https://github.com/appcelerator/titanium_mobile/pull/4711 3.1.x PR: https://github.com/appcelerator/titanium_mobile/pull/4712
[~philet] thanks very much for your work. Your PR is great. The only problem is the additional check is not necessary for the method handleCacheAndSetImage which is only used in downloadListener, since the downloaded image must have a url. Due to the tight time schedule for the release 3.1.3, I submitted another PR which only adds the additional check in loadImageListener. PR: https://github.com/appcelerator/titanium_mobile/pull/4711 3_1_X PR: https://github.com/appcelerator/titanium_mobile/pull/4712
Tested and verified the fix with: Appcelerator Studio, build: 3.1.3.201309132456 Titanium SDK, build: 3.1.3.GA CLI 3.1.2 Alloy 1.2.2 code-processor 1.0.3 Device: Nexus7 Android version:4.3 The image is shown