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
| // For iOS7 only, set the window's top to 20 so they start under the status bar. | |
| Alloy.Globals.windowTop = (OS_IOS && parseInt(Ti.Platform.version[0], 10) >= 7) ? 20 : 0; | |
| // Optionally set the backgroundColor or backgroundImage to show behind the statusbar. | |
| // Please note that the backgroundImage will cover the full screen, but only top 20px is visible. | |
| // Ti.UI.backgroundColor = '#555'; | |
| // Ti.UI.backgroundImage = 'statusBar_bg.png'; |
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
| // For iOS7 only, set the window's top to 20 so they start under the status bar. | |
| Alloy.Globals.windowTop = (OS_IOS && parseInt(Ti.Platform.version[0], 10) >= 7) ? 20 : 0; |
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
| var Utils = { | |
| /* modified version of https://gist.github.com/1243697 | |
| * adds detection of file extension rather than hard-coding .jpg as in the original | |
| */ | |
| _getExtension: function(fn) { | |
| // from http://stackoverflow.com/a/680982/292947 | |
| var re = /(?:\.([^.]+))?$/; | |
| var tmpext = re.exec(fn)[1]; | |
| return (tmpext) ? tmpext : ''; | |
| }, |
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
| ".btn": { | |
| borderSize: 1, | |
| borderColor: '#1881f9', | |
| borderRadius: 3, | |
| color: '#1881f9', | |
| height: 26, | |
| style: Ti.UI.iPhone.SystemButtonStyle.PLAIN, | |
| font: { | |
| fontSize: 15, | |
| fontFamily: 'HelveticaNeue' |
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
| 'Label[platform=android]': { | |
| color: '#000' // all platforms except Android default to black | |
| } | |
| 'Window': { | |
| backgroundColor: '#fff' // white background instead of default transparent | |
| } | |
| 'Window[platform=android]': { | |
| modal: false // make android windows all heavyweight |
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
| /** | |
| * Javascript example patterns | |
| */ | |
| /** | |
| * Singleton Object | |
| * Should be used for global, static objects. You should not place memory | |
| * intensive items in here unless they are meant to be used throughout the application | |
| * at anytime. If the item is meant to be reused or instantiated multiple times | |
| * a singleton should not be used. |
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
| // I am pretty sure there is a sexier approach, but this works nicely | |
| var isPhone5 = Ti.Platform.displayCaps.platformHeight == 568; | |
| parse568hImages = function(imagePath) { | |
| if (isPhone5){ | |
| // Do this because the filename could contain dots | |
| imagePath = imagePath.replace(".png","-568h@2x.png"); | |
| imagePath = imagePath.replace(".jpg","-568h@2x.jpg"); | |
| imagePath = imagePath.replace(".jpeg","-568h@2x.jpeg"); | |
| } |
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
| var xhr = Titanium.Network.createHTTPClient(); | |
| xhr.onload = function() | |
| { | |
| var results = this.responseText; | |
| Ti.API.info('Results from xhr Lookup = ' + results ); | |
| var supportDir = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory,'my_support'); | |
| if(!supportDir.exists()){ | |
| supportDir.createDirectory(); | |
| } |
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
| var myFunction = function() { | |
| if(typeof arguments[0] == 'function') { | |
| arguments[0](); // throws error: [object Object] is not a function | |
| // but this works | |
| var cb = arguments[0]; | |
| cb(); | |
| } | |
| }; | |
| myFunction(function() { |
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
| var Utils = { | |
| /* modified version of https://gist.github.com/1243697 | |
| * adds detection of file extension rather than hard-coding .jpg as in the original | |
| */ | |
| _getExtension: function(fn) { | |
| // from http://stackoverflow.com/a/680982/292947 | |
| var re = /(?:\.([^.]+))?$/; | |
| var tmpext = re.exec(fn)[1]; | |
| return (tmpext) ? tmpext : ''; | |
| }, |
OlderNewer