[TIMOB-10824] Android: backgroundColor/backgroundImage/backgroundRepeat compositing not working with heavyweight windows
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2013-01-28T06:35:12.000+0000 |
| Affected Version/s | Release 3.0.0 |
| Fix Version/s | Release 3.0.2, Release 3.1.0, 2013 Sprint 02 API, 2013 Sprint 02 |
| Components | Android |
| Labels | api, module_window, qe-testadded, triage |
| Reporter | Benjamin Hatfield |
| Assignee | Vishal Duggal |
| Created | 2012-09-10T12:17:32.000+0000 |
| Updated | 2013-10-01T09:39:39.000+0000 |
Description
When compositing the backgroundColor and backgroundImage, it works fine with lightweight windows but not with heavyweight windows (unless a view is added specifying the two params). See code samples below. For the heavyweight window, it is ignoring the backgroundColor. Also, setting windowPixelFormat: Ti.UI.Android.PIXEL_FORMAT_TRANSLUCENT has not effect. Might be related to TIMOB-4800.
NOT WORKING:
var win = Ti.UI.createWindow({
backgroundColor: 'orange',
backgroundImage: 'KS_nav_views.png',
modal: false,
});
win.open();
BOTH OF THESE WORK:
1. LIGHTWEIGHT:
var win = Ti.UI.createWindow({
backgroundColor: 'orange',
backgroundImage: 'KS_nav_views.png',
});
win.open();
2. HEAVYWEIGHT W/ VIEW:
var win = Ti.UI.createWindow({
modal: false,
});
var view = Ti.UI.createView ({
backgroundColor: 'orange',
backgroundImage: 'KS_nav_views.png',
});
win.add(view);
win.open();
The problem is also extended to backgroundRepeat: if the window is heavyweight (modal, fullscreen etc.), the image takes the whole screen even if backgroundRepeat is set to true. I confirm the other behaviors, also with 2.1.4.GA and 3.0.0.
It's a duplicate of TIMOB-11269 which has been already fixed in 3.0.2 and 3.1.0.
This is not a duplicate of TIMOB-11269. Reopening
Pull pending https://github.com/appcelerator/titanium_mobile/pull/3776
Test Code
var win = Ti.UI.createWindow({ modal: false, exitOnClose:true }); var btn1 = Ti.UI.createButton({ top:10, title:'TOGGLE BGIMAGE' }) var btn2 = Ti.UI.createButton({ title:'TOGGLE BGCOLOR' }) var btn3 = Ti.UI.createButton({ bottom:10, title:'TOGGLE BGREPEAT' }) win.add(btn1); win.add(btn2); win.add(btn3); win.open(); var hasImage = false; var hasColor = false; var hasRepeat = false; btn1.addEventListener('click',function(){ if(hasImage == false) { win.backgroundImage = 'KS_nav_views.png'; } else { win.backgroundImage = null; } hasImage = !hasImage; }) btn2.addEventListener('click',function(){ if(hasColor == false) { win.backgroundColor = 'orange'; } else { win.backgroundColor = null; } hasColor = !hasColor; }) btn3.addEventListener('click',function(){ hasRepeat = !hasRepeat; win.backgroundRepeat = hasRepeat; })Backport PR https://github.com/appcelerator/titanium_mobile/pull/3804
KS needs to update based on this fix. KS PR for master: https://github.com/appcelerator-developer-relations/KitchenSink/pull/85 KS PR for 3_0_X: https://github.com/appcelerator-developer-relations/KitchenSink/pull/86
It is now compositing the mentioned properties. Environment used for verification - Titanium SDK: 3.0.2.v20130128174806 Titanium Studio: 3.0.2.201301251115 Device : Samung GALAXY Tab 620 Android 3.2 and Samsung GALAXY Note Android 2.3.6 Machine OS : MAC 10.8