Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Match 1.8.0.1 GA

  • Loading branch information...
commit 138c346463fa5e5c307ea021c2ce192cdd8116e9 1 parent a9b99b8
Bill Dawson billdawson authored

Showing 50 changed files with 843 additions and 166 deletions. Show diff stats Hide diff stats

  1. +19 3 Resources/app.js
  2. +2 2 Resources/examples/android_menu_1.js
  3. +1 1  Resources/examples/android_menu_2.js
  4. +1 1  Resources/examples/android_menu_3.js
  5. +0 1  Resources/examples/app_data.js
  6. +1 1  Resources/examples/basic_animation.js
  7. +81 0 Resources/examples/button_state.js
  8. +2 1  Resources/examples/contacts.js
  9. +43 11 Resources/examples/contacts_add.js
  10. +82 0 Resources/examples/contacts_searchById.js
  11. +1 1  Resources/examples/coverflow_remote.js
  12. +1 1  Resources/examples/coverflow_replace.js
  13. +1 1  Resources/examples/coverflow_view.js
  14. +17 1 Resources/examples/database.js
  15. +12 4 Resources/examples/facebook_login_logout.js
  16. +9 1 Resources/examples/facebook_photos.js
  17. +8 1 Resources/examples/facebook_properties.js
  18. +9 1 Resources/examples/facebook_publish_stream.js
  19. +8 1 Resources/examples/facebook_query.js
  20. +2 2 Resources/examples/image_mask.js
  21. +2 1  Resources/examples/image_view_encoding.js
  22. +4 1 Resources/examples/label_basic.js
  23. +2 1  Resources/examples/movie.js
  24. +49 13 Resources/examples/movie_embed.js
  25. +17 33 Resources/examples/movie_local.js
  26. +12 11 Resources/examples/movie_remote.js
  27. +2 2 Resources/examples/movie_remote2.js
  28. +2 1  Resources/examples/navgroup.js
  29. +1 0  Resources/examples/platform.js
  30. +3 4 Resources/examples/slider_range.js
  31. +0 1  Resources/examples/sound_local.js
  32. +2 2 Resources/examples/sound_remote_url.js
  33. +5 5 Resources/examples/tabbedbar.js
  34. +3 1 Resources/examples/table_view_scroll_indicators.js
  35. +5 5 Resources/examples/textarea_autodetect.js
  36. +2 2 Resources/examples/toolbar.js
  37. +4 3 Resources/examples/twitter.js
  38. +4 0 Resources/examples/view_event_propagation.js
  39. +77 0 Resources/examples/view_gestures.js
  40. +147 0 Resources/examples/view_point_conversion.js
  41. +5 2 Resources/examples/views.js
  42. +1 1  Resources/examples/web_views.js
  43. +1 1  Resources/examples/yql.js
  44. +77 0 Resources/examples/yql_local_search.js
  45. BIN  Resources/images/slightlylargerimage.png
  46. +3 1 Resources/main_windows/base_ui.js
  47. +1 0  Resources/main_windows/controls.js
  48. +61 0 platform/iphone/Settings.bundle/Root.plist
  49. BIN  platform/iphone/Settings.bundle/en.lproj/Root.strings
  50. +51 40 tiapp.xml
22 Resources/app.js
@@ -335,9 +335,6 @@ Ti.API.info("should be 1, was = "+String.format('%d',1));
335 335 Ti.API.info("should be 1.0, was = "+String.format('%1.1f',1));
336 336 Ti.API.info("should be hello, was = "+String.format('%s','hello'));
337 337
338   -Ti.API.info("instanceof check, should be true => " + (Ti.UI.createWindow() instanceof Ti.UI.createView()));
339   -Ti.API.info("instanceof check, should be false => " + (Ti.UI.createView() instanceof Ti.UI.createWindow()));
340   -
341 338 // test to check that we can iterate over titanium based objects
342 339 (function(){
343 340 Ti.API.info("you should see a list of properties (3 or more) below this line");
@@ -387,3 +384,22 @@ if (isiOS4Plus())
387 384 Ti.API.info("app was paused from the foreground");
388 385 });
389 386 }
  387 +
  388 +if (Ti.App.Properties.getBool('showNotice', true)){
  389 + var alertNotice = Ti.UI.createAlertDialog({
  390 + buttonNames: ['OK', 'Visit docs', 'Don\'t show again'],
  391 + cancel:0,
  392 + title: 'Notice',
  393 + message: 'While this KitchenSink provides an extensive demonstration of the Titanium API, its structure is not recommended for production apps. Please refer to our documentation for more details.'
  394 + });
  395 + alertNotice.show();
  396 + alertNotice.addEventListener('click', function(e){
  397 + if(e.index === 1){
  398 + Titanium.Platform.openURL('http://wiki.appcelerator.org/display/guides/Example+Applications');
  399 + }
  400 + if(e.index === 2){
  401 + Ti.App.Properties.setBool('showNotice', false);
  402 + }
  403 + });
  404 +}
  405 +
4 Resources/examples/android_menu_1.js
@@ -64,7 +64,7 @@ b3.addEventListener('click', function(e) {
64 64 order : 2,
65 65 title : 'Item 3'
66 66 });
67   - m3.setIcon("app://images/appc_small.png");
  67 + m3.setIcon("app://images/appcelerator_small.png");
