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(); | |
Titanium.Facebook.appid = "181219095251677"; | |
Titanium.Facebook.permissions = ['publish_stream', 'read_stream', 'offline_access']; | |
var alertDialog = Titanium.UI.createAlertDialog({ | |
title : 'Facebook', | |
message : 'You need to login with Facebook', | |
buttonNames : ['Login Facebook'] | |
}); |
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() { | |
Titanium.Facebook.appid = "134793934930"; | |
Titanium.Facebook.permissions = ['publish_stream', 'read_stream', 'user_photos', 'friends_photos']; | |
Titanium.Facebook.addEventListener('login', function(e) { | |
if(e.success) { | |
getAlbumCovers(); | |
return; | |
} else if(e.error || e.cancelled) { |
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
var win = Ti.UI.createWindow({ | |
backgroundColor:'white' | |
}); | |
// assume win.entryImage looks like this: file:///sdcard/dcim/Camera/tia-833058780.jpg | |
var f = Ti.Filesystem.getFile('file:///sdcard/DCIM/Camera/maybeoncews.jpg'); | |
var imageView = Titanium.UI.createImageView({ | |
image:f, | |
height:100, |
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
Ti.include(“/customTabBar/customTabBar.js”); | |
var tabGroup = createCustomTabGroup(); |
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 demonstrates how to show suggestions on a text field using just JavaScript with Appcelerator Titanium. | |
* | |
* You will need to download four images to get this to work: | |
* | |
* 1) http://dl.dropbox.com/u/16441391/Suggest/bg.png | |
* 2) http://dl.dropbox.com/u/16441391/Suggest/[email protected] | |
* 3) http://dl.dropbox.com/u/16441391/Suggest/separator.png | |
* 4) http://dl.dropbox.com/u/16441391/Suggest/[email protected] | |
* |
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 udid = require('ti.udid'); | |
var stored_udid = "old saved UDID string"; | |
if(stored_udid === udid.oldUDID) { | |
stored_udid = Ti.Platform.id; | |
//save back to a server or something somewhere | |
} |
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 json = require("com.irlgaming.jsondb"); | |
var collection = json.factory("contacts"); | |
collection.save({ | |
nickname:"Jon" | |
full_name:"John Smith", | |
email:"[email protected]", | |
phone:1234567889, | |
address:"13 Dobney Avenue, Wagga Wagga, NSW, Australia, 2650", | |
loc:{lat:-35.110, lng:147.377}, | |
timestamp:(new Date()).getTime() |
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 o = collection.find({name:/smith/i}, {$limit:1, $sort:{timestamp:1}}); |
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 o = collection.find({loc:{$within:[[5, 5], 0.2]}}, { | |
$sort:{nickname:2}}); | |
for(var i=0; i Ti.API.info(o[i]); | |
} |