Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6592] Android: Gesture change event not fired when switching tab

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-07-16T21:50:36.000+0000
Affected Version/sRelease 1.7.6
Fix Version/sSprint 2011-50, Release 1.7.6, Release 1.8.0.1, 2013 Sprint 15 API, 2013 Sprint 15
ComponentsAndroid
Labelsmodule_orientation, parity, qe-3.1.1, qe-testadded
ReporterRadamantis Torres-Lechuga
AssigneeHieu Pham
Created2011-12-12T17:16:50.000+0000
Updated2017-03-21T22:25:20.000+0000

Description

Issue

When user change the tab and then rotate the device, the orientation change event listener is not getting fired. I have attached a sample code and steps to recreate this issue is as below

Steps to reproduce

1. Switch to tab2 2. tilt the device to landscape 3. click on tab1 and rotate the phone to portrait. Now the gesture change event will not be fired.
// 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',
	navBarHidden:false
});
var win3 = Titanium.UI.createWindow({
	title:'Tab 3',
	backgroundColor:'blue',
	navBarHidden:false
});

win3.orientationModes = [
     Titanium.UI.PORTRAIT,
     Titanium.UI.LANDSCAPE_LEFT,
     Titanium.UI.LANDSCAPE_RIGHT];

var bt = Ti.UI.createButton({
	backgroundImage:'default_app_logo.png',
	width:44,
	height:39,
	top:0,
	right:'6.25%'
});

bt.addEventListener('click', function(e) {
	tab1.open(win3);
});

function createnewview(_currOrientation) {
	var ds = [];

	if(_currOrientation === 'landscape') {
		var r1 = Ti.UI.createTableViewRow({
			height:50,
			backgroundColor:'green'
		});
		ds.push(r1);
	} else {
		var r = Ti.UI.createTableViewRow({
			height:50,
			backgroundColor:'yellow'
		});
		ds.push(r);
	}

	return ds;
}

function getOrientation(o) {
	switch (o) {
		case Titanium.UI.PORTRAIT:
			return 'portrait';
		case Titanium.UI.UPSIDE_PORTRAIT:
			return 'portrait';
		case Titanium.UI.LANDSCAPE_LEFT:
			return 'landscape';
		case Titanium.UI.LANDSCAPE_RIGHT:
			return 'landscape';
	}
};

var datasource = createnewview(getOrientation(Titanium.Gesture.orientation));
var tv = Ti.UI.createTableView({
	height : 100,
	data: datasource
});
win1.add( bt);

Ti.Gesture.addEventListener('orientationchange', function(e) {
	alert('changed')
/*setTimeout(function(){
	var _currOrientation = getOrientation(Titanium.Gesture.orientation);
	tv.data = createnewview(_currOrientation)
	if(_currOrientation === 'landscape') {
		tabGroup.animate({
			bottom:-60
		});
		win3.hideNavBar();

	} else {
		tabGroup.animate({
			bottom:0
		});
		win3.showNavBar();
	}
},300);*/
});


var tab1 = Titanium.UI.createTab({
	icon:'KS_nav_views.png',
	title:'Tab 1',
	window:win1
});

// create controls tab and root window
//
var win2 = Titanium.UI.createWindow({
	title:'Tab 2',
	backgroundColor:'blue',
	navBarHidden:false
});

var tab2 = Titanium.UI.createTab({
	icon:'KS_nav_ui.png',
	title:'Tab 2',
	window:win2
});


tabGroup.addTab(tab1);
tabGroup.addTab(tab2);

// open tab group
tabGroup.open();

Expected behavior

If TiSDK 1.8.01 is used the event is fired when we follow the steps above. We could not locate any existing JIRA log that has fixed the issue.

Attachments

FileDateSize
app2.js2011-12-12T17:16:50.000+00002359

Comments

  1. Wilson Luu 2012-01-12

    Closing bug. Verified fix on: SDK build: 1.9.0.v20120112104633 Runtime: V8, Rhino Titanium Studio, build: 1.0.8.201201111843 Device: Droid 3 (2.3.4)
  2. Paras Mishra 2013-05-21

    Issue is reproducible. This is not a regression. Issue occurs since 2.1.4.GA Environment used: Device : Google Nexus 7, Android Version: 4.1 SDK: 3.1.1.v20130517185716 CLI version : 3.1.0 OS : MAC OSX 10.7.5 Appcelerator Studio, build: 3.1.2.201305181607 XCode : 4.5.1
  3. Hieu Pham 2013-07-16

    Tested on Galaxy Nexus and Nexus 7. Unable to reproduce. Gesture events fired as expected.
  4. Lee Morris 2017-03-21

    Closing ticket as the issue cannot be reproduced and due to the above comments.

JSON Source