Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10824] Android: backgroundColor/backgroundImage/backgroundRepeat compositing not working with heavyweight windows

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-01-28T06:35:12.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sRelease 3.0.2, Release 3.1.0, 2013 Sprint 02 API, 2013 Sprint 02
ComponentsAndroid
Labelsapi, module_window, qe-testadded, triage
ReporterBenjamin Hatfield
AssigneeVishal Duggal
Created2012-09-10T12:17:32.000+0000
Updated2013-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();

Comments

  1. Sean Hussey 2012-10-18

  2. Davide Cassenti 2012-11-13

    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.
  3. Ping Wang 2013-01-23

    It's a duplicate of TIMOB-11269 which has been already fixed in 3.0.2 and 3.1.0.
  4. Vishal Duggal 2013-01-24

    This is not a duplicate of TIMOB-11269. Reopening
  5. Vishal Duggal 2013-01-24

    Pull pending https://github.com/appcelerator/titanium_mobile/pull/3776
  6. Vishal Duggal 2013-01-24

    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;
       })
       
  7. Vishal Duggal 2013-01-28

    Backport PR https://github.com/appcelerator/titanium_mobile/pull/3804
  8. Ping Wang 2013-01-28

    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
  9. Shyam Bhadauria 2013-01-29

    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

JSON Source