Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3213] Ti.App.Properties 'change' event parity for Android

GitHub Issuen/a
TypeNew Feature
Priorityn/a
StatusClosed
ResolutionDuplicate
Resolution Date2012-07-31T10:14:03.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsevent, ios, properties
ReporterBlain Hamon
AssigneeShak Hossain
Created2012-07-31T10:02:09.000+0000
Updated2016-03-08T07:57:37.000+0000

Description

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') // 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();

Attachments

FileDateSize
test.zip2012-07-31T10:02:10.000+00009093

Comments

  1. Blain Hamon 2012-07-31

    Moving issue into TIMOB-10260
  2. Shak Hossain 2014-01-03

JSON Source