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 iconStore = Ti.Filesystem.applicationDataDirectory + '/CachedRemoteImages'; | |
| var dir = Ti.Filesystem.getFile(iconStore); | |
| if (!dir.exists()) { | |
| dir.createDirectory(); | |
| } | |
| function cacheRemoteURL(image, imageURL) { | |
| if (imageURL) { | |
| var hashedSource = Ti.Utils.md5HexDigest(imageURL + '') + '.' + imageURL.split('.').pop(); | |
| var localIcon = Ti.Filesystem.getFile(iconStore, hashedSource); | |
| if (localIcon.exists()) { |
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
| // This is the Android version of the Tweetie-like pull to refresh table: | |
| // http://developer.appcelerator.com/blog/2010/05/how-to-create-a-tweetie-like-pull-to-refresh-table.html | |
| var win = Ti.UI.currentWindow; | |
| var alertDialog = Titanium.UI.createAlertDialog({ | |
| title: 'System Message', | |
| buttonNames: ['OK'] | |
| }); | |
| var scrollView = Ti.UI.createScrollView({ |
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 url = "http://maps.google.com/maps/ms?ie=UTF&msa=0&msid=217110902183005084784.00049d962454fabcabdc2&output=kml"; | |
| //Add routes from a remote KML file to one map | |
| goog.maps.kml.addRoutesToMap(mySingleMap, url); | |
| //Multiple Maps | |
| goog.maps.kml.addRoutesToMap([myGoogleMap1, myGoogleMap2], url); |
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 win = Ti.UI.createWindow({ backgroundColor: '#fff' }); | |
| var web = Ti.UI.createWebView({ | |
| url: 'http://www.appcelerator.com/' | |
| }); | |
| var linkJS = 'document.titaniumLinkQueue = [];' | |
| + '(function(){' | |
| + 'var links = document.getElementsByTagName("a");' | |
| + 'for(var i = 0, l = links.length; i < l; i++) {' |
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
| /** | |
| * PHP-like print_r() equivalent for JavaScript Object | |
| * | |
| * @author Faisalman <fyzlman@gmail.com> | |
| * @license http://www.opensource.org/licenses/mit-license.php | |
| * @link http://gist.github.com/879208 | |
| */ | |
| var print_r = function (obj, t) { | |
| // define tab spacing |
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
| /* | |
| Developed by Kevin L. Hopkins (http://kevin.h-pk-ns.com) | |
| You may borrow, steal, use this in any way you feel necessary but please | |
| leave attribution to me as the source. If you feel especially grateful, | |
| give me a linkback from your blog, a shoutout @Devneck on Twitter, or | |
| my company profile @ http://wearefound.com. | |
| /* Expects parameters of the directory name you wish to save it under, the url of the remote image, | |
| and the Image View Object its being assigned to. */ | |
| cachedImageView = function(imageDirectoryName, url, imageViewObject) |
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
| function log(object) { | |
| Ti.API.debug(object); | |
| if(logger) { | |
| logger.log(object); | |
| }; | |
| }; | |
| var indWin = null; | |
| var actInd = null; |
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
| /** | |
| * This sample lets you record and share video with Appcelerator Titanium on Android. | |
| * REQUIRES THE 1.6.0 RC OF TITANIUM MOBILE SDK | |
| * http://developer.appcelerator.com/blog/2011/02/release-candidate-for-titanium-mobile-1-6-0.html | |
| */ | |
| /** | |
| * First, create our UI. We'll have two buttons: record, and share. | |
| */ | |
| var win = Titanium.UI.createWindow({ |
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 win = Ti.UI.createWindow({ backgroundColor: '#fff' }); | |
| var button = Ti.UI.createButton({ title: 'Share' }); | |
| win.add(button); | |
| win.open(); | |
| button.addEventListener('click', function() { | |
| var intent = Ti.Android.createIntent({ | |
| action: Ti.Android.ACTION_SEND, | |
| type: 'text/plain' | |
| }); |
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
| /** | |
| * Creates a grid that you can click on. | |
| * @param options | |
| */ | |
| function createGrid(options) { | |
| // default options | |
| var defaultOptions = { | |
| gridViewOptions: { | |
| top: 0, |