Created
July 30, 2013 18:38
-
-
Save ricardoalcocer/6115571 to your computer and use it in GitHub Desktop.
Alloy JMK file to transfer Android settings from the tiapp.xml to the Alloy assets folder. The use-case for this is that you can know at runtime which Holo Theme the app is using (if any) and based on this, make UI/UX or graphic decisions like setting colors, images, etc. Next on this idea is an app.tss with pre-defined color for Holo Dark and H…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task("pre:compile",function(event,logger){ | |
var fs = require('fs'), | |
xml2js = require('xml2js'); | |
var parser = new xml2js.Parser(); | |
parser.addListener('end', function(result) { | |
var androidSettings=JSON.stringify(result["ti:app"].android[0]); | |
fs.writeFile(event.dir.project + '/app/assets/holosettings.json', androidSettings, function (err) { | |
if (err) throw err; | |
logger.info('It\'s saved!'); | |
}); | |
}); | |
fs.readFile(event.dir.project + '/tiapp.xml', function(err, data) { | |
parser.parseString(data); | |
}); | |
}); | |
task("post:compile",function(event,logger){ | |
logger.info('compile finished!'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment