Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-14227

Android: Orientation mode not taken into account with TabGroup unless new window is opened

    Details

    • Type: Bug
    • Status: Reopened
    • Priority: High
    • Resolution: Unresolved
    • Affects Version/s: Release 3.1.0, Release 3.2.0
    • Fix Version/s: None
    • Component/s: Android
    • Labels:
    • Environment:
      • Ti SDK 3.1 GA, 3.2 CI
      • Android 2.2, 2.3.5, 2.3.6
      • OS X 10.8
      • Ti Studio 3.1.0.201304151600

      Description

      Problem
      Locking android window orientation should be straight forward as listed in the wiki, however there is strange buggy behaviour when using a tab group. The following test uses the default 2 tab app that every new mobile project creates, I've altered it so that tapping on the label on window 1 opens a brand new window on the same tab.

      All the windows have been set to heavyweight and have their orientation set outside of the object creation to Ti.UI.PORTRAIT.

      What is expected is that the windows are locked from the start, however what happens is that the device orientation changes cause all the UI to change, until you open a new window on the first tab, then and only then are all the window orientation modes set.

      Test case

      // this sets the background color of the master UIView (when there are no windows/tab groups on it)
      Titanium.UI.setBackgroundColor('#000');
       
      // create tab group
      var tabGroup = Titanium.UI.createTabGroup();
       
      //
      // create base UI tab and root window
      //
      var win1 = Titanium.UI.createWindow({
      	title : 'Tab 1',
      	backgroundColor : '#fff',
      	fullscreen : false
      });
       
      win1.orientationModes = [Ti.UI.PORTRAIT];
       
      var tab1 = Titanium.UI.createTab({
      	icon : 'KS_nav_views.png',
      	title : 'Tab 1',
      	window : win1
      });
       
      var label1 = Titanium.UI.createLabel({
      	color : '#999',
      	text : 'Tap to open new windoe',
      	font : {
      		fontSize : 20,
      		fontFamily : 'Helvetica Neue'
      	},
      	textAlign : 'center',
      	width : 'auto'
      });
       
      label1.addEventListener('click', function(e) {
      	var win3 = Titanium.UI.createWindow({
      		title : 'Win3',
      		backgroundColor : '#fff',
      		fullscreen : false
      	});
      	win3.orientationModes = [Ti.UI.PORTRAIT];
      	tabGroup.activeTab.open(win3);
      });
      win1.add(label1);
       
      //
      // create controls tab and root window
      //
      var win2 = Titanium.UI.createWindow({
      	title : 'Tab 2',
      	backgroundColor : '#fff',
      	fullscreen : false
      });
      win1.orientationModes = [Ti.UI.PORTRAIT];
      var tab2 = Titanium.UI.createTab({
      	icon : 'KS_nav_ui.png',
      	title : 'Tab 2',
      	window : win2
      });
       
      var label2 = Titanium.UI.createLabel({
      	color : '#999',
      	text : 'I am Window 2',
      	font : {
      		fontSize : 20,
      		fontFamily : 'Helvetica Neue'
      	},
      	textAlign : 'center',
      	width : 'auto'
      });
       
      win2.add(label2);
       
      //
      //  add tabs
      //
      tabGroup.addTab(tab1);
      tabGroup.addTab(tab2);
       
      // open tab group
      tabGroup.open();
      
      

      Discussions

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                stereoket Ketan Majmudar
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-16740
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code