68 68 m4 = menu.add({
69 69 itemId : 4,
70 70 groupId : 1,
@@ -125,7 +125,7 @@ activity.onCreateOptionsMenu = function(e) {
125 125 groupId : 0,
126 126 order : 0
127 127 });
128   - m1.setIcon("/images/appc_small.png");
  128 + m1.setIcon("/images/appcelerator_small.png");
129 129 };
130 130
131 131 activity.onPrepareOptionsMenu = function(e) {
2  Resources/examples/android_menu_2.js
@@ -21,7 +21,7 @@ b1.addEventListener('click', function(e) {
21 21 var m1 = menu.add({ title : 'Close Window' });
22 22 m1.setIcon(Titanium.Android.R.drawable.ic_menu_close_clear_cancel);
23 23 m1.addEventListener('click', function(e) {
24   - Ti.UI.currentWindow.close();
  24 + w.close();
25 25 });
26 26 }
27 27 }
2  Resources/examples/android_menu_3.js
@@ -21,7 +21,7 @@ b1.addEventListener('click', function(e) {
21 21
22 22 var m1 = menu.add({ title : 'Close Window' });
23 23 m1.addEventListener('click', function(e) {
24   - Ti.UI.currentWindow.close();
  24 + w.close();
25 25 });
26 26 };
27 27
1  Resources/examples/app_data.js
@@ -11,7 +11,6 @@ data+= 'Description: ' + Titanium.App.getDescription() + '\n';
11 11 data+= 'Copyright: ' + Titanium.App.getCopyright() + '\n';
12 12 data+= 'GUID: ' + Titanium.App.getGUID() + '\n';
13 13 data+= 'Path: ' + Titanium.App.appURLToPath('index.html') + '\n';
14   -data+= 'Arguments: ' + JSON.stringify(Titanium.App.getArguments()) + '\n';
15 14 data+= 'Build: ' + Titanium.version + '.' + Titanium.buildHash + ' (' + Titanium.buildDate + ')\n';
16 15
17 16
2  Resources/examples/basic_animation.js
@@ -127,7 +127,7 @@ function thirdAnimation()
127 127 // animate the center point object
128 128 function fourthAnimation()
129 129 {
130   - circle.animate({center:{x:100,y:100},curve:Ti.UI.ANIMATION_CURVE_EASE_IN_OUT,duration:1000}, function()
  130 + circle.animate({center:{x:100,y:100},curve:Ti.UI.iOS.ANIMATION_CURVE_EASE_IN_OUT,duration:1000}, function()
131 131 {
132 132 circle.animate({center:{x:0,y:200},duration:1000}, function()
133 133 {
81 Resources/examples/button_state.js
... ... @@ -0,0 +1,81 @@
  1 +var win = Titanium.UI.currentWindow;
  2 +
  3 +var button1 = Titanium.UI.createButton({
  4 + left:10,
  5 + top:10,
  6 + height:50,
  7 + width:50,
  8 + enabled:true,
  9 + focusable:true,
  10 + title:'B1',
  11 + backgroundImage:'../images/slightlylargerimage.png'
  12 +});
  13 +
  14 +var button2 = Titanium.UI.createButton({
  15 + left:70,
  16 + top:10,
  17 + height:50,
  18 + width:50,
  19 + focusable:true,
  20 + enabled:true,
  21 + title:'B2',
  22 + backgroundDisabledImage:'../images/slightlylargerimage.png'
  23 +});
  24 +
  25 +var button3 = Titanium.UI.createButton({
  26 + left:130,
  27 + top:10,
  28 + height:50,
  29 + width:50,
  30 + enabled:true,
  31 + focusable:true,
  32 + title:'B3',
  33 + backgroundFocusedImage:'../images/slightlylargerimage.png'
  34 +});
  35 +
  36 +var button4 = Titanium.UI.createButton({
  37 + left:190,
  38 + top:10,
  39 + height:50,
  40 + width:50,
  41 + focusable:true,
  42 + enabled:true,
  43 + title:'B4',
  44 + backgroundSelectedImage:'../images/slightlylargerimage.png'
  45 +});
  46 +
  47 +var button5 = Titanium.UI.createButton({
  48 + left:10,
  49 + top:200,
  50 + height:60,
  51 + width:100,
  52 + focusable:true,
  53 + enabled:true,
  54 + title:'click me'
  55 +});
  56 +
  57 +var state=1;
  58 +button5.addEventListener('click',function()
  59 +{
  60 + switch(state)
  61 + {
  62 + case 0:
  63 + button2.focusable=true;
  64 + button2.enabled=true;
  65 + state=1;
  66 + break;
  67 + case 1:
  68 + button2.focusable=false;
  69 + button2.enabled=false;
  70 + state=0;
  71 + break;
  72 +
  73 + }
  74 +})
  75 +
  76 +
  77 +win.add(button1);
  78 +win.add(button2);
  79 +win.add(button3);
  80 +win.add(button4);
  81 +win.add(button5);
3  Resources/examples/contacts.js
... ... @@ -1,7 +1,8 @@
1 1 // create table view data object
2 2 var data = [
3 3 {title:'Contacts picker', hasChild:true, test:'../examples/contacts_picker.js'},
4   - {title:'Display people', hasChild:true, test:'../examples/contacts_db.js'}
  4 + {title:'Display people', hasChild:true, test:'../examples/contacts_db.js'},
  5 + {title:'Search By ID', hasChild:true, test:'../examples/contacts_searchById.js'}
5 6 ];
6 7 if (Ti.Platform.osname !== 'android') {
7 8 data.push({title:'Add contact',hasChild:true, test:'../examples/contacts_add.js'});
54 Resources/examples/contacts_add.js
... ... @@ -1,6 +1,12 @@
1 1
2 2 var win = Ti.UI.currentWindow;
3   -
  3 +var scrollview = Ti.UI.createScrollView({
  4 + contentWidth:'auto',
  5 + contentHeight:'auto',
  6 + top:0,
  7 + showVerticalScrollIndicator:true,
  8 + showHorizontalScrollIndicator:false
  9 +});
4 10 var v1 = Ti.UI.createView({
5 11 top:10,
6 12 left:10,
@@ -126,7 +132,26 @@ var f6 = Ti.UI.createTextField({
126 132 });
127 133 v6.add(l6);
128 134 v6.add(f6);
129   -
  135 +var v7 = Ti.UI.createView({
  136 + top:250,
  137 + left:10,
  138 + width:300,
  139 + height:30
  140 +});
  141 +var l7 = Ti.UI.createLabel({
  142 + text:'URL:',
  143 + top:0,
  144 + left:0
  145 +});
  146 +var f7 = Ti.UI.createTextField({
  147 + text:'',
  148 + borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
  149 + top:0,
  150 + right:0,
  151 + width:200
  152 +});
  153 +v7.add(l7);
  154 +v7.add(f7);
130 155 var b1 = Ti.UI.createButton({
131 156 title:'Add contact',
132 157 width:100,
@@ -139,18 +164,25 @@ b1.addEventListener('click', function() {
139 164 address.City = f4.value;
140 165 address.State = f5.value;
141 166 address.ZIP = f6.value;
142   -
  167 +
  168 + var weburl = {};
  169 + weburl = f7.value;
  170 +
143 171 var contact = Titanium.Contacts.createPerson({
144 172 firstName:f1.value,
145 173 lastName:f2.value,
146   - address:{"home":[address]}
  174 + address:{"home":[address]},
  175 + url:{"home":[weburl]}
147 176 });
  177 +
148 178 });
149 179
150   -win.add(v1);
151   -win.add(v2);
152   -win.add(v3);
153   -win.add(v4);
154   -win.add(v5);
155   -win.add(v6);
156   -win.add(b1);
  180 +scrollview.add(v1);
  181 +scrollview.add(v2);
  182 +scrollview.add(v3);
  183 +scrollview.add(v4);
  184 +scrollview.add(v5);
  185 +scrollview.add(v6);
  186 +scrollview.add(v7);
  187 +scrollview.add(b1);
  188 +win.add(scrollview);
82 Resources/examples/contacts_searchById.js
... ... @@ -0,0 +1,82 @@
  1 +var win = Ti.UI.currentWindow;
  2 +var tf1 = Titanium.UI.createTextField({
  3 + color: '#336699',
  4 + top: 20,
  5 + width: 250,
  6 + height: 40,
  7 + hintText: 'RecordID Number',
  8 + keyboardType: Titanium.UI.KEYBOARD_NUMBERS_PUNCTUATION,
  9 + returnKeyType: Titanium.UI.RETURNKEY_DONE,
  10 + clearOnEdit: true,
  11 + returnKeyType: Titanium.UI.RETURNKEY_DEFAULT,
  12 + borderStyle: Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
  13 +});
  14 +var b1 = Titanium.UI.createButton({
  15 + title: 'FIND RECORD BY ID',
  16 + height: 40,
  17 + width: 250,
  18 + top: 65
  19 +});
  20 +b1.addEventListener('click', function()
  21 +{
  22 + tf1.blur();
  23 + var val = tf1.value;
  24 + try{
  25 + var p = Ti.Contacts.getPersonByID(val);
  26 + if (p == null)
  27 + {
  28 + alert("Could not find record for " + val);
  29 + }
  30 + else
  31 + {
  32 + alert(p.fullName);
  33 + }
  34 + } catch(E) {
  35 + alert("Invalid input: " + val);
  36 + }
  37 +
  38 +});
  39 +
  40 +if (Titanium.Platform.osname != 'android') {
  41 + var tf2 = Titanium.UI.createTextField({
  42 + color: '#336699',
  43 + top: 120,
  44 + width: 250,
  45 + height: 40,
  46 + hintText: 'Contact GroupID Number',
  47 + keyboardType: Titanium.UI.KEYBOARD_NUMBERS_PUNCTUATION,
  48 + returnKeyType: Titanium.UI.RETURNKEY_DONE,
  49 + clearOnEdit:true,
  50 + returnKeyType: Titanium.UI.RETURNKEY_DEFAULT,
  51 + borderStyle: Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
  52 + });
  53 + win.add(tf2);
  54 + var b2 = Titanium.UI.createButton({
  55 + title: 'FIND GROUP BY ID',
  56 + height: 40,
  57 + width: 250,
  58 + top: 165
  59 + });
  60 + win.add(b2);
  61 + b2.addEventListener('click', function()
  62 + {
  63 + tf2.blur();
  64 + var val = tf2.value;
  65 + var p = Ti.Contacts.getGroupByID(val);
  66 + if (p == null)
  67 + {
  68 + alert("INVALID GROUP");
  69 + }
  70 + else
  71 + {
  72 + alert(p.name);
  73 + }
  74 + });
  75 +}
  76 +tf1.addEventListener('return', function(e)
  77 +{
  78 + tf1.blur();
  79 +});
  80 +win.add(tf1);
  81 +win.add(b1);
  82 +win.open();
2  Resources/examples/coverflow_remote.js
@@ -10,7 +10,7 @@ for (var c=0;c<30;c++)
10 10 }
11 11
12 12 // create coverflow view with images
13   -var view = Titanium.UI.createCoverFlowView({
  13 +var view = Titanium.UI.iOS.createCoverFlowView({
14 14 images:images,
15 15 backgroundColor:'#000'
16 16 });
2  Resources/examples/coverflow_replace.js
@@ -12,7 +12,7 @@ for (var c=15; c<30; c++) {
12 12 }
13 13
14 14 // create coverflow view with images
15   -var view = Titanium.UI.createCoverFlowView({
  15 +var view = Titanium.UI.iOS.createCoverFlowView({
16 16 images:images1,
17 17 backgroundColor:'#000'
18 18 });
2  Resources/examples/coverflow_view.js
@@ -7,7 +7,7 @@ for (var c=0;c<30;c++)
7 7 }
8 8
9 9 // create coverflow view with images
10   -var view = Titanium.UI.createCoverFlowView({
  10 +var view = Titanium.UI.iOS.createCoverFlowView({
11 11 images:images,
12 12 backgroundColor:'#000'
13 13 });
18 Resources/examples/database.js
@@ -71,9 +71,25 @@ var l3 = Titanium.UI.createLabel({
71 71 text:'unicode placeholder',
72 72 width:300,
73 73 height:40,
74   - top:160
  74 + top:190
75 75 });
76 76 win.add(l3);
  77 +if (Ti.Platform.osname !== 'android')
  78 +{
  79 + win.add(l3);
  80 + var b3 = Titanium.UI.createButton({
  81 + title:'Check DB FullPath',
  82 + width:200,
  83 + height:40,
  84 + top:150
  85 + });
  86 + b3.addEventListener('click', function()
  87 + {
  88 + var path = db.file;
  89 + alert("mysql.db fullpath : \n \nType :" + path +"\n\nFullPath: "+path.nativePath);
  90 + });
  91 + win.add(b3);
  92 +}
77 93 var db = Titanium.Database.open('mydb');
78 94
79 95 db.execute('CREATE TABLE IF NOT EXISTS DATABASETEST (ID INTEGER, NAME TEXT)');
16 Resources/examples/facebook_login_logout.js
@@ -37,7 +37,15 @@ Titanium.Facebook.addEventListener('logout', updateLoginStatus);
37 37 //
38 38 // Login Button
39 39 //
40   -win.add(Titanium.Facebook.createLoginButton({
41   - style:'wide',
42   - bottom:30
43   -}));
  40 +if(Titanium.Platform.name == 'iPhone OS'){
  41 + win.add(Titanium.Facebook.createLoginButton({
  42 + style:Ti.Facebook.BUTTON_STYLE_WIDE,
  43 + bottom:30
  44 + }));
  45 +}
  46 +else{
  47 + win.add(Titanium.Facebook.createLoginButton({
  48 + style:'wide',
  49 + bottom:30
  50 + }));
  51 +}
10 Resources/examples/facebook_photos.js
@@ -35,8 +35,16 @@ function showRequestResult(e) {
35 35 }
36 36
37 37 var login = Titanium.Facebook.createLoginButton({
38   - top: 10, style:'wide'
  38 + top: 10
39 39 });
  40 +if(Titanium.Platform.name == 'iPhone OS')
  41 +{
  42 + login.style = Ti.Facebook.BUTTON_STYLE_WIDE;
  43 +}
  44 +else
  45 +{
  46 + login.style ='wide';
  47 +}
40 48 win.add(login);
41 49
42 50 var actionsView = Ti.UI.createView({
9 Resources/examples/facebook_properties.js
@@ -17,9 +17,16 @@ var plist = []; // list of known FB permissions as of Jan 2011 (see bottom)
17 17 // Login Button
18 18 //
19 19 var fbButton = Titanium.Facebook.createLoginButton({
20   - style:'wide',
21 20 top: 10
22 21 });
  22 +if(Titanium.Platform.name == 'iPhone OS')
  23 +{
  24 + fbButton.style = Ti.Facebook.BUTTON_STYLE_NORMAL;
  25 +}
  26 +else
  27 +{
  28 + fbButton.style ='normal';
  29 +}
23 30 sv.add(fbButton);
24 31
25 32 var b1 = Ti.UI.createButton({
10 Resources/examples/facebook_publish_stream.js
@@ -28,8 +28,16 @@ function showRequestResult(e) {
28 28 }
29 29
30 30 var login = Titanium.Facebook.createLoginButton({
31   - top: 10, style:'wide'
  31 + top: 10
32 32 });
  33 +if(Titanium.Platform.name == 'iPhone OS')
  34 +{
  35 + login.style = Ti.Facebook.BUTTON_STYLE_NORMAL;
  36 +}
  37 +else
  38 +{
  39 + login.style ='normal';
  40 +}
33 41 win.add(login);
34 42
35 43 var actionsView = Ti.UI.createView({
9 Resources/examples/facebook_query.js
@@ -6,9 +6,16 @@ var win = Ti.UI.currentWindow;
6 6 Titanium.Facebook.appid = "134793934930";
7 7 Titanium.Facebook.permissions = ['publish_stream', 'read_stream'];
8 8 var fbButton = Titanium.Facebook.createLoginButton({
9   - 'style':'wide',
10 9 bottom:10
11 10 });
  11 +if(Titanium.Platform.name == 'iPhone OS')
  12 +{
  13 + fbButton.style = Ti.Facebook.BUTTON_STYLE_NORMAL;
  14 +}
  15 +else
  16 +{
  17 + fbButton.style ='normal';
  18 +}
12 19 win.add(fbButton);
13 20
14 21 var b1 = Ti.UI.createButton({
4 Resources/examples/image_mask.js
@@ -5,14 +5,14 @@ win.backgroundColor = '#ccc';
5 5 var mask = Titanium.UI.createMaskedImage({
6 6 image:'../images/body-mask.png',
7 7 tint: 'brown',
8   - mode: Titanium.UI.BLEND_MODE_SOURCE_IN
  8 + mode: Titanium.UI.iOS.BLEND_MODE_SOURCE_IN
9 9 });
10 10
11 11 // layer on top the image that is transparent that you want to blend
12 12 var image = Titanium.UI.createMaskedImage({
13 13 image:'../images/body.png',
14 14 tint: 'black',
15   - mode: Titanium.UI.BLEND_MODE_SOURCE_IN
  15 + mode: Titanium.UI.iOS.BLEND_MODE_SOURCE_IN
16 16 });
17 17
18 18
3  Resources/examples/image_view_encoding.js
@@ -4,7 +4,8 @@ var win = Ti.UI.currentWindow;
4 4 // to fetch this image OK
5 5
6 6 var test_img = Titanium.UI.createImageView({
7   - image:'http://www.zoomout.gr/assets/media/PICTURES/ΜΟΥΣΙΚΗ/651_thumb1.jpg'
  7 + image: 'http://www.zoomout.gr/assets/media/PICTURES/' + encodeURIComponent('ΜΟΥΣΙΚΗ') + '/651_thumb1.jpg'
  8 +
8 9 });
9 10
10 11 win.add(test_img);
5 Resources/examples/label_basic.js
@@ -2,7 +2,10 @@ var win = Titanium.UI.currentWindow;
2 2
3 3 var l1 = Titanium.UI.createLabel({
4 4 id:'font_label_test',
5   - text:'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat'
  5 + text:'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat',
  6 + top:0,
  7 + height:170,
  8 + textAlign:'center'
6 9 });
7 10
8 11 win.add(l1);
3  Resources/examples/movie.js
@@ -12,10 +12,11 @@ if (isIPhone3_2_Plus())
12 12 data.push({title:'Embedded Video', hasChild:true, test:'../examples/movie_embed.js'});
13 13 }
14 14
  15 +data.push({title:'Remote Streaming', hasChild:true, test:'../examples/movie_remote.js'});
  16 +
15 17 // add iphone specific tests
16 18 if (Titanium.Platform.name == 'iPhone OS')
17 19 {
18   - data.push({title:'Remote Streaming', hasChild:true, test:'../examples/movie_remote.js'});
19 20 data.push({title:'Remote Streaming 2', hasChild:true, test:'../examples/movie_remote2.js'});
20 21 }
21 22
62 Resources/examples/movie_embed.js
... ... @@ -1,15 +1,29 @@
1 1 var win = Titanium.UI.currentWindow;
2 2
  3 +var statusLabel = Titanium.UI.createLabel({
  4 + text:'tap on movie content',
  5 + width:'auto',
  6 + bottom:50,
  7 + font:{fontSize:12,fontFamily:'Helvetica Neue'}
  8 +});
  9 +win.add(statusLabel);
  10 +
3 11 var activeMovie = Titanium.Media.createVideoPlayer({
4   - contentURL:'../movie.mp4',
  12 + url:'../movie.mp4',
5 13 backgroundColor:'#111',
6   - movieControlStyle: Titanium.Media.VIDEO_CONTROL_EMBEDDED,
  14 + movieControlMode: Titanium.Media.VIDEO_CONTROL_EMBEDDED, // See TIMOB-2802, which may change this property name
7 15 scalingMode:Titanium.Media.VIDEO_SCALING_MODE_FILL,
8 16 width:100,
9 17 height:100,
10 18 autoplay:true
11 19 });
12 20
  21 +// The built-in media playback controls look crazy at 100x100 in Android
  22 +if (Ti.Platform.name === "android") {
  23 + activeMovie.width = 250;
  24 + activeMovie.height = 250;
  25 +}
  26 +
13 27 win.add(activeMovie);
14 28
15 29 // label
@@ -18,12 +32,24 @@ var movieLabel = Titanium.UI.createLabel({
18 32 width:'auto',
19 33 height:25,
20 34 color:'white',
21   - font:{fontSize:24,fontFamily:'Helvetica Neue'}
  35 + font:{fontSize:18,fontFamily:'Helvetica Neue'}
22 36 });
23 37
24 38 // add label to view
25 39 activeMovie.add(movieLabel);
26 40
  41 +// movie click
  42 +activeMovie.addEventListener('click',function()
  43 +{
  44 + var newText = "";
  45 + newText += " initialPlaybackTime: " + activeMovie.initialPlaybackTime;
  46 + newText += "; playableDuration: " + activeMovie.playableDuration;
  47 + newText += "; endPlaybackTime: " + activeMovie.endPlaybackTime;
  48 + newText += "; duration: " + activeMovie.duration;
  49 + newText += "; currentPlaybackTime: " + activeMovie.currentPlaybackTime;
  50 + statusLabel.text = newText;
  51 +});
  52 +
27 53 // label click
28 54 movieLabel.addEventListener('click',function()
29 55 {
@@ -44,20 +70,30 @@ activeMovie.addEventListener('load',function()
44 70 activeMovie.addEventListener('complete',function()
45 71 {
46 72 Ti.API.debug('Completed!');
47   - Titanium.UI.createAlertDialog({title:'Movie', message:'Completed!'}).show();
48   - win.close();
  73 + var dlg = Titanium.UI.createAlertDialog({title:'Movie', message:'Completed!'});
  74 + if (Ti.Platform.name === "android") {
  75 + // Gives a chance to see the dialog
  76 + win.close();
  77 + dlg.show();
  78 + } else {
  79 + dlg.show();
  80 + win.close();
  81 + }
49 82 });
50 83
51   -var thumbnailImage = activeMovie.thumbnailImageAtTime(4.0, Titanium.Media.VIDEO_TIME_OPTION_EXACT);
52   -win.add(Titanium.UI.createImageView({
53   - image:thumbnailImage,
54   - bottom:10,
55   - width:100,
56   - height:100
57   -}));
  84 +if (Ti.Platform.name !== "android") {
  85 + // Thumbnails not supported
  86 + var thumbnailImage = activeMovie.thumbnailImageAtTime(4.0, Titanium.Media.VIDEO_TIME_OPTION_EXACT);
  87 + win.add(Titanium.UI.createImageView({
  88 + image:thumbnailImage,
  89 + bottom:10,
  90 + width:100,
  91 + height:100
  92 + }));
  93 +}
58 94
59 95 activeMovie.play();
60 96
61 97 win.addEventListener('close', function() {
62 98 activeMovie.stop();
63   -});
  99 +});
50 Resources/examples/movie_local.js
... ... @@ -1,35 +1,19 @@
1 1 var win = Titanium.UI.currentWindow;
2   -var android = (Titanium.Platform.name == 'android');
3 2
4 3 var options = {
5   - contentURL:'../movie.mp4',
6   - backgroundColor:'#111',
7   - scalingMode:Titanium.Media.VIDEO_SCALING_MODE_FILL
  4 + url: '../movie.mp4',
  5 + backgroundColor: '#111',
  6 + scalingMode: Titanium.Media.VIDEO_SCALING_MODE_FILL,
  7 + movieControlMode: Titanium.Media.VIDEO_CONTROL_NONE // See TIMOB-2802, which may change this property name
8 8 };
9 9
10   -if (android) {
11   - options.mediaControlStyle = Titanium.Media.VIDEO_CONTROL_DEFAULT;
12   -} else {
13   - if (parseFloat(Titanium.Platform.version) >= 3.2) {
14   - options.mediaControlStyle = Titanium.Media.VIDEO_CONTROL_NONE;
15   - } else {
16   - options.movieControlMode = Titanium.Media.VIDEO_CONTROL_NONE;
17   - }
  10 +if (Titanium.Platform.osname == "ipad") {
  11 + options.width = 400;
  12 + options.height = 300;
18 13 }
19 14
20 15 var activeMovie = Titanium.Media.createVideoPlayer(options);
21   -
22   -if (parseFloat(Titanium.Platform.version) >= 3.2)
23   -{
24   - activeMovie.mediaControlStyle = Titanium.Media.VIDEO_CONTROL_EMBEDDED;
25   -// activeMovie.mediaControlStyle = Titanium.Media.VIDEO_CONTROL_FULLSCREEN;
26   -// activeMovie.mediaControlStyle = Titanium.Media.VIDEO_CONTROL_NONE;
27   - if (Titanium.Platform.osname == "ipad") {
28   - activeMovie.width = 400;
29   - activeMovie.height = 300;
30   - }
31   - win.add(activeMovie);
32   -}
  16 +win.add(activeMovie);
33 17
34 18 // label
35 19 var movieLabel = Titanium.UI.createLabel({
@@ -37,7 +21,7 @@ var movieLabel = Titanium.UI.createLabel({
37 21 width:'auto',
38 22 height:35,
39 23 color:'white',
40   - font:{fontSize:24,fontFamily:'Helvetica Neue'}
  24 + font:{fontSize:12,fontFamily:'Helvetica Neue'}
41 25 });
42 26
43 27 // add label to view
@@ -47,12 +31,13 @@ activeMovie.add(movieLabel);
47 31 movieLabel.addEventListener('click',function()
48 32 {
49 33 movieLabel.text = "You clicked the video label. Sweet!";
50   - if (android) {
51   - activeMovie.mediaControlStyle = Titanium.Media.VIDEO_CONTROL_NONE;
  34 + movieLabel.text = "mediaControlStyle = " + activeMovie.mediaControlStyle;
  35 + if (Titanium.Platform.name == 'iPhone OS') {
  36 + movieLabel.text = movieLabel.text + " movieControlStyle = " + activeMovie.movieControlStyle;
52 37 }
53 38 });
54 39
55   -activeMovie.addEventListener('load',function()
  40 +activeMovie.addEventListener('load', function()
56 41 {
57 42 // animate label
58 43 var t = Titanium.UI.create2DMatrix();
@@ -63,14 +48,13 @@ activeMovie.addEventListener('load',function()
63 48 movieLabel.animate({transform:t, duration:500, color:'white'});
64 49 });
65 50 });
  51 +
66 52 activeMovie.addEventListener('complete',function()
67 53 {
68 54 var dlg = Titanium.UI.createAlertDialog({title:'Movie', message:'Completed!'});
69   - if (Ti.Platform.name == 'android') {
70   - dlg.addEventListener('click', function(e) {
71   - activeMovie.hide();
72   - win.close();
73   - });
  55 + if (Ti.Platform.name === 'android') {
  56 + // So you have a chance to see the "completed" dialog.
  57 + win.close();
74 58 dlg.show();
75 59 } else {
76 60 dlg.show();
23 Resources/examples/movie_remote.js
@@ -2,29 +2,31 @@ var win = Titanium.UI.currentWindow;
2 2
3 3 var contentURL = 'http://movies.apple.com/media/us/ipad/2010/tours/apple-ipad-video-us-20100127_r848-9cie.mov';
4 4 if (Ti.Platform.name == 'android') {
5   - contentURL = "http://c0222252.cdn.cloudfiles.rackspacecloud.com/0032_MotoBlur.m4v";
  5 + contentURL = "http://dts.podtrac.com/redirect.mp4/twit.cachefly.net/video/aaa/aaa0033/aaa0033_h264b_640x368_256.mp4";
6 6 }
7 7 var activeMovie = Titanium.Media.createVideoPlayer({
8   - contentURL: contentURL,
  8 + url: contentURL,
9 9 backgroundColor:'#111',
10   - movieControlMode:Titanium.Media.VIDEO_CONTROL_DEFAULT,
  10 + movieControlMode:Titanium.Media.VIDEO_CONTROL_DEFAULT, // See TIMOB-2802, which may change this property name
11 11 scalingMode:Titanium.Media.VIDEO_SCALING_MODE_FILL
12 12 });
13 13
14   -if (parseFloat(Titanium.Platform.version) >= 3.2)
15   -{
16   - win.add(activeMovie);
17   -}
18   -
  14 +win.add(activeMovie);
19 15 var windowClosed = false;
20 16
21 17 activeMovie.addEventListener('complete',function()
22 18 {
23 19 if (!windowClosed)
24 20 {
25   - Titanium.UI.createAlertDialog({title:'Movie', message:'Completed!'}).show();
  21 + var dlg = Titanium.UI.createAlertDialog({title:'Movie', message:'Completed!'});
  22 + if (Ti.Platform.name === "android") {
  23 + win.close();
  24 + dlg.show();
  25 + } else {
  26 + dlg.show();
  27 + win.close();
  28 + }
26 29 }
27   - win.close();
28 30 });
29 31
30 32 activeMovie.play();
@@ -34,7 +36,6 @@ win.addEventListener('close', function()
34 36 if (!windowClosed)
35 37 {
36 38 windowClosed = true;
37   - alert("Window closed");
38 39 activeMovie.stop();
39 40 }
40 41 });
4 Resources/examples/movie_remote2.js
@@ -7,7 +7,7 @@ var win = Titanium.UI.currentWindow;
7 7 var activeMovie = Titanium.Media.createVideoPlayer({
8 8 url:media_url,
9 9 backgroundColor:'#111',
10   - movieControlMode:Titanium.Media.VIDEO_CONTROL_DEFAULT,
  10 + movieControlMode:Titanium.Media.VIDEO_CONTROL_DEFAULT, // See TIMOB-2802, which may change this property name
11 11 scalingMode:Titanium.Media.VIDEO_SCALING_MODE_FILL
12 12 });
13 13
@@ -21,4 +21,4 @@ activeMovie.play();
21 21 win.addEventListener('close', function() {
22 22 alert("Window closed");
23 23 activeMovie.stop();
24   -});
  24 +});
3  Resources/examples/navgroup.js
@@ -22,7 +22,8 @@ var modalWin = Ti.UI.createWindow({
22 22 });
23 23
24 24 var nav = Ti.UI.iPhone.createNavigationGroup({
25   - window:modalWin
  25 + window:modalWin,
  26 + backgroundColor:'blue'
26 27 });
27 28
28 29 var table = Ti.UI.createTableView({
1  Resources/examples/platform.js
@@ -282,6 +282,7 @@ Titanium.Platform.addEventListener('battery', function(e)
282 282
283 283 Titanium.API.info("Current Phone Locale is "+Titanium.Platform.locale);
284 284 Titanium.API.info("OS name is " + Titanium.Platform.osname);
  285 +Titanium.API.info("Runtime: " + Titanium.Platform.runtime);
285 286
286 287 if (Titanium.Platform.osname == 'iphone' || Titanium.Platform.osname == 'ipad') {
287 288 Titanium.API.info("Data network: " + Titanium.Platform.dataAddress);
7 Resources/examples/slider_range.js
... ... @@ -1,6 +1,5 @@
1   -var win = Ti.UI.createWindow({
2   - backgroundColor : 'white'
3   -});
  1 +var win = Ti.UI.currentWindow;
  2 +win.backgroundColor = "white";
4 3
5 4 var customSlider = Titanium.UI.createSlider({
6 5 min:0,
@@ -45,4 +44,4 @@ customSlider.addEventListener('change', function(e) {
45 44 e.thumbSize.width + "height: " + e.thumbSize.height);
46 45 });
47 46
48   -win.open({ animated : false });
  47 +//win.open({ animated : false });
1  Resources/examples/sound_local.js
@@ -7,7 +7,6 @@ var win = Titanium.UI.currentWindow;
7 7 //TODO: USE OBJECT
8 8 var sound = Titanium.Media.createSound();
9 9 sound.url='../cricket.wav'; // For testing #1913
10   -sound.preload = true;
11 10
12 11 //
13 12 // PLAY
4 Resources/examples/sound_remote_url.js
@@ -3,7 +3,7 @@ var win = Titanium.UI.currentWindow;
3 3 var url = "http://www.archive.org/download/CelebrationWav/1.wav";
4 4
5 5 // load from remote url
6   -var sound = Titanium.Media.createSound({url:url,preload:true});
  6 +var sound = Titanium.Media.createSound({url:url});
7 7
8 8 //
9 9 // PLAY
@@ -189,4 +189,4 @@ var i = setInterval(function()
189 189 win.addEventListener('close', function()
190 190 {
191 191 clearInterval(i);
192   -});
  192 +});
10 Resources/examples/tabbedbar.js
@@ -37,7 +37,7 @@ b.addEventListener('click', function()
37 37 //
38 38 // BASIC TABBED BAR
39 39 //
40   -var tb1 = Titanium.UI.createTabbedBar({
  40 +var tb1 = Titanium.UI.iOS.createTabbedBar({
41 41 labels:['One', 'Two', 'Three'],
42 42 backgroundColor:'#336699',
43 43 top:50,
@@ -71,7 +71,7 @@ tb1.addEventListener('click', function(e)
71 71 //
72 72 // TOOLBAR
73 73 //
74   -var tb2 = Titanium.UI.createTabbedBar({
  74 +var tb2 = Titanium.UI.iOS.createTabbedBar({
75 75 labels:['One', 'Two', 'Three', 'Four', 'Five'],
76 76 backgroundColor:'maroon',
77 77 index:2
@@ -90,7 +90,7 @@ tb2.addEventListener('click', function(e)
90 90 //
91 91 // NAVBAR
92 92 //
93   -var tb3 = Titanium.UI.createTabbedBar({
  93 +var tb3 = Titanium.UI.iOS.createTabbedBar({
94 94 labels:['One', 'Two'],
95 95 index:0,
96 96 backgroundColor:'#336699'
@@ -106,7 +106,7 @@ tb3.addEventListener('click', function(e)
106 106
107 107
108 108 // title control
109   -var tb4 = Titanium.UI.createTabbedBar({
  109 +var tb4 = Titanium.UI.iOS.createTabbedBar({
110 110 labels:['One', 'Two'],
111 111 index:0,
112 112 backgroundColor:'red',
@@ -127,7 +127,7 @@ var buttonObjects = [
127 127 {image:'../images/slider_thumb.png', width:50},
128 128 {title:'Toggle Enabled', width:140}
129 129 ];
130   -var tb4 = Titanium.UI.createTabbedBar({
  130 +var tb4 = Titanium.UI.iOS.createTabbedBar({
131 131 labels:buttonObjects,
132 132 backgroundColor:'#999',
133 133 top:100,
4 Resources/examples/table_view_scroll_indicators.js
@@ -28,7 +28,9 @@ var refresh = Titanium.UI.createButton({
28 28 refresh.addEventListener('click', function()
29 29 {
30 30 showScrollIndicators = !showScrollIndicators;
31   - tv.setShowVerticalScrollIndicator(showScrollIndicators);
  31 + if (Ti.Platform.name == 'iPhone OS') {
  32 + tv.setShowVerticalScrollIndicator(showScrollIndicators);
  33 + }
32 34 tv.setData([]);
33 35 setTimeout(function()
34 36 {
10 Resources/examples/textarea_autodetect.js
@@ -8,7 +8,7 @@ win.backgroundColor = 'white';
8 8 var currentDetection;
9 9
10 10 var ta = Ti.UI.createTextArea({
11   - autoLink:Ti.UI.AUTODETECT_ALL,
  11 + autoLink:Ti.UI.iOS.AUTODETECT_ALL,
12 12 left:5, top: 5, right: 5, height: 80,
13 13 editable: false, // this needs to be set to false, otherwise data detection type will fail
14 14 backgroundColor:'#ccc',
@@ -69,16 +69,16 @@ function toggleEditable(e) {
69 69 function setDetection(e) {
70 70 switch (e.source.title) {
71 71 case btn01.title:
72   - ta.autoLink = Ti.UI.AUTODETECT_LINK; // detect links
  72 + ta.autoLink = Ti.UI.iOS.AUTODETECT_LINK; // detect links
73 73 break;
74 74 case btn02.title:
75   - ta.autoLink = Ti.UI.AUTODETECT_PHONE; // detect phone
  75 + ta.autoLink = Ti.UI.iOS.AUTODETECT_PHONE; // detect phone
76 76 break;
77 77 case btn03.title:
78   - ta.autoLink = Ti.UI.AUTODETECT_ALL; // detect all, including email and addresses
  78 + ta.autoLink = Ti.UI.iOS.AUTODETECT_ALL; // detect all, including email and addresses
79 79 break;
80 80 case btn05.title:
81   - ta.autoLink = Ti.UI.AUTODETECT_ADDRESS;
  81 + ta.autoLink = Ti.UI.iOS.AUTODETECT_ADDRESS;
82 82 break;
83 83 default: break;
84 84 }
4 Resources/examples/toolbar.js
@@ -43,7 +43,7 @@ send.addEventListener('click', function()
43 43 });
44 44
45 45 // create and add toolbar
46   -var toolbar1 = Titanium.UI.createToolbar({
  46 +var toolbar1 = Titanium.UI.iOS.createToolbar({
47 47 items:[flexSpace,camera, flexSpace,tf,flexSpace, send,flexSpace],
48 48 bottom:0,
49 49 borderTop:true,
@@ -66,7 +66,7 @@ var revert = Titanium.UI.createButton({
66 66 //
67 67 // Toolbar 2
68 68 //
69   -var toolbar2 = Titanium.UI.createToolbar({
  69 +var toolbar2 = Titanium.UI.iOS.createToolbar({
70 70 items:[change,flexSpace,revert],
71 71 top:130,
72 72 borderTop:true,
7 Resources/examples/twitter.js
@@ -23,7 +23,7 @@ function getTweets(screen_name){
23 23 {
24 24 try
25 25 {
26   - var tweets = eval('('+this.responseText+')');
  26 + var tweets = JSON.parse(this.responseText);
27 27
28 28 for (var c=0;c<tweets.length;c++){
29 29
@@ -102,7 +102,8 @@ function getTweets(screen_name){
102 102 }
103 103 // Create the tableView and add it to the window.
104 104 var tableview = Titanium.UI.createTableView({data:data,minRowHeight:58});
105   - Ti.UI.currentWindow.add(tableview);
  105 + //Ti.UI.currentWindow.add(tableview);
  106 + win.add(tableview);
106 107 }
107 108 catch(E){
108 109 alert(E);
@@ -306,4 +307,4 @@ function prettyDate(time){
306 307 day_diff < 31 && Math.ceil( day_diff / 7 ) + " week" + ((Math.ceil( day_diff / 7 )) == 1 ? "" : "s") + " ago";
307 308 }
308 309 // Get the tweets for 'twitter_name'
309   -getTweets(twitter_name);
  310 +getTweets(twitter_name);
4 Resources/examples/view_event_propagation.js
@@ -60,24 +60,28 @@ win.addEventListener('click',function(ev)
60 60 a.addEventListener('click',function(ev)
61 61 {
62 62 l.text = "view: You clicked on " +ev.source.name;
  63 + Ti.API.info('Clicked: '+ev.source.name);
63 64 clear(l);
64 65 });
65 66
66 67 b.addEventListener('click',function(ev)
67 68 {
68 69 l.text = "view: You clicked on " +ev.source.name;
  70 + Ti.API.info('Clicked: '+ev.source.name);
69 71 clear(l);
70 72 });
71 73
72 74 c.addEventListener('click',function(ev)
73 75 {
74 76 l.text = "view: You clicked on " +ev.source.name;
  77 + Ti.API.info('Clicked: '+ev.source.name);
75 78 clear(l);
76 79 });
77 80
78 81 d.addEventListener('click',function(ev)
79 82 {
80 83 l.text = "view: You clicked on " +ev.source.name;
  84 + Ti.API.info('Clicked: '+ev.source.name);
81 85 clear(l);
82 86 });
83 87
77 Resources/examples/view_gestures.js
... ... @@ -0,0 +1,77 @@
  1 +var win = Titanium.UI.currentWindow;
  2 +win.backgroundColor = 'blue';
  3 +win.name = "window";
  4 +
  5 +var view = Ti.UI.createView({
  6 + backgroundColor:"red"
  7 +});
  8 +
  9 +win.add(view);
  10 +
  11 +function pinchHandler(e) {
  12 + Ti.API.info('pinch:' + JSON.stringify(e));
  13 +}
  14 +
  15 +function longpressHandler(e) {
  16 + Ti.API.info('longpress:' + JSON.stringify(e));
  17 +}
  18 +
  19 +view.addEventListener('pinch', pinchHandler);
  20 +view.addEventListener('longpress', longpressHandler);
  21 +
  22 +var b1 = Titanium.UI.createButton({
  23 + title:'Remove Pinch',
  24 + height:40,
  25 + width:200,
  26 + top:0
  27 +});
  28 +win.add(b1);
  29 +
  30 +function buttonHandler(e) {
  31 + view.removeEventListener('pinch', pinchHandler);
  32 +}
  33 +
  34 +b1.addEventListener('click', buttonHandler);
  35 +
  36 +//////////
  37 +
  38 +// create table view data object
  39 +var data = [];
  40 +
  41 +data[0] = Ti.UI.createTableViewRow({hasChild:true,title:'No cell selection',selectionStyle:Ti.UI.iPhone.TableViewCellSelectionStyle.NONE});
  42 +data[1] = Ti.UI.createTableViewRow({hasDetail:true,title:'Blue cell selection',selectionStyle:Ti.UI.iPhone.TableViewCellSelectionStyle.BLUE});
  </