To make sure your lay-outs look pretty much the same on all devices, including the thousands of different Android resolutions and densities, it's always best to use the 'dp' unit. However, typing '10dp'
instead of 10
is quite a pain. A pain you can easily take away by changing the default unit in your tiapp.xml
.
This file contains 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
// How Publish a Tweet (Titanium) | |
// Full Codebird API is here: https://github.com/mynetx/codebird-js | |
// Codebird for Appcelerator Titanium. Using the Twitter API 1.1: https://gist.github.com/viezel/5781083 | |
//THANKS VIEZEL | |
This file contains 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
cachedImageView = function(basedir, uri, obj, attr, cacheage) { | |
/** | |
Appcelerator Titanium ImageView /w cache | |
This function attempts to cache a remote image and then returns it again | |
when it's requested. | |
The file is stored in a directory "basedir," this is to try and help | |
you keep files unique. It's not special or magical, but not dirty either. |
This file contains 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'm using this now in my Alloy runtime testing to assert that the | |
// proper styles are getting assigned to Titanium proxy objects. The | |
// deep comparison is necessary for objects like font in the style. So | |
// for my purposes the accuracy of the results far supercedes the lack | |
// of blazing performance with this code. I'm using underscore.js as | |
// it's part of Alloy, but isX() calls could easily be filled out in | |
// a couple lines of JS. | |
// | |
// Obviously due to the use of JSON.stringify() the objects to be | |
// compared need to be JSON serializable. |
I guess just like me you like to do alert('My message');
instead of:
Ti.UI.createAlertDialog({
message: 'My message'
}).show();
But I'd even more like to do alert('My message', 'My title', myCallback);
instead of:
Execute "tishadow run" in your Titanium app directory whenever a JavaScript file changes. Edit your JS files in a text editor, save, then switch to the test device or simulator. Profit.
[sudo] npm install -g supervisor