{ "id": "103738", "key": "TIMOB-11844", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2012-10-21T15:55:07.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updated": "2016-06-30T04:38:10.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "*Problem description*\r\nWhen you use a preferences.xml file, you would expect its default values to be set upon project creation. So I added a loadPreferences, method, you can use that method to load default values for a preference file. Moreover, upon app start, the default preferences file (xml.preferences) is automatically loaded.\r\n\r\n*Test case*\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : 'white'\r\n});\r\n\r\nwin.addEventListener('open', function() {\r\n\tif (Ti.App.Properties.hasProperty('testmeprop')) {\r\n\t\talert('property testmeprop exists!');\r\n\t} else {\r\n\t\talert('property testmeprop DOES NOT EXIST!');\r\n\t}\r\n});\r\nwin.open();\r\n{code}\r\n\r\nI attached the example preferences.xml.", "attachment": [ { "id": "32859", "filename": "preferences.xml", "author": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "created": "2012-10-21T15:55:07.000+0000", "size": 477, "mimeType": "text/xml" } ], "flagged": false, "summary": "Android: preferences.xml: load defaults on start", "creator": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "environment": "Titanium 3.1.0 master\r\nAndroid 4.0.3", "closedSprints": [ { "id": 50, "state": "closed", "name": "2014 Sprint 09 Tooling", "startDate": "2014-04-28T15:43:24.381Z", "endDate": "2014-05-10T03:44:00.000Z", "completeDate": "2014-05-12T13:36:16.254Z", "originBoardId": 113 } ], "comment": { "comments": [ { "id": "224584", "author": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "body": "pull request https://github.com/appcelerator/titanium_mobile/pull/3311", "updateAuthor": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "created": "2012-10-21T15:56:53.000+0000", "updated": "2012-10-21T15:56:53.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }