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
/* | |
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
/** | |
* PHP-like print_r() equivalent for JavaScript Object | |
* | |
* @author Faisalman <[email protected]> | |
* @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
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
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
// 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 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
Titanium.Media.openPhotoGallery({ | |
success:function(event){ | |
var myImage = event.media; | |
var xhr = Titanium.Network.createHTTPClient(); | |
xhr.open('POST','http:// ------ /uploads.php'); | |
xhr.onerror = function(e){alert(e.error);}; | |
xhr.setTimeout(200000); |
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.currentWindow; | |
// Images to display (this list can be dynamically generated) | |
var images = [ 'image1.png', 'image2.png', 'image3.png', 'image4.png', | |
'image5.png',' image6.png', 'image7.png', 'image8.png' ]; | |
// Empty table data (will be populated at runtime) | |
var data = []; | |
var table = Ti.UI.createTableView(); |
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.currentWindow; | |
// Set the window orientation modes for the video to rotate with the device | |
win.orientationModes = [ Ti.UI.PORTRAIT, Ti.UI.LANDSCAPE_LEFT, | |
Ti.UI.LANDSCAPE_RIGHT ]; | |
// Build the movie URL. 'fs' and 'autoplay' parameters are optional. | |
var movieId = "d0llSyfgwEE"; | |
var movieUrl = "http://www.youtube.com/embed/" + movieId+ "?fs=1&autoplay=1"; |