Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10260] Android: Ti.App.Properties 'change' event parity for Android

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-09-04T05:16:51.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sRelease 3.0.0, Sprint 2012-18 API
ComponentsAndroid
Labelsapi, module_app_properties, qe-review, qe-testadded
ReporterBlain Hamon
AssigneeHieu Pham
Created2012-07-31T10:09:47.000+0000
Updated2012-12-08T00:47:52.000+0000

Description

Taken from TC-1101: added a "change" event to Ti.App.Properties to listen for changes of Properties The test case comes with a settings.bundle in attachment which allows to really test that feature.
var win = Ti.UI.createWindow({
    backgroundColor: 'white'
});

var info = Ti.UI.createLabel();
win.add(info);

var switchButton = Ti.UI.createSwitch({
    top:40,
     value:Ti.App.Properties.getBool('test', false) // mandatory property for iOS 
});
switchButton.addEventListener('change',function(_event){
    Ti.App.Properties.setBool('test', _event.value);
});
win.add(switchButton);

function onPropertiesChange()
{
    switchButton.value = Ti.App.Properties.getBool('test');
    info.text = 'onPropertiesChange';
    Ti.API.info('onPropertiesChange')
    setTimeout(function(){info.text = '';}, 1000);
}
    
Ti.App.Properties.addEventListener('change',onPropertiesChange);

win.addEventListener('close', function() {
    Ti.App.Properties.removeEventListener('change',onPropertiesChange);
});

win.open();
2. Click on switch button, you should see "onPropertiesChange" in log.

Comments

  1. Anshu Mittal 2012-08-31

    Verified on: SDK:2.2.0.v20120830182512 Studio:2.2.0.v20120830182512 Devices: Samsung galaxy tab(v 3.2)
  2. Shyam Bhadauria 2012-09-04

    Re-opening to edit label

JSON Source