[TIMOB-8518] Android: ImageView does not handle width or height set to Ti.UI.FILL correctly
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-12-13T06:32:58.000+0000 |
Affected Version/s | Release 2.0.0 |
Fix Version/s | Release 2.1.0, Sprint 2012-12 Core |
Components | Android |
Labels | core, module_media, qe-3.2.0, qe-closed-3.2.0, qe-testadded, regression, triage |
Reporter | Opie Cyrus |
Assignee | Ping Wang |
Created | 2012-04-04T15:05:25.000+0000 |
Updated | 2014-06-25T19:12:18.000+0000 |
Description
This behavior can be seen when running the KS (1.8.2 version) camera test. Setting the width for the image view in the success callback to Ti.UI.FILL will result in the bounds of the bitmap created not being able to be determined. A work around of setting width to win.size.width addresses the symptom but there appears to be a timing issue where the bounds of the bitmap are determined before the Ti.UI.SIZE value is computed resulting in massive bitmaps with no scaling. This can result in memory issues.
It is suspected that this is a order of operations issue that needs to be addressed.
@Opie, can you attach an example ?
Test case:
1. Launch the app, and take a picture 2. Click "save" Expected Results: You should see the image in the next screen (a newly created image view) Actual results: You see a white screen and you get an out of memory error in the logs. NOTE: You may need to run this on a phone with a high megapixel camera. I am using galaxy s2.
The problem is that we create a full bitmap that is no scaled when we pass in a value like Ti.UI.FILL. This causes the out of memory exception. We need to handle the Ti.UI.FILL case correctly.
PR ready: https://github.com/appcelerator/titanium_mobile/pull/2378
Verified fix with Titanium Studio, build: 2.1.0.201206221045 Titanium SDK: 2.1.0.v20120622174154 Device: Nexus S 4.0.4
Reopening to update labels.
I am able to reproduce this issue on sdk 3.2.0.v20131122172908.I don't see the image in the imageView after capturing & saving the image. Reopening. Environment: Appcel Studio : 3.2.0.201311221207 Ti SDK : 3.2.0.v20131122172908 Mac OSX : 10.8.5 Alloy : 1.3.0-alpha6 CLI - 3.2.0-alpha Nexus 5 - android 4.4 Samsung Galaxy S4 running android 4.2.2
Before 3.2.0, the white window is a LW window which is the root activity. So the camera activity is on top of the root activity, and when the root activity is resumed (the camera activity is closed), the camera callback is invoked. On 3.2.0, the white window is a HW window. But since opening a HW window is an async process, the camera activity is still on top of the root activity not the window activity. Therefore the camera callback will not be invoked until the root activity is resumed (the window activity is closed). To test this ticket, we can either add
to tiapp.xml, or modify the test case to
Tested Environment: Appcelerator Studio: 3.2.0.201312121648 SDK:3.2.0.v20131212122847 alloy: 1.3.0-cr acs: 1.0.10 npm: 1.3.2 titanium: 3.2.0-cr3 titanium-code-processor: 1.1.0-cr2 Xcode:5.0.2 OS: Mac OSX 10.9 Device: Google Nexus7(v4.3),Iphone5s(v7.0.2) ImageView respecting Ti.UI.Fill for both height and width. Closing as working fine.
Reopening just add qe closed label
Updated label.Hence closing
I have tested it again with Ti SDK 3.2.0, Its working when we set width and height both to Ti.UI.FILL. But if we set only width to Ti.UI.FILL then its not working .