[TIMOB-8582] BlackBerry: Implement important Gesture functionality
GitHub Issue | n/a |
---|---|
Type | Story |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-04-30T06:53:43.000+0000 |
Affected Version/s | Backlog |
Fix Version/s | 2013 Sprint 09 BB, 2013 Sprint 09, Release 3.2.0 |
Components | BlackBerry |
Labels | notable |
Reporter | Francois Boisvert |
Assignee | Josh Roesslein |
Created | 2012-04-06T06:36:38.000+0000 |
Updated | 2017-03-03T06:41:14.000+0000 |
Description
Implement the Gesture module.
Acceptance Test
function orientationToString(orientation) {
switch (orientation) {
case Ti.UI.PORTRAIT:
return 'portrait';
case Ti.UI.UPSIDE_PORTRAIT:
return 'upside portrait';
case Ti.UI.LANDSCAPE_LEFT:
return 'landscape left';
case Ti.UI.LANDSCAPE_RIGHT:
return 'landscape right';
case Ti.UI.FACE_UP:
return 'face up';
case Ti.UI.FACE_DOWN:
return 'face down';
default:
return 'unknown';
}
}
var win = Ti.UI.createWindow({
backgroundColor: 'red',
layout: 'vertical'
});
var labelA = Ti.UI.createLabel({
width: Ti.UI.FILL,
text: 'e.orientation = N/A'
});
win.add(labelA);
var labelB = Ti.UI.createLabel({
width: Ti.UI.FILL,
text: 'Gesture.orientation = N/A'
});
win.add(labelB);
var labelC = Ti.UI.createLabel({
width: Ti.UI.FILL,
wrap: true,
text: 'No shake yet.'
});
win.add(labelC);
function onShake(e) {
Ti.API.info('Shake: {' + e.x + ', ' + e.y + ', ' + e.z + '}');
labelC.text = 'Shake!';
win.backgroundColor = 'yellow';
setTimeout(function() {
labelC.text = 'No shake yet.';
win.backgroundColor = 'red';
}, 500);
}
var toggleShake = Ti.UI.createButton({
title: 'Toggle Shake'
});
var shakeEnabled = false;
toggleShake.addEventListener('click', function() {
shakeEnabled ? Ti.Gesture.removeEventListener('shake', onShake)
: Ti.Gesture.addEventListener('shake', onShake);
shakeEnabled = !shakeEnabled;
});
win.add(toggleShake);
Ti.Gesture.addEventListener('orientationchange', function(e) {
labelA.text = 'e.orientation = ' + orientationToString(e.orientation);
labelB.text = 'Gesture.orientation = ' + orientationToString(Ti.Gesture.orientation);
});
win.open();
Created pull request [#30](https://github.com/appcelerator/titanium_mobile_blackberry/pull/30).
Closing ticket due to Blackberry no longer being supported.