/
app.js
131 lines (110 loc) · 2.59 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
var window = this;
Ti.include('/lib/sc_ti.js');
var RUN_TESTS = true;
if (RUN_TESTS) {
Ti.include('/tests/tests.js');
} else {
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
// create tab group
var tabGroup = SCTi.TabGroup.create({
opened: function() {
var alertDialog = SCTi.AlertDialog.create({
title: 'Hello',
message: 'SproutCore Rocks!',
buttonNames: ['OK', 'Cancel']
});
alertDialog.show();
}
});
// create base UI tab and root window
var win1 = SCTi.Window.create({
title:'Tab 1',
backgroundColor:'#fff'
});
var tab1 = SCTi.Tab.create({
icon:'KS_nav_views.png',
title:'Tab 1',
window:win1
});
var label1 = SCTi.Label.create({
color:'#999',
text:'I am Window 1',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
win1.add(label1);
var image = SCTi.ImageView.create({
image: 'KS_nav_views.png',
height: 43,
width: 46,
top: 10
});
win1.add(image);
var textarea = SCTi.TextArea.create({
top: 60,
height: 50,
width: 200,
value: 'I am a SCTi.TextArea'
});
win1.add(textarea);
// create controls tab and root window
var win2 = SCTi.Window.create({
title:'Tab 2',
backgroundColor:'#fff'
});
var tab2 = SCTi.Tab.create({
icon:'KS_nav_ui.png',
title:'Tab 2',
window:win2
});
var label2 = SCTi.Label.create({
color:'#999',
text:'I am Window 2',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
win2.add(label2);
var animation = SCTi.Animation.create({
duration: 2000,
opacity: 0
});
image.animate(animation);
// Map Tab
var win3 = SCTi.Window.create({
title: 'Map Test'
});
var mapView = SCTi.MapView.create({
animate: true,
mapType: 'standard',
region: {
latitude: 46.876951,
longitude: -96.78664,
latitudeDelta: 0.005,
longitudeDelta: 0.005 },
regionFit: true
});
var mapAnnotation = SCTi.MapAnnotation.create({
animate: true,
latitude: 46.876951,
longitude: -96.78664,
pinColor: 'green',
title: 'Brian was here!',
subtitle: 'Mmmm... beer.'
});
mapView.add(mapAnnotation);
win3.add(mapView);
var tab3 = SCTi.Tab.create({
icon: 'KS_nav_views.png',
title: 'Map Test',
window: win3
});
// add tabs
tabGroup.add(tab1);
tabGroup.add(tab2);
tabGroup.add(tab3);
// open tab group
tabGroup.open();
}