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.UI.setBackgroundColor('#000'); | |
// Create a window | |
var win = Titanium.UI.createWindow({ | |
title:'Web Test', | |
backgroundColor:'#fff' | |
}); | |
// and now a webView | |
var webview1 = Titanium.UI.createWebView({url:'somePage.html'}); |
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
/* | |
Bullet Proof window drag | |
This is the most performant window dragging code | |
I could come up with. All the example on | |
developer.appcelerator.com we laggy | |
Version 2: More contained version | |
*/ |
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
/* | |
* Copyright (c) 2008 David Crawshaw <[email protected]> | |
* | |
* Permission to use, copy, modify, and distribute this software for any | |
* purpose with or without fee is hereby granted, provided that the above | |
* copyright notice and this permission notice appear in all copies. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
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 btnCamera = Ti.UI.createButton({ | |
title: 'Record', | |
top: 500, | |
left: 910, | |
width: 100, | |
height: 100, | |
borderColor: "#FFF", | |
borderRadius: 50, | |
borderWidth: 3, | |
backgroundImage: 'none', |
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.showCamera({ | |
success:function(event) | |
{ | |
var cameraView = Titanium.UI.createImageView({width:'auto', height:'auto', top: 0, left: 0, image: event.media}); | |
var imageNew0 = cameraView.toImage(function(e){ | |
var filename1 = Titanium.Filesystem.applicationDataDirectory + "/NAMEOFTHEPICTURE1.png"; | |
f1 = Titanium.Filesystem.getFile(filename1); | |
f1.write(e.blob); | |
Titanium.Media.saveToPhotoGallery(f1); | |
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.showCamera({ | |
allowEditing: true, | |
success: function(event) { | |
var image = event.media; | |
var pxhr = Titanium.Network.createHTTPClient(); | |
pxhr.onerror = function() { | |
Ti.UI.createNotification({ | |
message:'Upload failed, please try again.' | |
}).show(); | |
} |
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
/** | |
* Override a tab group's tab bar on iOS. | |
* | |
* NOTE: Call this function on a tabGroup AFTER you have added all of your tabs to it! We'll look at the tabs that exist | |
* to generate the overriding tab bar view. If your tabs change, call this function again and we'll update the display. | |
* | |
* @param tabGroup The tab group to override | |
* @param backgroundOptions The options for the background view; use properties like backgroundColor, or backgroundImage. | |
* @param selectedOptions The options for a selected tab button. | |
* @param deselectedOptions The options for a deselected tab button. |
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 GetLocation(callback){ | |
if (!Ti.Network.online) | |
{ | |
callback({success: false}); | |
return; | |
} | |
var PROVIDER = Titanium.Geolocation.PROVIDER_GPS; | |
var timeout; |
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.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST; | |
Titanium.Geolocation.distanceFilter = 0; | |
var win = Ti.UI.createWindow({backgroundColor: '#fff'}); | |
var label = Ti.UI.createLabel(); | |
win.add(label); | |
win.open(); | |
function reportPosition(e) { | |
if (!e.success || e.error) { |