Skip to content

Commit

Permalink
cleanup views and images, still need remote image fix for Nook
Browse files Browse the repository at this point in the history
  • Loading branch information
tonylukasavage committed Sep 17, 2011
1 parent ee2731b commit 44a9eab
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 437 deletions.
5 changes: 4 additions & 1 deletion Resources/examples/image_view_animated.js
Expand Up @@ -155,7 +155,10 @@ var l = Titanium.UI.createLabel({
bottom:10,
color:'white',
width:'auto',
height:'auto'
height:'auto',
font: {
fontSize:24
}
});

durationUp.addEventListener('click', function()
Expand Down
7 changes: 5 additions & 2 deletions Resources/examples/image_view_basic.js
@@ -1,7 +1,7 @@
var win = Titanium.UI.currentWindow;

var imageView = Titanium.UI.createImageView({
image:'http://www.appcelerator.com/wp-content/uploads/2009/06/titanium_desk.png',
image:'http://developer.appcelerator.com.s3.amazonaws.com/blog/post_images/appc.jpg',
width:261,
height:178,
top:20
Expand All @@ -19,7 +19,10 @@ var l = Titanium.UI.createLabel({
color:'#999',
height:'auto',
width:300,
textAlign:'center'
textAlign:'center',
font: {
fontSize:24
}
});
win.add(l);

Expand Down
11 changes: 7 additions & 4 deletions Resources/examples/image_view_file.js
Expand Up @@ -4,8 +4,8 @@ var f = Ti.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'images/app

var imageView = Titanium.UI.createImageView({
image:f,
width:24,
height:24,
width:300,
height:300,
top:100
});

Expand All @@ -16,11 +16,14 @@ var l = Titanium.UI.createLabel({
bottom:20,
width:'auto',
height:'auto',
color:'#999'
color:'#999',
font: {
fontSize:24
}
});
win.add(l);

imageView.addEventListener('click', function()
{
Titanium.UI.createAlertDialog({title:'Image View', message:'You clicked me!'}).show();
Titanium.UI.createAlertDialog({title:'Image View', message:'You clicked me!', buttonNames:['OK']}).show();
});
4 changes: 2 additions & 2 deletions Resources/examples/image_view_remote.js
@@ -1,7 +1,7 @@
var win = Titanium.UI.currentWindow;

var imageView = Titanium.UI.createImageView({
image:'http://www.appcelerator.com/wp-content/uploads/2009/06/titanium_desk.png',
image:'http://developer.appcelerator.com.s3.amazonaws.com/blog/post_images/appc.jpg',
defaultImage:'../images/cloud.png',
top:20,
width:100,
Expand Down Expand Up @@ -36,6 +36,6 @@ var b = Titanium.UI.createButton({
});
win.add(b);
b.addEventListener('click', function(e) {
imageView2.image = 'http://www.appcelerator.com/wp-content/uploads/2009/06/titanium_desk.png';
imageView2.image = 'http://developer.appcelerator.com.s3.amazonaws.com/blog/post_images/appc.jpg';
});

41 changes: 6 additions & 35 deletions Resources/examples/image_views.js
@@ -1,45 +1,16 @@
// create table view data object
Ti.include('../common.js');

var data = [
{title:'Basic', hasChild:true, test:'../examples/image_view_basic.js'},
{title:'Animated', hasChild:true, test:'../examples/image_view_animated.js'},
{title:'Image File', hasChild:true, test:'../examples/image_view_file.js'},
{title:'Remote Image', hasChild:true, test:'../examples/image_view_remote.js'},
{title:'Image Scaling', hasChild:true, test:'../examples/image_view_scaling.js'},
{title:'Image View Positioning', hasChild:true, test:'../examples/image_view_positioning.js'},
{title:'Image View Encoding', hasChild:true, test:'../examples/image_view_encoding.js'}

{title:'Image View Encoding', hasChild:true, test:'../examples/image_view_encoding.js'},
{title:'Image Rapid Update', hasChild:true, test:'../examples/image_view_updateimages.js'},
{title:'Android drawable resource', hasChild:true, test:'image_view_resource.js'}
];

// add iphone specific tests
if (Titanium.Platform.name == 'iPhone OS')
{
data.push({title:'Image Blob', hasChild:true, test:'../examples/image_view_blob.js'});
data.push({title:'Image Masking', hasChild:true, test:'../examples/image_mask.js'});
data.push({title:'Image Toolbar', hasChild:true, test:'../examples/image_view_toolbar.js'});
}

data.push({title:'Image Rapid Update', hasChild:true, test:'../examples/image_view_updateimages.js'});
if (Titanium.Platform.name == 'android') {
data.push({title:'Android drawable resource', hasChild:true, test:'image_view_resource.js'});
}

// create table view
var tableview = Titanium.UI.createTableView({
data:data
});

// create table view event listener
tableview.addEventListener('click', function(e)
{
if (e.rowData.test)
{
var win = Titanium.UI.createWindow({
url:e.rowData.test,
title:e.rowData.title
});
Titanium.UI.currentTab.open(win,{animated:true});
}
});
Titanium.UI.currentWindow.add(NookKS.createNavigationTableView(data));

// add table view to the window
Titanium.UI.currentWindow.add(tableview);
12 changes: 6 additions & 6 deletions Resources/examples/view_event_interaction.js
Expand Up @@ -23,7 +23,7 @@ var view2 = Ti.UI.createView({
var label = Ti.UI.createLabel({
text:'Click on me',
color:'white',
font:{fontSize:15,fontWeight:'bold'},
font:{fontSize:24,fontWeight:'bold'},
width:'auto',
height:'auto'
});
Expand All @@ -35,18 +35,18 @@ win.add(view1);

var l = Ti.UI.createLabel({
text:'click on box',
width:300,
width:500,
height:'auto',
top:10,
font:{fontSize:13}
font:{fontSize:24}
});
win.add(l);
var l2 = Ti.UI.createLabel({
text:'click on label',
width:300,
width:500,
height:'auto',
top:25,
font:{fontSize:13}
top:40,
font:{fontSize:24}
});
win.add(l2);
view2.addEventListener('click',function()
Expand Down
6 changes: 3 additions & 3 deletions Resources/examples/view_event_propagation.js
Expand Up @@ -14,7 +14,7 @@ d.add(Ti.UI.createLabel({name:"label d",color:'white',text:'D',height:'auto',wid

var l = Ti.UI.createLabel({
color:'white',
font:{fontSize:14,fontWeight:'bold',fontFamily:'Helvetica Neue'},
font:{fontSize:24,fontWeight:'bold',fontFamily:'Helvetica Neue'},
bottom:5,
textAlign:'center',
text:'click anywhere',
Expand All @@ -24,8 +24,8 @@ var l = Ti.UI.createLabel({

var l2 = Ti.UI.createLabel({
color:'white',
font:{fontSize:14,fontFamily:'Helvetica Neue'},
bottom:25,
font:{fontSize:24,fontFamily:'Helvetica Neue'},
bottom:35,
textAlign:'center',
text:'',
height:'auto',
Expand Down
74 changes: 16 additions & 58 deletions Resources/examples/views.js
@@ -1,62 +1,20 @@
Ti.include('../common.js');

//create table view data object
var data = [
{title:'Events Propagation', hasChild:true, test:'../examples/view_event_propagation.js'},
{title:'Events Interaction', hasChild:true, test:'../examples/view_event_interaction.js'},
{title:'Image Views', hasChild:true, test:'../examples/image_views.js'},
{title:'Scroll Views', hasChild:true, test:'../examples/scroll_views.js'},
{title:'Table Views', hasChild:true, test:'../examples/table_views.js'},
{title:'Web Views', hasChild:true, test:'../examples/web_views.js'},
{title:'Alert Dialog', hasChild:true, test:'../examples/alert.js'},
{title:'Options Dialog', hasChild:true, test:'../examples/options_dialog.js'},
{title:'Remove Views', hasChild:true, test:'../examples/remove_views.js'},
{title:'zIndex', hasChild:true, test:'../examples/views_zindex.js'},
{title:'Email Dialog', hasChild:true, test:'../examples/email_dialog.js'},
{title:'Map View', hasChild:true, test:'../examples/map_view.js'},
{title:'View w/ Size', hasChild:true, test:'../examples/view_with_size.js'}

{title:'Events Propagation', test:'../examples/view_event_propagation.js'},
{title:'Events Interaction', test:'../examples/view_event_interaction.js'},
{title:'Image Views', test:'../examples/image_views.js'},
{title:'Scroll Views', test:'../examples/scroll_views.js'},
{title:'Table Views', test:'../examples/table_views.js'},
{title:'Web Views', test:'../examples/web_views.js'},
{title:'Alert Dialog', test:'../examples/alert.js'},
{title:'Options Dialog', test:'../examples/options_dialog.js'},
{title:'Remove Views', test:'../examples/remove_views.js'},
{title:'zIndex', test:'../examples/views_zindex.js'},
{title:'Email Dialog', test:'../examples/email_dialog.js'},
{title:'Map View', test:'../examples/map_view.js'},
{title:'View w/ Size', test:'../examples/view_with_size.js'}
];

if (Titanium.Platform.name == 'iPhone OS')
{
data.push({title:'Map View with Routing', hasChild:true, test:'../examples/map_view2.js'});
data.push({title:'Events', hasChild:true, test:'../examples/view_events.js'});
data.push({title:'Events with Views', hasChild:true, test:'../examples/view_events_2.js'});
data.push({title:'Coverflow View', hasChild:true, test:'../examples/coverflow.js'});
data.push({title:'Dashboard View', hasChild:true, test:'../examples/dashboard.js'});
data.push({title:'Auto Height', hasChild:true, test:'../examples/views_auto_height.js'});
data.push({title:'Min Height', hasChild:true, test:'../examples/views_min_height.js'});
data.push({title:'Mixing Views', hasChild:true, test:'../examples/mixing_views_1.js'});
// data.push({title:'Web View Repaint', hasChild:true, test:'../examples/webview_repaint.js'});
data.push({title:'Gradient', hasChild:true, test:'../examples/gradient.js'});
data.push({title:'Hide/Show', hasChild:true, test:'../examples/view_hide_show.js'});

Ti.include("version.js");

if (isiOS4Plus())
{
data.push({title:'Hi-Res Image', wintitle:"Fence", hasChild:true, test:'../examples/hi_res_image.js'});
data.push({title:'Hi-Res Image 2', wintitle:"Dog", hasChild:true, test:'../examples/hi_res_image2.js'});
}
data.push({title:'Hi-Res Image remote', wintitle:"Remote dog", hasChild:true, test:'../examples/hi_res_image_remote.js'});
}

// create table view
var tableview = Titanium.UI.createTableView({
data:data
});

// create table view event listener
tableview.addEventListener('click', function(e)
{
if (e.rowData.test)
{
var win = Titanium.UI.createWindow({
url:e.rowData.test,
title:e.rowData.wintitle || e.rowData.title
});
Titanium.UI.currentTab.open(win,{animated:true});
}
});

// add table view to the window
Titanium.UI.currentWindow.add(tableview);
Titanium.UI.currentWindow.add(NookKS.createNavigationTableView(data));
32 changes: 20 additions & 12 deletions Resources/examples/window_layout.js
Expand Up @@ -10,16 +10,19 @@ var firstName = Titanium.UI.createLabel({
text:'First Name',
top:10,
left:30,
width:100,
height:'auto'
width:300,
height:'auto',
font:{
fontSize: 24
}
});

win.add(firstName);

var firstNameField = Titanium.UI.createTextField({
hintText:'enter first name',
height:35,
top:35,
top:50,
left:30,
width:250,
borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
Expand All @@ -33,22 +36,24 @@ win.add(firstNameField);
var lastName = Titanium.UI.createLabel({
color:'#fff',
text:'Last Name',
top:75,
top:90,
left:30,
width:100,
height:'auto'
width:300,
height:'auto',
font:{
fontSize: 24
}
});

win.add(lastName);

var lastNameField = Titanium.UI.createTextField({
hintText:'enter last name',
height:35,
top:100,
top:130,
left:30,
width:250,
borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
paddingLeft: 20
borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
});

win.add(lastNameField);
Expand All @@ -58,10 +63,13 @@ win.add(lastNameField);
//
var save = Titanium.UI.createButton({
title:'Save my Information',
top:170,
top:200,
left:30,
height:30,
width:250
height:50,
width:250,
font: {
fontSize:18
}
});
win.add(save);

Expand Down

0 comments on commit 44a9eab

Please sign in to comment.