Skip to content

Instantly share code, notes, and snippets.

@kwhinnery
Created July 19, 2010 06:10
Show Gist options
  • Save kwhinnery/481058 to your computer and use it in GitHub Desktop.
Save kwhinnery/481058 to your computer and use it in GitHub Desktop.
Titanium.UI.setBackgroundColor('#000');
//Main Tab Group
var tabGroup = Titanium.UI.createTabGroup();
//Photo Selection Window
var photosWindow = Titanium.UI.createWindow({
url:'photos.js',
title:'Photos',
backgroundColor:'#fff'
});
var photosTab = Titanium.UI.createTab({
icon:'43-film-roll.png',
title:'Photos',
window:photosWindow
});
//Configuration Window
var configWindow = Titanium.UI.createWindow({
url:'config.js',
title:'Configuration',
backgroundColor:'#fff'
});
var configTab = Titanium.UI.createTab({
icon:'19-gear.png',
title:'Configuration',
window:configWindow
});
//Add tabs and open tab group
tabGroup.addTab(photosTab);
tabGroup.addTab(configTab);
tabGroup.open();
function header(text) {
return Ti.UI.createLabel({
top:10,
text:text,
height:'auto',
width:'auto',
font:{
fontWeight:'bold',
fontSize:20
}
});
}
var configContainer = Ti.UI.createView({
top:10,
height:'auto',
width:'auto',
layout:'vertical'
});
configContainer.add(header('Twitter Username'));
var unField = Titanium.UI.createTextField({
value:'kevinwhinnery',
height:35,
top:10,
width:250,
hintText:'Twitter Username',
keyboardType:Titanium.UI.KEYBOARD_DEFAULT,
returnKeyType:Titanium.UI.RETURNKEY_DEFAULT,
borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
autocorrect:false
});
configContainer.add(unField);
configContainer.add(header('Twitter Password'));
var pwField = Titanium.UI.createTextField({
color:'#787878',
value:'secret',
height:35,
top:10,
width:250,
hintText:'Twitter Password',
keyboardType:Titanium.UI.KEYBOARD_DEFAULT,
returnKeyType:Titanium.UI.RETURNKEY_DEFAULT,
borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
autocorrect:false,
passwordMask:true
});
configContainer.add(pwField);
var saveButton = Ti.UI.createButton({
top:10,
title:'Save',
height:40,
width:100
});
configContainer.add(saveButton);
Ti.UI.currentWindow.add(configContainer);
var win = Ti.UI.currentWindow;
var photoOptions = Ti.UI.createView({
top:10,
height:'auto',
width:'auto',
layout:'vertical'
});
var galleryButton = Ti.UI.createButton({
title:'Choose A Photo',
top:10,
height:40,
width:200
});
var cameraButton = Ti.UI.createButton({
title:'Take A Photo',
top:10,
height:40,
width:200
});
var preview = Ti.UI.createImageView({
top:10,
height:150,
width:150
});
var postButton = Ti.UI.createButton({
title:'Oh Snap!',
bottom:10,
height:100,
width:100
});
photoOptions.add(galleryButton);
photoOptions.add(cameraButton);
photoOptions.add(preview);
win.add(photoOptions);
win.add(postButton);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment