├── README.md
└── example
└── download_multiple_files
├── .gitignore
├── .project
├── CHANGELOG.txt
├── LICENSE.txt
├── Resources
├── android
│ ├── appicon.png
│ ├── default.png
│ └── images
│ │ ├── res-long-land-hdpi
│ │ └── default.png
│ │ ├── res-long-land-ldpi
│ │ └── default.png
│ │ ├── res-long-port-hdpi
│ │ └── default.png
│ │ ├── res-long-port-ldpi
│ │ └── default.png
│ │ ├── res-notlong-land-hdpi
│ │ └── default.png
│ │ ├── res-notlong-land-ldpi
│ │ └── default.png
│ │ ├── res-notlong-land-mdpi
│ │ └── default.png
│ │ ├── res-notlong-port-hdpi
│ │ └── default.png
│ │ ├── res-notlong-port-ldpi
│ │ └── default.png
│ │ └── res-notlong-port-mdpi
│ │ └── default.png
├── app.js
├── downloadWindow.js
├── download_utility.js
├── images
│ ├── KS_nav_ui.png
│ └── KS_nav_views.png
├── iphone
│ ├── Default-Landscape.png
│ ├── Default-Portrait.png
│ ├── Default.png
│ ├── Default@2x.png
│ └── appicon.png
├── mainWindow.js
└── viewWindow.js
├── manifest
└── tiapp.xml
/README.md:
--------------------------------------------------------------------------------
1 | A File Download Library for Appcelerator Titanium Mobile Projects
2 | ----------------------------------------------------------
3 |
4 |
5 | Support:
6 | ========
7 | * Download the latest version from: https://github.com/ddehghan/Titanium-PredictiveCache
8 | * Please file bugs or suggestion on github.
9 |
10 |
11 | This library implements a download queue that downloads a single or multiple files to device.
12 |
13 | Features:
14 | =========
15 |
16 | Version 1.0:
17 |
18 | * Download 1 file or multiple files.
19 | * Standalone library the handles all download functionality
20 | * Logs downloaded urls to debug stream to ease troubleshooting
21 | * Callback function after each file is downloaded
22 | * Callback function after all files in a queue are downloaded
23 |
24 | Version 2.0:
25 |
26 | * Predictively download files that the user will likely download in the future. So that they are ready when the application needs them. We are currently developing this prediction algorithm. If you would like to get a preview send me an email. ddehghan at gmail.com
27 |
28 |
29 | How it works:
30 | =============
31 | The urls are first added to a queue. Then a recursive call is made to process each of the items in the queue.
32 | After each file is download a user defined callback function is called. After all files in the queue are downloaded
33 | an other user defined callback function is called.
34 |
35 |
36 | Example 1:
37 | ==========
38 | // Download 1 File
39 | Ti.include('download_utility.js');
40 |
41 | var _callBack_DownloadOneFileFinished = function(download_result) {
42 | alert("finished downloading" + download_result.path);
43 | };
44 |
45 | utility.downloadOneFile("http://bit.ly/qhYRW9", Titanium.Filesystem.applicationDataDirectory + '1.jpg', _callBack_DownloadOneFileFinished);
46 |
47 |
48 |
49 | Example 2:
50 | ==========
51 | // Download multiple files
52 | Ti.include('download_utility.js');
53 |
54 | var downloadQueue = [{ 'filepath' : Titanium.Filesystem.applicationDataDirectory + "2.jpg", 'url' : "http://bit.ly/oiAxc3"},
55 | {'filepath' : Titanium.Filesystem.applicationDataDirectory + "3.jpg", 'url' : "http://bit.ly/qgAbOE"}];
56 |
57 | var _callBack_DownloadOneFileFinished = function(download_result) {
58 | alert("finished downloading" + download_result.path);
59 | };
60 |
61 | var _callBack_DownloadMultipleFileFinished = function() {
62 | alert("finished downloading all files");
63 | };
64 |
65 | utility.downloadMultiFile(downloadQueue, _callBack_DownloadOneFileFinished, _callBack_DownloadMultipleFileFinished);
66 |
67 |
68 | Tested on:
69 | ==========
70 | * iOS 4.3
71 | * TI platform version 1.8.x
72 | * Android 2.2
73 |
74 |
75 |
76 | Please Contribute:
77 | ==================
78 | Help make this a better library for everyone. Send your pull request!
79 |
--------------------------------------------------------------------------------
/example/download_multiple_files/.gitignore:
--------------------------------------------------------------------------------
1 | tmp
2 | *.class
3 | *.pyc
4 | *.pyo
5 | build/
6 | .settings/
7 | .idea/
8 | /.fastdev.lock
9 |
--------------------------------------------------------------------------------
/example/download_multiple_files/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | DownloadMultipleFiles
4 |
5 |
6 |
7 |
8 |
9 | com.appcelerator.titanium.core.builder
10 |
11 |
12 |
13 |
14 | com.aptana.ide.core.unifiedBuilder
15 |
16 |
17 |
18 |
19 |
20 | com.appcelerator.titanium.mobile.nature
21 | com.aptana.projects.webnature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/example/download_multiple_files/CHANGELOG.txt:
--------------------------------------------------------------------------------
1 | Version 0.1
2 | ===========
3 |
4 | * Implemented single and multiple file download
5 | * Refactored the code to not pollute the global scope
--------------------------------------------------------------------------------
/example/download_multiple_files/LICENSE.txt:
--------------------------------------------------------------------------------
1 | DownloadMultipleFiles Project:
2 |
3 | Available for use under the [MIT License](http://en.wikipedia.org/wiki/MIT_License)
4 |
5 | Copyright (c) 2011 by Harvest
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | of this software and associated documentation files (the "Software"), to deal
9 | in the Software without restriction, including without limitation the rights
10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be included in
15 | all copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | THE SOFTWARE.
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/android/appicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddehghan/Titanium-PredictiveCache/36390a54a2353e2a4c3bdb6d52bc7b3b9a3a3221/example/download_multiple_files/Resources/android/appicon.png
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/android/default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddehghan/Titanium-PredictiveCache/36390a54a2353e2a4c3bdb6d52bc7b3b9a3a3221/example/download_multiple_files/Resources/android/default.png
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/android/images/res-long-land-hdpi/default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddehghan/Titanium-PredictiveCache/36390a54a2353e2a4c3bdb6d52bc7b3b9a3a3221/example/download_multiple_files/Resources/android/images/res-long-land-hdpi/default.png
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/android/images/res-long-land-ldpi/default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddehghan/Titanium-PredictiveCache/36390a54a2353e2a4c3bdb6d52bc7b3b9a3a3221/example/download_multiple_files/Resources/android/images/res-long-land-ldpi/default.png
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/android/images/res-long-port-hdpi/default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddehghan/Titanium-PredictiveCache/36390a54a2353e2a4c3bdb6d52bc7b3b9a3a3221/example/download_multiple_files/Resources/android/images/res-long-port-hdpi/default.png
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/android/images/res-long-port-ldpi/default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddehghan/Titanium-PredictiveCache/36390a54a2353e2a4c3bdb6d52bc7b3b9a3a3221/example/download_multiple_files/Resources/android/images/res-long-port-ldpi/default.png
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/android/images/res-notlong-land-hdpi/default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddehghan/Titanium-PredictiveCache/36390a54a2353e2a4c3bdb6d52bc7b3b9a3a3221/example/download_multiple_files/Resources/android/images/res-notlong-land-hdpi/default.png
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/android/images/res-notlong-land-ldpi/default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddehghan/Titanium-PredictiveCache/36390a54a2353e2a4c3bdb6d52bc7b3b9a3a3221/example/download_multiple_files/Resources/android/images/res-notlong-land-ldpi/default.png
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/android/images/res-notlong-land-mdpi/default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddehghan/Titanium-PredictiveCache/36390a54a2353e2a4c3bdb6d52bc7b3b9a3a3221/example/download_multiple_files/Resources/android/images/res-notlong-land-mdpi/default.png
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/android/images/res-notlong-port-hdpi/default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddehghan/Titanium-PredictiveCache/36390a54a2353e2a4c3bdb6d52bc7b3b9a3a3221/example/download_multiple_files/Resources/android/images/res-notlong-port-hdpi/default.png
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/android/images/res-notlong-port-ldpi/default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddehghan/Titanium-PredictiveCache/36390a54a2353e2a4c3bdb6d52bc7b3b9a3a3221/example/download_multiple_files/Resources/android/images/res-notlong-port-ldpi/default.png
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/android/images/res-notlong-port-mdpi/default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddehghan/Titanium-PredictiveCache/36390a54a2353e2a4c3bdb6d52bc7b3b9a3a3221/example/download_multiple_files/Resources/android/images/res-notlong-port-mdpi/default.png
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/app.js:
--------------------------------------------------------------------------------
1 | myNameSpace = {};
2 |
3 | Ti.include('downloadWindow.js');
4 | Ti.include('viewWindow.js');
5 | Ti.include('download_utility.js');
6 | Ti.include('mainWindow.js');
7 |
8 |
9 | MyAppGlob = {
10 | MainWindow : new myNameSpace.MainWindow(),
11 | DownloadWindow : new myNameSpace.DownloadWindow(),
12 | ViewWindow : new myNameSpace.ViewWindow()
13 | };
14 |
15 | MyAppGlob.ViewWindow.init();
16 | MyAppGlob.DownloadWindow.init();
17 | MyAppGlob.MainWindow.init();
18 |
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/downloadWindow.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | // All your JS code goes in here
3 |
4 | myNameSpace.DownloadWindow = function() {
5 | var _window = '';
6 | var _image = '';
7 |
8 | var _callBack_DownloadOneFileFinished = function(download_result) {
9 | if( typeof (download_result) !== 'undefined') {
10 | _image.image = Titanium.Filesystem.getFile(download_result.path);
11 | Ti.API.info('View this image: ' + download_result.path);
12 | }
13 | };
14 | var _callBack_DownloadMultipleFileFinished = function() {
15 |
16 | var alertDialog = Titanium.UI.createAlertDialog({
17 | title : '',
18 | message : 'All files downloaded',
19 | buttonNames : ['OK']
20 | });
21 | alertDialog.show();
22 | };
23 | var _init = function() {
24 | _window = '';
25 | _window = Titanium.UI.createWindow({
26 | title : 'Tab 1',
27 | backgroundColor : '#030'
28 | });
29 |
30 | var label1 = Titanium.UI.createLabel({
31 | color : '#999',
32 | text : 'I am Window 1',
33 | font : {
34 | fontSize : 20,
35 | fontFamily : 'Helvetica Neue'
36 | },
37 | textAlign : 'center',
38 | width : 'auto',
39 | height : 60,
40 | top : 10
41 | });
42 |
43 | _window.add(label1);
44 |
45 | var onefileButton = Titanium.UI.createButton({
46 | title : 'Get 1 file',
47 | height : 40,
48 | width : 100,
49 | top : 100,
50 | left : 30
51 | });
52 |
53 | onefileButton.addEventListener('click', function() {
54 |
55 | utility.downloadOneFile("http://bit.ly/qhYRW9", Titanium.Filesystem.applicationDataDirectory + '1.jpg', _callBack_DownloadOneFileFinished);
56 |
57 | });
58 |
59 | _window.add(onefileButton);
60 |
61 | var multifileButton = Titanium.UI.createButton({
62 | title : 'Get 5 file',
63 | height : 40,
64 | width : 100,
65 | top : 100,
66 | right : 30
67 | });
68 |
69 | multifileButton.addEventListener('click', function() {
70 |
71 | var downloadQueue = [{
72 | 'filepath' : Titanium.Filesystem.applicationDataDirectory + "1.jpg",
73 | 'url' : "http://bit.ly/oiAxc3"
74 | }, {
75 | 'filepath' : Titanium.Filesystem.applicationDataDirectory + "2.jpg",
76 | 'url' : "http://bit.ly/oiAxc3"
77 | }, {
78 | 'filepath' : Titanium.Filesystem.applicationDataDirectory + "3.jpg",
79 | 'url' : "http://bit.ly/qgAbOE"
80 | }, {
81 | 'filepath' : Titanium.Filesystem.applicationDataDirectory + "4.jpg",
82 | 'url' : "http://bit.ly/nzZiVd"
83 | }, {
84 | 'filepath' : Titanium.Filesystem.applicationDataDirectory + "5.jpg",
85 | 'url' : "http://bit.ly/pkGwHF"
86 | }];
87 |
88 | downloadQueue.push({
89 | 'filepath' : Titanium.Filesystem.applicationDataDirectory + "6.jpg",
90 | 'url' : "http://bit.ly/nlRoQi"
91 | });
92 |
93 | utility.downloadMultiFile(downloadQueue, _callBack_DownloadOneFileFinished, _callBack_DownloadMultipleFileFinished);
94 |
95 | });
96 |
97 |
98 | _window.add(multifileButton);
99 | _image = Titanium.UI.createImageView({
100 | top : 150,
101 | left : 0,
102 | width : Ti.Platform.displayCaps.platformWidth,
103 | height: Ti.Platform.displayCaps.platformHeight-150
104 | });
105 |
106 | _window.add(_image);
107 | };
108 | return {// publicly accessible API
109 | init : function() {
110 | return _init();
111 | },
112 | getWindow : function() {
113 | return _window;
114 | }
115 | };
116 |
117 | };
118 | })();
119 |
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/download_utility.js:
--------------------------------------------------------------------------------
1 | var utility = {};
2 |
3 |
4 | /**
5 | * Make and http call and save the result into a file.
6 | *
7 | * Parameters:
8 | * url - url of the http call to be downloaded.
9 | * localFilePath - The path of the local file where the content will be saved. The folder in which the file to be downloaded must exsists.
10 | * callBack_DownloadOneFileFinished - The fucntion that is called once the download has finished
11 | * Callback return object:
12 | * { status, path}
13 | * status: integer - HTTP status for the call. 200 means successful.
14 | * path: string - full path of the file just downloaded
15 | */
16 | utility.downloadOneFile = function(url, localFilepath, callBack_DownloadOneFileFinished) {
17 |
18 | var c = Titanium.Network.createHTTPClient();
19 |
20 | if(null != callBack_DownloadOneFileFinished) {
21 | c.onerror = function(e) {
22 | Ti.API.info('MyApp: Download failed: url= ' + url + ' Error=' + e.error);
23 |
24 | callBack_DownloadOneFileFinished({
25 | status : e.error,
26 | path : ''
27 | });
28 | };
29 |
30 | c.onload = function(e) {
31 |
32 | if(Titanium.Platform.name === 'android') {
33 |
34 | // On android HTTPClient will not save the file to disk. So have to hack around it
35 | Ti.API.info('MyApp: (Andoid) Downloaded this file from server:.' + localFilepath);
36 | var f = Titanium.Filesystem.getFile(localFilepath);
37 | f.write(c.responseData);
38 | }
39 |
40 | callBack_DownloadOneFileFinished({
41 | status : c.status,
42 | path : localFilepath
43 | });
44 | };
45 | }
46 |
47 | c.open('GET', url);
48 |
49 | if(null != localFilepath && Titanium.Platform.name !== 'android') {
50 | Ti.API.info('MyApp: (iOS) Downloaded this file from server:.' + localFilepath);
51 | c.file = Titanium.Filesystem.getFile(localFilepath);
52 | }
53 |
54 | c.send();
55 | };
56 |
57 | /**
58 | * Given an array of URLs make several http calls and save the results into different file.
59 | *
60 | * Parameters:
61 | * downloadQueue - [{'filepath' : "", 'url': ""}]
62 | * filepath - The path of the local file where the content will be saved. The folder in which the file to be downloaded must exsists.
63 | * url - url of the http call to be downloaded.
64 | * callBack_DownloadOneFileFinished - The fucntion that is called once each file download has finished
65 | * Callback return object:
66 | * { status, path}
67 | * status: integer - HTTP status for the call. 200 means successful.
68 | * path: string - full path of the file just downloaded
69 | * callBack_DownloadMultipleFileFinished - The function that is caled once all the files are downloaded. This function does not accept any parameters
70 | *
71 | */
72 | utility.downloadMultiFile = function(downloadQueue, callBack_DownloadOneFileFinished, callBack_DownloadMultipleFileFinished) {
73 |
74 | var queueIndex = 0;
75 |
76 | var processQueue = function(download_result) {
77 | //once the download of one file is finished the downloadOneFile will call back the processQueue
78 | //which will move the index forward and download another file
79 |
80 | if( typeof (download_result) !== 'undefined') {
81 | callBack_DownloadOneFileFinished(download_result);
82 | }
83 |
84 | if(queueIndex < downloadQueue.length) {
85 |
86 |
87 | utility.downloadOneFile(downloadQueue[queueIndex].url, downloadQueue[queueIndex].filepath, processQueue);
88 | queueIndex++;
89 |
90 | } else {
91 | callBack_DownloadMultipleFileFinished();
92 | }
93 |
94 | };
95 | processQueue();
96 | };
97 |
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/images/KS_nav_ui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddehghan/Titanium-PredictiveCache/36390a54a2353e2a4c3bdb6d52bc7b3b9a3a3221/example/download_multiple_files/Resources/images/KS_nav_ui.png
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/images/KS_nav_views.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddehghan/Titanium-PredictiveCache/36390a54a2353e2a4c3bdb6d52bc7b3b9a3a3221/example/download_multiple_files/Resources/images/KS_nav_views.png
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/iphone/Default-Landscape.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddehghan/Titanium-PredictiveCache/36390a54a2353e2a4c3bdb6d52bc7b3b9a3a3221/example/download_multiple_files/Resources/iphone/Default-Landscape.png
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/iphone/Default-Portrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddehghan/Titanium-PredictiveCache/36390a54a2353e2a4c3bdb6d52bc7b3b9a3a3221/example/download_multiple_files/Resources/iphone/Default-Portrait.png
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/iphone/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddehghan/Titanium-PredictiveCache/36390a54a2353e2a4c3bdb6d52bc7b3b9a3a3221/example/download_multiple_files/Resources/iphone/Default.png
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/iphone/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddehghan/Titanium-PredictiveCache/36390a54a2353e2a4c3bdb6d52bc7b3b9a3a3221/example/download_multiple_files/Resources/iphone/Default@2x.png
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/iphone/appicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddehghan/Titanium-PredictiveCache/36390a54a2353e2a4c3bdb6d52bc7b3b9a3a3221/example/download_multiple_files/Resources/iphone/appicon.png
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/mainWindow.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | // All your JS code goes in here
3 |
4 | myNameSpace.MainWindow = function() {
5 | var _window = '';
6 | var _tabGroup = '';
7 |
8 | var _init = function() {
9 | _window = '';
10 | _window = Ti.UI.createWindow({
11 | backgroundColor : "#fff",
12 | title : "Example app",
13 | fullscreen : false
14 | });
15 |
16 | // create tab group
17 | _tabGroup = Titanium.UI.createTabGroup();
18 |
19 | var tab1 = Titanium.UI.createTab({
20 | icon : 'images/KS_nav_ui.png',
21 | title : 'Tab 1',
22 | window : MyAppGlob.DownloadWindow.getWindow()
23 | });
24 |
25 | _tabGroup.addTab(tab1);
26 |
27 | var tab3 = Titanium.UI.createTab({
28 | icon : 'images/KS_nav_views.png',
29 | title : 'Tab 2',
30 | window : MyAppGlob.ViewWindow.getWindow()
31 | });
32 |
33 | _tabGroup.addTab(tab3);
34 |
35 | _tabGroup.open();
36 | };
37 | return {// publicly accessible API
38 |
39 | init : function() {
40 | return _init();
41 | },
42 | getWindow : function() {
43 | return _window;
44 | }
45 | };
46 |
47 | };
48 | })();
49 |
--------------------------------------------------------------------------------
/example/download_multiple_files/Resources/viewWindow.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | // All your JS code goes in here
3 |
4 | myNameSpace.ViewWindow = function() {
5 | var _window = '';
6 | var _tabGroup = '';
7 |
8 | var _init = function() {
9 | _window = '';
10 | _window = Titanium.UI.createWindow({
11 | title : 'Tab 2',
12 | backgroundColor : '#030'
13 | });
14 |
15 | var label2 = Titanium.UI.createLabel({
16 | color : '#999',
17 | text : 'I am Window 2',
18 | font : {
19 | fontSize : 20,
20 | fontFamily : 'Helvetica Neue'
21 | },
22 | textAlign : 'center',
23 | width : 'auto',
24 | height : 60,
25 | top : 10
26 | });
27 |
28 | _window.add(label2);
29 |
30 | // var imageView = Titanium.UI.createImageView({
31 | //
32 | // // top:150,
33 | // // left:10
34 | //
35 | // });
36 | // _window.add(imageView);
37 |
38 | // if( typeof MyAppGlob.imagesToView[0] !== 'undefined') {
39 | // label2.text = 'xxxxxx';
40 | // imagePath = Titanium.Filesystem.applicationDataDirectory + imagesToView[0];
41 | // imageView.image = Titanium.Filesystem.getFile(imagePath);
42 | // Ti.API.info('View this image: ' + imagePath);
43 | // }
44 | };
45 | return {// publicly accessible API
46 |
47 | init : function() {
48 | return _init();
49 | },
50 | getWindow : function() {
51 | return _window;
52 | }
53 | };
54 |
55 | };
56 | })();
57 |
--------------------------------------------------------------------------------
/example/download_multiple_files/manifest:
--------------------------------------------------------------------------------
1 | #appname:DownloadMultipleFiles
2 | #publisher:developer
3 | #url:http://
4 | #image:appicon.png
5 | #appid:com.mycompany.app1
6 | #desc:not specified
7 | #type:ipad
8 | #guid:49efc70c-b445-49f4-bab4-e23d39f09bf0
9 |
--------------------------------------------------------------------------------
/example/download_multiple_files/tiapp.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | false
5 | true
6 | true
7 | true
8 | false
9 |
10 | com.mycompany.app1
11 | DownloadMultipleFiles
12 | 1.0
13 | developer
14 | http://
15 | not specified
16 | 2011 by developer
17 | appicon.png
18 | false
19 | false
20 | default
21 | false
22 | false
23 | false
24 | true
25 | 49efc70c-b445-49f4-bab4-e23d39f09bf0
26 |
27 |
28 | Ti.UI.PORTRAIT
29 |
30 |
31 | Ti.UI.PORTRAIT
32 | Ti.UI.UPSIDE_PORTRAIT
33 | Ti.UI.LANDSCAPE_LEFT
34 | Ti.UI.LANDSCAPE_RIGHT
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------