Skip to content

Instantly share code, notes, and snippets.

View alanleard's full-sized avatar

Alan Leard alanleard

View GitHub Profile
@alanleard
alanleard / app.js
Created October 4, 2011 05:24
Android Image Rotation within a webview for builtin Pinch zoom
var win = Ti.UI.createWindow();
var web = Ti.UI.createWebView({
html:'<img src="test.jpg"/>',
//url:'http://appcelerator.com'
});
win.add(web);
var button = Ti.UI.createButton({
@alanleard
alanleard / gist:1276487
Created October 10, 2011 20:49
Move and Drop Mapview
var win1 = Titanium.UI.createWindow();
var mapView = Ti.Map.createView({
mapType: Ti.Map.STANDARD_TYPE,
region:{
latitude:33.74511, longitude:-84.38993,
latitudeDelta:0.5, longitudeDelta:0.5
},
animate:true,
regionFit:true,
@alanleard
alanleard / gist:1278595
Created October 11, 2011 16:26
PageFlip with Pinch/Zoom
var win = Ti.UI.currentWindow;
Titanium.PageFlip = Ti.PageFlip = require('ti.pageflip');
var pdf = 'http://assets.appcelerator.com.s3.amazonaws.com/docs/Appcelerator-IDC-Q1-2011-Mobile-Developer-Report.pdf';
var fileName = pdf.split('/').pop();
var pdfFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, fileName);
function downloadPDF() {
var progressBar = Ti.UI.createProgressBar({ max: 1, min: 0, value: 0, visible: true });
win.add(progressBar);
@alanleard
alanleard / app.js
Created October 26, 2011 15:38
Android Camera with Gallery button
var win = Titanium.UI.createWindow({
backgroundColor:'white'
});
win.open();
var toolbar = Titanium.UI.createView({
width:50,
borderColor:'#000',
@alanleard
alanleard / app.js
Created November 7, 2011 19:08
Scrollviews with Zoom inside a Scollableview
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var scrollable = Ti.UI.createScrollableView({
top:0,
bottom:0,
left:0,
@alanleard
alanleard / app.js
Created November 28, 2011 22:53
360 Image Rotation
var win = Ti.UI.createWindow(
{
title: "360 Image Rotation"
});
var images = [];
var imageCount = 4;
var totalCount = imageCount;
@alanleard
alanleard / app.js
Created November 29, 2011 18:21
Drag & Drop Blocks
var win = Titanium.UI.createWindow();
var item1 = Ti.UI.createView({
top:166,
left:180,
height:87,
width:60,
backgroundColor:'blue'
});
@alanleard
alanleard / app.js
Created November 29, 2011 19:58
Dynamic Image Add to ScrollView
var win = Ti.UI.createWindow();
var scrollView = Ti.UI.createScrollView({
contentWidth:'auto',
contentHeight:'auto',
left:0, right:0,
top:200
});
var imageCount = 24;
@alanleard
alanleard / app.js
Created December 6, 2011 05:09
Indicators on Tabgroup & TabbedBar
var win = Ti.UI.createWindow();
var tabGroup = Ti.UI.createTabGroup();
function indicator(count, top, left, color){
var label = Ti.UI.createLabel({
backgroundColor:color,
text:count,
borderColor:'#fff',
borderRadius:10,
@alanleard
alanleard / app.js
Created December 14, 2011 02:46
Network Speed Test
var win = Ti.UI.createWindow();
var start = new Date().getTime();
var c = Titanium.Network.createHTTPClient({validatesSecureCertificate:false});
c.ondatastream = function(){
//start = new Date().getTime();
};
c.onload = function()
{
Ti.API.info('IN ONLOAD ');