├── .gitignore ├── CHANGELOG.txt ├── LICENSE ├── LICENSE.txt ├── Module ├── android │ └── imagegallery │ │ ├── .classpath │ │ ├── .gitignore │ │ ├── .settings │ │ ├── org.eclipse.jdt.apt.core.prefs │ │ └── org.eclipse.jdt.core.prefs │ │ ├── LICENSE │ │ ├── assets │ │ ├── README │ │ └── com.codeboxed.imagegallery.js │ │ ├── build.properties │ │ ├── build.xml │ │ ├── dist │ │ └── imagegallery.jar │ │ ├── documentation │ │ └── index.md │ │ ├── example │ │ ├── 1.jpg │ │ ├── 2.jpg │ │ └── app.js │ │ ├── hooks │ │ ├── README │ │ ├── add.py │ │ ├── install.py │ │ ├── remove.py │ │ └── uninstall.py │ │ ├── manifest │ │ ├── platform │ │ └── README │ │ ├── src │ │ └── com │ │ │ └── codeboxed │ │ │ └── imagegallery │ │ │ ├── ExampleProxy.java │ │ │ └── ImagegalleryModule.java │ │ └── timodule.xml └── ios │ └── imagegallery │ ├── .gitignore │ ├── Classes │ ├── .gitignore │ ├── ComCodeboxedImagegalleryModule.h │ ├── ComCodeboxedImagegalleryModule.m │ ├── ComCodeboxedImagegalleryModuleAssets.h │ └── ComCodeboxedImagegalleryModuleAssets.m │ ├── ComCodeboxedImagegallery_Prefix.pch │ ├── LICENSE │ ├── README │ ├── assets │ ├── README │ └── com.codeboxed.imagegallery.js │ ├── build.py │ ├── documentation │ └── index.md │ ├── example │ ├── 1.jpg │ ├── 2.jpg │ └── app.js │ ├── hooks │ ├── README │ ├── add.py │ ├── install.py │ ├── remove.py │ └── uninstall.py │ ├── imagegallery.xcodeproj │ └── project.pbxproj │ ├── manifest │ ├── module.xcconfig │ ├── platform │ └── README │ ├── timodule.xml │ └── titanium.xcconfig ├── README ├── README.markdown ├── Resources ├── KS_nav_ui.png ├── KS_nav_views.png ├── 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 ├── com.codeboxed.imagegallery.js ├── default_app_logo.png ├── image_gallery.js ├── image_gallery_module.js ├── image_gallery_single.js ├── images │ ├── 1.jpg │ ├── 2.jpg │ ├── 3.jpg │ ├── 4.jpg │ ├── 5.jpg │ ├── 6.jpg │ ├── icon_arrow_left.png │ └── icon_arrow_right.png └── iphone │ ├── Default-Landscape.png │ ├── Default-Portrait.png │ ├── Default.png │ ├── Default@2x.png │ └── appicon.png ├── api.jsca ├── manifest └── tiapp.xml /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_STORE 2 | 3 | build/ 4 | 5 | .project 6 | 7 | build.log 8 | -------------------------------------------------------------------------------- /CHANGELOG.txt: -------------------------------------------------------------------------------- 1 | Place your change log text here. This file will be incorporated with your app at package time. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2009 Appcelerator, Inc. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | (or the full text of the license is below) 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | 17 | 18 | 19 | Apache License 20 | Version 2.0, January 2004 21 | http://www.apache.org/licenses/ 22 | 23 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 24 | 25 | 1. Definitions. 26 | 27 | "License" shall mean the terms and conditions for use, reproduction, 28 | and distribution as defined by Sections 1 through 9 of this document. 29 | 30 | "Licensor" shall mean the copyright owner or entity authorized by 31 | the copyright owner that is granting the License. 32 | 33 | "Legal Entity" shall mean the union of the acting entity and all 34 | other entities that control, are controlled by, or are under common 35 | control with that entity. For the purposes of this definition, 36 | "control" means (i) the power, direct or indirect, to cause the 37 | direction or management of such entity, whether by contract or 38 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 39 | outstanding shares, or (iii) beneficial ownership of such entity. 40 | 41 | "You" (or "Your") shall mean an individual or Legal Entity 42 | exercising permissions granted by this License. 43 | 44 | "Source" form shall mean the preferred form for making modifications, 45 | including but not limited to software source code, documentation 46 | source, and configuration files. 47 | 48 | "Object" form shall mean any form resulting from mechanical 49 | transformation or translation of a Source form, including but 50 | not limited to compiled object code, generated documentation, 51 | and conversions to other media types. 52 | 53 | "Work" shall mean the work of authorship, whether in Source or 54 | Object form, made available under the License, as indicated by a 55 | copyright notice that is included in or attached to the work 56 | (an example is provided in the Appendix below). 57 | 58 | "Derivative Works" shall mean any work, whether in Source or Object 59 | form, that is based on (or derived from) the Work and for which the 60 | editorial revisions, annotations, elaborations, or other modifications 61 | represent, as a whole, an original work of authorship. For the purposes 62 | of this License, Derivative Works shall not include works that remain 63 | separable from, or merely link (or bind by name) to the interfaces of, 64 | the Work and Derivative Works thereof. 65 | 66 | "Contribution" shall mean any work of authorship, including 67 | the original version of the Work and any modifications or additions 68 | to that Work or Derivative Works thereof, that is intentionally 69 | submitted to Licensor for inclusion in the Work by the copyright owner 70 | or by an individual or Legal Entity authorized to submit on behalf of 71 | the copyright owner. For the purposes of this definition, "submitted" 72 | means any form of electronic, verbal, or written communication sent 73 | to the Licensor or its representatives, including but not limited to 74 | communication on electronic mailing lists, source code control systems, 75 | and issue tracking systems that are managed by, or on behalf of, the 76 | Licensor for the purpose of discussing and improving the Work, but 77 | excluding communication that is conspicuously marked or otherwise 78 | designated in writing by the copyright owner as "Not a Contribution." 79 | 80 | "Contributor" shall mean Licensor and any individual or Legal Entity 81 | on behalf of whom a Contribution has been received by Licensor and 82 | subsequently incorporated within the Work. 83 | 84 | 2. Grant of Copyright License. Subject to the terms and conditions of 85 | this License, each Contributor hereby grants to You a perpetual, 86 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 87 | copyright license to reproduce, prepare Derivative Works of, 88 | publicly display, publicly perform, sublicense, and distribute the 89 | Work and such Derivative Works in Source or Object form. 90 | 91 | 3. Grant of Patent License. Subject to the terms and conditions of 92 | this License, each Contributor hereby grants to You a perpetual, 93 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 94 | (except as stated in this section) patent license to make, have made, 95 | use, offer to sell, sell, import, and otherwise transfer the Work, 96 | where such license applies only to those patent claims licensable 97 | by such Contributor that are necessarily infringed by their 98 | Contribution(s) alone or by combination of their Contribution(s) 99 | with the Work to which such Contribution(s) was submitted. If You 100 | institute patent litigation against any entity (including a 101 | cross-claim or counterclaim in a lawsuit) alleging that the Work 102 | or a Contribution incorporated within the Work constitutes direct 103 | or contributory patent infringement, then any patent licenses 104 | granted to You under this License for that Work shall terminate 105 | as of the date such litigation is filed. 106 | 107 | 4. Redistribution. You may reproduce and distribute copies of the 108 | Work or Derivative Works thereof in any medium, with or without 109 | modifications, and in Source or Object form, provided that You 110 | meet the following conditions: 111 | 112 | (a) You must give any other recipients of the Work or 113 | Derivative Works a copy of this License; and 114 | 115 | (b) You must cause any modified files to carry prominent notices 116 | stating that You changed the files; and 117 | 118 | (c) You must retain, in the Source form of any Derivative Works 119 | that You distribute, all copyright, patent, trademark, and 120 | attribution notices from the Source form of the Work, 121 | excluding those notices that do not pertain to any part of 122 | the Derivative Works; and 123 | 124 | (d) If the Work includes a "NOTICE" text file as part of its 125 | distribution, then any Derivative Works that You distribute must 126 | include a readable copy of the attribution notices contained 127 | within such NOTICE file, excluding those notices that do not 128 | pertain to any part of the Derivative Works, in at least one 129 | of the following places: within a NOTICE text file distributed 130 | as part of the Derivative Works; within the Source form or 131 | documentation, if provided along with the Derivative Works; or, 132 | within a display generated by the Derivative Works, if and 133 | wherever such third-party notices normally appear. The contents 134 | of the NOTICE file are for informational purposes only and 135 | do not modify the License. You may add Your own attribution 136 | notices within Derivative Works that You distribute, alongside 137 | or as an addendum to the NOTICE text from the Work, provided 138 | that such additional attribution notices cannot be construed 139 | as modifying the License. 140 | 141 | You may add Your own copyright statement to Your modifications and 142 | may provide additional or different license terms and conditions 143 | for use, reproduction, or distribution of Your modifications, or 144 | for any such Derivative Works as a whole, provided Your use, 145 | reproduction, and distribution of the Work otherwise complies with 146 | the conditions stated in this License. 147 | 148 | 5. Submission of Contributions. Unless You explicitly state otherwise, 149 | any Contribution intentionally submitted for inclusion in the Work 150 | by You to the Licensor shall be under the terms and conditions of 151 | this License, without any additional terms or conditions. 152 | Notwithstanding the above, nothing herein shall supersede or modify 153 | the terms of any separate license agreement you may have executed 154 | with Licensor regarding such Contributions. 155 | 156 | 6. Trademarks. This License does not grant permission to use the trade 157 | names, trademarks, service marks, or product names of the Licensor, 158 | except as required for reasonable and customary use in describing the 159 | origin of the Work and reproducing the content of the NOTICE file. 160 | 161 | 7. Disclaimer of Warranty. Unless required by applicable law or 162 | agreed to in writing, Licensor provides the Work (and each 163 | Contributor provides its Contributions) on an "AS IS" BASIS, 164 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 165 | implied, including, without limitation, any warranties or conditions 166 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 167 | PARTICULAR PURPOSE. You are solely responsible for determining the 168 | appropriateness of using or redistributing the Work and assume any 169 | risks associated with Your exercise of permissions under this License. 170 | 171 | 8. Limitation of Liability. In no event and under no legal theory, 172 | whether in tort (including negligence), contract, or otherwise, 173 | unless required by applicable law (such as deliberate and grossly 174 | negligent acts) or agreed to in writing, shall any Contributor be 175 | liable to You for damages, including any direct, indirect, special, 176 | incidental, or consequential damages of any character arising as a 177 | result of this License or out of the use or inability to use the 178 | Work (including but not limited to damages for loss of goodwill, 179 | work stoppage, computer failure or malfunction, or any and all 180 | other commercial damages or losses), even if such Contributor 181 | has been advised of the possibility of such damages. 182 | 183 | 9. Accepting Warranty or Additional Liability. While redistributing 184 | the Work or Derivative Works thereof, You may choose to offer, 185 | and charge a fee for, acceptance of support, warranty, indemnity, 186 | or other liability obligations and/or rights consistent with this 187 | License. However, in accepting such obligations, You may act only 188 | on Your own behalf and on Your sole responsibility, not on behalf 189 | of any other Contributor, and only if You agree to indemnify, 190 | defend, and hold each Contributor harmless for any liability 191 | incurred by, or claims asserted against, such Contributor by reason 192 | of your accepting any such warranty or additional liability. 193 | 194 | END OF TERMS AND CONDITIONS 195 | 196 | APPENDIX: How to apply the Apache License to your work. 197 | 198 | To apply the Apache License to your work, attach the following 199 | boilerplate notice, with the fields enclosed by brackets "[]" 200 | replaced with your own identifying information. (Don't include 201 | the brackets!) The text should be enclosed in the appropriate 202 | comment syntax for the file format. We also recommend that a 203 | file or class name and description of purpose be included on the 204 | same "printed page" as the copyright notice for easier 205 | identification within third-party archives. 206 | 207 | Copyright [yyyy] [name of copyright owner] 208 | 209 | Licensed under the Apache License, Version 2.0 (the "License"); 210 | you may not use this file except in compliance with the License. 211 | You may obtain a copy of the License at 212 | 213 | http://www.apache.org/licenses/LICENSE-2.0 214 | 215 | Unless required by applicable law or agreed to in writing, software 216 | distributed under the License is distributed on an "AS IS" BASIS, 217 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 218 | See the License for the specific language governing permissions and 219 | limitations under the License. -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Codeboxed 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Module/android/imagegallery/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Module/android/imagegallery/.gitignore: -------------------------------------------------------------------------------- 1 | tmp 2 | bin 3 | build 4 | *.zip 5 | .apt_generated 6 | -------------------------------------------------------------------------------- /Module/android/imagegallery/.settings/org.eclipse.jdt.apt.core.prefs: -------------------------------------------------------------------------------- 1 | #Thu Sep 02 15:18:34 CDT 2010 2 | eclipse.preferences.version=1 3 | org.eclipse.jdt.apt.aptEnabled=true 4 | org.eclipse.jdt.apt.genSrcDir=.apt_generated 5 | org.eclipse.jdt.apt.reconcileEnabled=true 6 | 7 | org.eclipse.jdt.apt.processorOptions/kroll.jsonFile=imagegallery.json 8 | -------------------------------------------------------------------------------- /Module/android/imagegallery/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | #Thu Sep 02 15:18:34 CDT 2010 2 | eclipse.preferences.version=1 3 | org.eclipse.jdt.core.compiler.processAnnotations=enabled 4 | -------------------------------------------------------------------------------- /Module/android/imagegallery/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Codeboxed 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Module/android/imagegallery/assets/README: -------------------------------------------------------------------------------- 1 | Place your assets like PNG files in this directory and they will be packaged with your module. 2 | 3 | If you create a file named com.codeboxed.imagegallery.js in this directory, it will be 4 | compiled and used as your module. This allows you to run pure Javascript 5 | modules that are pre-compiled. 6 | 7 | -------------------------------------------------------------------------------- /Module/android/imagegallery/assets/com.codeboxed.imagegallery.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Titanium-Image-Gallery 3 | * Created by Codeboxed on 2011-07-03. 4 | */ 5 | 6 | /** 7 | * Create an image gallery 8 | * 9 | * @method create 10 | * @param properties The object to configure the library 11 | * @param properties.win (optional) The window to attach the image gallery to. 12 | * Only use the Ti.UI.currentWindow for now 13 | * @param properties.images An Array containg the image objects 14 | * @param properties.images[].path The relative path for the image 15 | * @param properties.images[].caption The image caption 16 | * @return {Titanium.UI.ScrollView} Returns a ScrollView 17 | */ 18 | exports.create = function (properties) { 19 | var 20 | /** 21 | * The rows pointer 22 | * @property _rows 23 | * @type Number 24 | */ 25 | _rows = 0, 26 | 27 | /** 28 | * The columns pointer 29 | * @property _columns 30 | * @type Number 31 | */ 32 | _columns = 0, 33 | 34 | /** 35 | * The thumb padding setting 36 | * @property _thumbPadding 37 | * @type Number 38 | */ 39 | _thumbPadding = 5, 40 | 41 | /** 42 | * The row position pointer 43 | * @property _rowPosition 44 | * @type Number 45 | */ 46 | _rowPosition = 2, 47 | 48 | /** 49 | * @property _rowPositionReset 50 | * @type Number 51 | */ 52 | _rowPositionReset = 2, 53 | 54 | /** 55 | * @property _padding 56 | * @type Number 57 | */ 58 | _padding = 5, 59 | 60 | /** 61 | * @property _columnPosition 62 | * @type Number 63 | */ 64 | _columnPosition = 15, 65 | 66 | /** 67 | * @property _images 68 | * @type Array 69 | */ 70 | _images = properties.images, 71 | 72 | /** 73 | * @property _win 74 | * @type Titanium.UI.Window 75 | */ 76 | _win = properties.win, 77 | 78 | /** 79 | * @property _isFullscreen 80 | * @type Boolean 81 | */ 82 | _isFullscreen = false, 83 | 84 | /** 85 | * @property _isGesture 86 | * @type Boolean 87 | */ 88 | _isGesture = true, 89 | 90 | /** 91 | * @property _viewArray 92 | * @type Array 93 | */ 94 | _viewArray = [], 95 | 96 | /** 97 | * @property _imageWin 98 | * @type Titanium.UI.Window 99 | */ 100 | _imageWin = null, 101 | 102 | /** 103 | * @property _scrollView 104 | * @type Titanium.UI.ScrollView 105 | */ 106 | _scrollView = null; 107 | 108 | /** 109 | * Add elements to image window 110 | * 111 | * @method _createImageWin 112 | * @param {Number} The image to start with ID 113 | */ 114 | var _createImageWin = function (myID) { 115 | var photosView, 116 | descriptionLabel, 117 | view; 118 | 119 | photosView = Ti.UI.createScrollableView({ 120 | width: 320, 121 | height: 480, 122 | top: 0, 123 | showPagingControl: false, 124 | pagingControlColor: '#fff', 125 | maxZoomScale: 2.0, 126 | currentPage: 0 127 | }); 128 | 129 | descriptionLabel = Ti.UI.createLabel({ 130 | text: _images[myID].caption, 131 | width: 320, 132 | bottom: 45, 133 | height: 'auto', 134 | backgroundColor: '#000', 135 | font: { 136 | fontSize: 12, 137 | fontWeight: 'bold' 138 | }, 139 | color: '#FFF', 140 | zIndex: 2, 141 | opacity: 0.8 142 | }); 143 | 144 | view = Ti.UI.createImageView({ 145 | backgroundColor: '#000', 146 | image: _images[myID].path, 147 | width: 'auto', 148 | height: 350, 149 | top: 0, 150 | canScale: true 151 | }); 152 | 153 | // Add the image view to the window 154 | _imageWin.add(view); 155 | 156 | descriptionLabel.bottom = 0; 157 | 158 | _imageWin.add(descriptionLabel); 159 | }; 160 | 161 | // Create ScrollView 162 | _scrollView = Ti.UI.createScrollView({ 163 | contentWidth: 320, 164 | contentHeight: 'auto', 165 | top: 0, 166 | backgroundColor: '#000', 167 | showVerticalScrollIndicator: true, 168 | showHorizontalScrollIndicator: false 169 | }); 170 | 171 | for (var i = 0, b = _images.length; i < b; i++) { 172 | var _img; 173 | 174 | // Display the thumbs on 4 collumns 175 | if (_columns % 4 === 0 && _rows !== 0) { 176 | _columnPosition += 75 + _thumbPadding; 177 | _rowPosition = _rowPositionReset; 178 | } 179 | 180 | // Create the thumb as a label with a background image 181 | _img = Ti.UI.createLabel({ 182 | backgroundImage: _images[i].path, 183 | width: 75, 184 | height: 75, 185 | myID: i, 186 | left: _rowPosition, 187 | top: _columnPosition 188 | }); 189 | 190 | // Set the thumbs properties 191 | // TODO: Properties should be sent as an option 192 | _img.borderColor = null; 193 | _img.borderWidth = 0; 194 | _img.backgroundPaddingLeft = 0; 195 | _img.backgroundPaddingRight = 0; 196 | _img.backgroundPaddingTop = 0; 197 | _img.backgroundPaddingBottom = 0; 198 | _img.backgroundLeftCap = 0; 199 | _img.backgroundTopCap = 0; 200 | 201 | // Attach click listener to each thumb 202 | _img.addEventListener('click', function (e) { 203 | // Create a new window and show the image selected 204 | _imageWin = Ti.UI.createWindow({ 205 | backgroundColor: '#000', 206 | title: e.source.myID + 1 + ' of ' + _images.length 207 | }); 208 | 209 | // Add elements to the window 210 | _createImageWin(e.source.myID); 211 | 212 | // Push the window in the tabbar controller 213 | Ti.UI.currentTab.open(_imageWin); 214 | }); 215 | 216 | // Add thumb to the scrollview 217 | _scrollView.add(_img); 218 | 219 | // Increment pointers 220 | _columns += 1; 221 | _rows += 1; 222 | _rowPosition += 75 + _padding; 223 | } 224 | 225 | return _scrollView; 226 | }; -------------------------------------------------------------------------------- /Module/android/imagegallery/build.properties: -------------------------------------------------------------------------------- 1 | titanium.platform=/Library/Application Support/Titanium/mobilesdk/osx/1.7.0/android 2 | android.platform=/Users/morion4000/Library/android-sdk-mac_x86/platforms/android-7 3 | google.apis=/Users/morion4000/Library/android-sdk-mac_x86/add-ons/addon_google_apis_google_inc_7 -------------------------------------------------------------------------------- /Module/android/imagegallery/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Ant build script for Titanium Android module imagegallery 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Module/android/imagegallery/dist/imagegallery.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Module/android/imagegallery/dist/imagegallery.jar -------------------------------------------------------------------------------- /Module/android/imagegallery/documentation/index.md: -------------------------------------------------------------------------------- 1 | # imagegallery Module 2 | 3 | ## Description 4 | 5 | Titanium Image Gallery Module 6 | 7 | ## Accessing the imagegallery Module 8 | 9 | To access this module from JavaScript, you would do the following: 10 | 11 | var imageGallery = require("com.codeboxed.imagegallery"); 12 | 13 | The imageGallery variable is a reference to the Module object. 14 | 15 | ## Reference 16 | 17 | ### imageGallery.create 18 | 19 | /** 20 | * Create an image gallery 21 | * 22 | * @method create 23 | * @param properties The object to configure the library 24 | * @param properties.win (optional) The window to attach the image gallery to. 25 | * Only use the Ti.UI.currentWindow for now 26 | * @param properties.images An Array containg the image objects 27 | * @param properties.images[].path The relative path for the image 28 | * @param properties.images[].caption The image caption 29 | * @return {Titanium.UI.ScrollView} Returns a ScrollView 30 | */ 31 | 32 | // Initialize the Image Gallery 33 | var imageGallery = ImageGallery.create({ 34 | images: imagesArray 35 | }); 36 | 37 | ## Usage 38 | 39 | // Import ImageGallery module 40 | var ImageGallery = require('com.codeboxed.imagegallery'); 41 | 42 | var win = Ti.UI.currentWindow; 43 | 44 | // Array with image objects 45 | var imagesArray = [ 46 | {path:'1.jpg', caption:'Kitten 1'}, 47 | {path:'2.jpg', caption:'Kitten 2'} 48 | ]; 49 | 50 | // Initialize the Image Gallery 51 | var imageGallery = ImageGallery.create({ 52 | images: imagesArray 53 | }); 54 | 55 | // Add it to the current window 56 | win.add(imageGallery); 57 | 58 | ## Author 59 | 60 | Codeboxed - 61 | 62 | ## License 63 | 64 | Copyright (c) 2011 Codeboxed 65 | 66 | Permission is hereby granted, free of charge, to any person 67 | obtaining a copy of this software and associated documentation 68 | files (the "Software"), to deal in the Software without 69 | restriction, including without limitation the rights to use, 70 | copy, modify, merge, publish, distribute, sublicense, and/or sell 71 | copies of the Software, and to permit persons to whom the 72 | Software is furnished to do so, subject to the following 73 | conditions: 74 | 75 | The above copyright notice and this permission notice shall be 76 | included in all copies or substantial portions of the Software. 77 | 78 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 79 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 80 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 81 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 82 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 83 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 84 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 85 | OTHER DEALINGS IN THE SOFTWARE. 86 | -------------------------------------------------------------------------------- /Module/android/imagegallery/example/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Module/android/imagegallery/example/1.jpg -------------------------------------------------------------------------------- /Module/android/imagegallery/example/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Module/android/imagegallery/example/2.jpg -------------------------------------------------------------------------------- /Module/android/imagegallery/example/app.js: -------------------------------------------------------------------------------- 1 | // Import ImageGallery module 2 | var ImageGallery = require('com.codeboxed.imagegallery'); 3 | 4 | var win = Ti.UI.createWindow(); 5 | 6 | // Array with image objects 7 | var imagesArray = [ 8 | {path:'1.jpg', caption:'Kitten 1'}, 9 | {path:'2.jpg', caption:'Kitten 2'} 10 | ]; 11 | 12 | // Initialize the Image Gallery 13 | var imageGallery = ImageGallery.create({ 14 | images: imagesArray 15 | }); 16 | 17 | // Add it to the window 18 | win.add(imageGallery); 19 | 20 | win.open(); 21 | -------------------------------------------------------------------------------- /Module/android/imagegallery/hooks/README: -------------------------------------------------------------------------------- 1 | These files are not yet supported as of 1.4.0 but will be in a near future release. 2 | -------------------------------------------------------------------------------- /Module/android/imagegallery/hooks/add.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # This is the module project add hook that will be 4 | # called when your module is added to a project 5 | # 6 | import os, sys 7 | 8 | def dequote(s): 9 | if s[0:1] == '"': 10 | return s[1:-1] 11 | return s 12 | 13 | def main(args,argc): 14 | # You will get the following command line arguments 15 | # in the following order: 16 | # 17 | # project_dir = the full path to the project root directory 18 | # project_type = the type of project (desktop, mobile, ipad) 19 | # project_name = the name of the project 20 | # 21 | project_dir = dequote(os.path.expanduser(args[1])) 22 | project_type = dequote(args[2]) 23 | project_name = dequote(args[3]) 24 | 25 | # TODO: write your add hook here (optional) 26 | 27 | 28 | # exit 29 | sys.exit(0) 30 | 31 | 32 | 33 | if __name__ == '__main__': 34 | main(sys.argv,len(sys.argv)) 35 | 36 | -------------------------------------------------------------------------------- /Module/android/imagegallery/hooks/install.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # This is the module install hook that will be 4 | # called when your module is first installed 5 | # 6 | import os, sys 7 | 8 | def main(args,argc): 9 | 10 | # TODO: write your install hook here (optional) 11 | 12 | # exit 13 | sys.exit(0) 14 | 15 | 16 | 17 | if __name__ == '__main__': 18 | main(sys.argv,len(sys.argv)) 19 | 20 | -------------------------------------------------------------------------------- /Module/android/imagegallery/hooks/remove.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # This is the module project remove hook that will be 4 | # called when your module is remove from a project 5 | # 6 | import os, sys 7 | 8 | def dequote(s): 9 | if s[0:1] == '"': 10 | return s[1:-1] 11 | return s 12 | 13 | def main(args,argc): 14 | # You will get the following command line arguments 15 | # in the following order: 16 | # 17 | # project_dir = the full path to the project root directory 18 | # project_type = the type of project (desktop, mobile, ipad) 19 | # project_name = the name of the project 20 | # 21 | project_dir = dequote(os.path.expanduser(args[1])) 22 | project_type = dequote(args[2]) 23 | project_name = dequote(args[3]) 24 | 25 | # TODO: write your remove hook here (optional) 26 | 27 | # exit 28 | sys.exit(0) 29 | 30 | 31 | 32 | if __name__ == '__main__': 33 | main(sys.argv,len(sys.argv)) 34 | 35 | -------------------------------------------------------------------------------- /Module/android/imagegallery/hooks/uninstall.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # This is the module uninstall hook that will be 4 | # called when your module is uninstalled 5 | # 6 | import os, sys 7 | 8 | def main(args,argc): 9 | 10 | # TODO: write your uninstall hook here (optional) 11 | 12 | # exit 13 | sys.exit(0) 14 | 15 | 16 | if __name__ == '__main__': 17 | main(sys.argv,len(sys.argv)) 18 | 19 | -------------------------------------------------------------------------------- /Module/android/imagegallery/manifest: -------------------------------------------------------------------------------- 1 | # 2 | # this is your module manifest and used by Titanium 3 | # during compilation, packaging, distribution, etc. 4 | # 5 | version: 0.1 6 | description: My module 7 | author: Your Name 8 | license: Specify your license 9 | copyright: Copyright (c) 2011 by Your Company 10 | 11 | 12 | # these should not be edited 13 | name: imagegallery 14 | moduleid: com.codeboxed.imagegallery 15 | guid: 2d947738-857a-4052-ad58-c6d30ab8242a 16 | platform: android 17 | minsdk: 1.7.0 18 | -------------------------------------------------------------------------------- /Module/android/imagegallery/platform/README: -------------------------------------------------------------------------------- 1 | You can place platform-specific files here in sub-folders named "android" and/or "iphone", just as you can with normal Titanium Mobile SDK projects. Any folders and files you place here will be merged with the platform-specific files in a Titanium Mobile project that uses this module. 2 | 3 | When a Titanium Mobile project that uses this module is built, the files from this platform/ folder will be treated the same as files (if any) from the Titanium Mobile project's platform/ folder. 4 | -------------------------------------------------------------------------------- /Module/android/imagegallery/src/com/codeboxed/imagegallery/ExampleProxy.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by the Titanium Module SDK helper for Android 3 | * Appcelerator Titanium Mobile 4 | * Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved. 5 | * Licensed under the terms of the Apache Public License 6 | * Please see the LICENSE included with this distribution for details. 7 | * 8 | */ 9 | package com.codeboxed.imagegallery; 10 | 11 | import org.appcelerator.kroll.KrollDict; 12 | import org.appcelerator.kroll.KrollProxy; 13 | import org.appcelerator.kroll.annotations.Kroll; 14 | 15 | import org.appcelerator.titanium.TiContext; 16 | import org.appcelerator.titanium.util.Log; 17 | import org.appcelerator.titanium.util.TiConfig; 18 | 19 | // This proxy can be created by calling Imagegallery.createExample({message: "hello world"}) 20 | @Kroll.proxy(creatableInModule=ImagegalleryModule.class) 21 | public class ExampleProxy extends KrollProxy 22 | { 23 | // Standard Debugging variables 24 | private static final String LCAT = "ExampleProxy"; 25 | private static final boolean DBG = TiConfig.LOGD; 26 | 27 | // Constructor 28 | public ExampleProxy(TiContext tiContext) { 29 | super(tiContext); 30 | } 31 | 32 | // Handle creation options 33 | @Override 34 | public void handleCreationDict(KrollDict options) { 35 | super.handleCreationDict(options); 36 | 37 | if (options.containsKey("message")) { 38 | Log.d(LCAT, "example created with message: " + options.get("message")); 39 | } 40 | } 41 | 42 | // Methods 43 | @Kroll.method 44 | public void printMessage(String message) { 45 | Log.d(LCAT, "printing message: " + message); 46 | } 47 | } -------------------------------------------------------------------------------- /Module/android/imagegallery/src/com/codeboxed/imagegallery/ImagegalleryModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by the Titanium Module SDK helper for Android 3 | * Appcelerator Titanium Mobile 4 | * Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved. 5 | * Licensed under the terms of the Apache Public License 6 | * Please see the LICENSE included with this distribution for details. 7 | * 8 | */ 9 | package com.codeboxed.imagegallery; 10 | 11 | import org.appcelerator.kroll.KrollModule; 12 | import org.appcelerator.kroll.annotations.Kroll; 13 | 14 | import org.appcelerator.titanium.TiContext; 15 | import org.appcelerator.titanium.util.Log; 16 | import org.appcelerator.titanium.util.TiConfig; 17 | 18 | @Kroll.module(name="Imagegallery", id="com.codeboxed.imagegallery") 19 | public class ImagegalleryModule extends KrollModule 20 | { 21 | 22 | // Standard Debugging variables 23 | private static final String LCAT = "ImagegalleryModule"; 24 | private static final boolean DBG = TiConfig.LOGD; 25 | 26 | // You can define constants with @Kroll.constant, for example: 27 | // @Kroll.constant public static final String EXTERNAL_NAME = value; 28 | 29 | public ImagegalleryModule(TiContext tiContext) { 30 | super(tiContext); 31 | } 32 | 33 | // Methods 34 | @Kroll.method 35 | public String example() { 36 | Log.d(LCAT, "example called"); 37 | return "hello world"; 38 | } 39 | 40 | // Properties 41 | @Kroll.getProperty 42 | public String getExampleProp() { 43 | Log.d(LCAT, "get example property"); 44 | return "hello world"; 45 | } 46 | 47 | 48 | @Kroll.setProperty 49 | public void setExampleProp(String value) { 50 | Log.d(LCAT, "set example property: " + value); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Module/android/imagegallery/timodule.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/.gitignore: -------------------------------------------------------------------------------- 1 | tmp 2 | bin 3 | build 4 | *.zip 5 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/Classes/.gitignore: -------------------------------------------------------------------------------- 1 | ComCodeboxedImagegallery.h 2 | ComCodeboxedImagegallery.m 3 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/Classes/ComCodeboxedImagegalleryModule.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Your Copyright Here 3 | * 4 | * Appcelerator Titanium is Copyright (c) 2009-2010 by Appcelerator, Inc. 5 | * and licensed under the Apache Public License (version 2) 6 | */ 7 | #import "TiModule.h" 8 | 9 | @interface ComCodeboxedImagegalleryModule : TiModule 10 | { 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/Classes/ComCodeboxedImagegalleryModule.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Your Copyright Here 3 | * 4 | * Appcelerator Titanium is Copyright (c) 2009-2010 by Appcelerator, Inc. 5 | * and licensed under the Apache Public License (version 2) 6 | */ 7 | #import "ComCodeboxedImagegalleryModule.h" 8 | #import "TiBase.h" 9 | #import "TiHost.h" 10 | #import "TiUtils.h" 11 | 12 | @implementation ComCodeboxedImagegalleryModule 13 | 14 | #pragma mark Internal 15 | 16 | // this is generated for your module, please do not change it 17 | -(id)moduleGUID 18 | { 19 | return @"763f9e7d-ccdc-4791-9c98-35e4b86e1d3c"; 20 | } 21 | 22 | // this is generated for your module, please do not change it 23 | -(NSString*)moduleId 24 | { 25 | return @"com.codeboxed.imagegallery"; 26 | } 27 | 28 | #pragma mark Lifecycle 29 | 30 | -(void)startup 31 | { 32 | // this method is called when the module is first loaded 33 | // you *must* call the superclass 34 | [super startup]; 35 | 36 | NSLog(@"[INFO] %@ loaded",self); 37 | } 38 | 39 | -(void)shutdown:(id)sender 40 | { 41 | // this method is called when the module is being unloaded 42 | // typically this is during shutdown. make sure you don't do too 43 | // much processing here or the app will be quit forceably 44 | 45 | // you *must* call the superclass 46 | [super shutdown:sender]; 47 | } 48 | 49 | #pragma mark Cleanup 50 | 51 | -(void)dealloc 52 | { 53 | // release any resources that have been retained by the module 54 | [super dealloc]; 55 | } 56 | 57 | #pragma mark Internal Memory Management 58 | 59 | -(void)didReceiveMemoryWarning:(NSNotification*)notification 60 | { 61 | // optionally release any resources that can be dynamically 62 | // reloaded once memory is available - such as caches 63 | [super didReceiveMemoryWarning:notification]; 64 | } 65 | 66 | #pragma mark Listener Notifications 67 | 68 | -(void)_listenerAdded:(NSString *)type count:(int)count 69 | { 70 | if (count == 1 && [type isEqualToString:@"my_event"]) 71 | { 72 | // the first (of potentially many) listener is being added 73 | // for event named 'my_event' 74 | } 75 | } 76 | 77 | -(void)_listenerRemoved:(NSString *)type count:(int)count 78 | { 79 | if (count == 0 && [type isEqualToString:@"my_event"]) 80 | { 81 | // the last listener called for event named 'my_event' has 82 | // been removed, we can optionally clean up any resources 83 | // since no body is listening at this point for that event 84 | } 85 | } 86 | 87 | #pragma Public APIs 88 | 89 | -(id)example:(id)args 90 | { 91 | // example method 92 | return @"hello world"; 93 | } 94 | 95 | -(id)exampleProp 96 | { 97 | // example property getter 98 | return @"hello world"; 99 | } 100 | 101 | -(void)exampleProp:(id)value 102 | { 103 | // example property setter 104 | } 105 | 106 | @end 107 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/Classes/ComCodeboxedImagegalleryModuleAssets.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This is a generated file. Do not edit or your changes will be lost 3 | */ 4 | 5 | @interface ComCodeboxedImagegalleryModuleAssets : NSObject 6 | { 7 | } 8 | - (NSData*) moduleAsset; 9 | @end 10 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/Classes/ComCodeboxedImagegalleryModuleAssets.m: -------------------------------------------------------------------------------- 1 | /** 2 | * This is a generated file. Do not edit or your changes will be lost 3 | */ 4 | #import "ComCodeboxedImagegalleryModuleAssets.h" 5 | 6 | extern NSData * dataWithHexString (NSString * hexString); 7 | 8 | @implementation ComCodeboxedImagegalleryModuleAssets 9 | 10 | - (NSData*) moduleAsset 11 | { 12 | return dataWithHexString(@"6578706f7274732e6372656174653d66756e6374696f6e2870726f70657274696573297b7661720a5f726f77733d302c5f636f6c756d6e733d302c5f726f77506f736974696f6e3d322c5f726f77506f736974696f6e52657365743d322c5f636f6c756d6e506f736974696f6e3d31352c5f696d616765733d70726f706572746965732e696d616765732c5f77696e3d70726f706572746965732e77696e2c5f6e6f436f6c756d6e733d70726f706572746965732e636f6c756d6e737c7c342c5f7468756d6253697a653d70726f706572746965732e7468756d6253697a657c7c37352c5f7468756d6250616464696e673d70726f706572746965732e7468756d6250616464696e677c7c352c5f697346756c6c73637265656e3d66616c73652c5f6973476573747572653d747275652c5f7669657741727261793d5b5d2c5f696d61676557696e3d6e756c6c2c5f7363726f6c6c566965773d6e756c6c3b766172205f67657444657669636546616d696c793d66756e6374696f6e28297b766172206465766963654e616d653d6e756c6c3b7377697463682854692e506c6174666f726d2e6e616d65297b6361736527616e64726f6964273a6465766963654e616d653d27616e64726f6964273b627265616b3b63617365276950686f6e65204f53273a69662854692e506c6174666f726d2e646973706c6179436170732e6470693d3d3d313330297b6465766963654e616d653d2769706164273b7d656c73657b6465766963654e616d653d276970686f6e65273b7d0a627265616b3b7d0a72657475726e206465766963654e616d653b7d3b766172205f637265617465496d61676557696e3d66756e6374696f6e286d794944297b7661722070686f746f73566965772c6465736372697074696f6e4c6162656c2c766965772c666c657853706163652c6c656674427574746f6e2c7269676874427574746f6e2c746f6f6c6261723b70686f746f73566965773d54692e55492e6372656174655363726f6c6c61626c6556696577287b77696474683a2731303025272c6865696768743a2731303025272c746f703a302c73686f77506167696e67436f6e74726f6c3a66616c73652c706167696e67436f6e74726f6c436f6c6f723a2723666666272c6d61785a6f6f6d5363616c653a322e302c63757272656e74506167653a307d293b6465736372697074696f6e4c6162656c3d54692e55492e6372656174654c6162656c287b746578743a5f696d616765735b6d7949445d2e63617074696f6e2c77696474683a2731303025272c626f74746f6d3a34352c6865696768743a276175746f272c6261636b67726f756e64436f6c6f723a2723303030272c666f6e743a7b666f6e7453697a653a31342c666f6e745765696768743a27626f6c64277d2c636f6c6f723a2723464646272c7a496e6465783a322c6f7061636974793a302e387d293b666f722876617220693d302c623d5f696d616765732e6c656e6774683b693c623b692b2b297b766965773d54692e55492e637265617465496d61676556696577287b6261636b67726f756e64436f6c6f723a2723303030272c696d6167653a5f696d616765735b695d2e706174682c77696474683a2731303025272c6865696768743a2731303025272c746f703a2d35307d293b5f7669657741727261795b695d3d766965773b7d0a70686f746f73566965772e76696577733d5f7669657741727261793b70686f746f73566965772e63757272656e74506167653d6d7949443b5f696d61676557696e2e6164642870686f746f7356696577293b5f696d61676557696e2e6869646554616242617228293b666c657853706163653d54692e55492e637265617465427574746f6e287b73797374656d427574746f6e3a54692e55492e6950686f6e652e53797374656d427574746f6e2e464c455849424c455f53504143457d293b6c656674427574746f6e3d54692e55492e637265617465427574746f6e287b73797374656d427574746f6e3a54692e55492e6950686f6e652e53797374656d427574746f6e2e524557494e447d293b6c656674427574746f6e2e6164644576656e744c697374656e65722827636c69636b272c66756e6374696f6e28297b76617220696e6465783d2870686f746f73566965772e63757272656e74506167652d313c30293f303a70686f746f73566965772e63757272656e74506167652d313b76617220766965773d70686f746f73566965772e76696577735b696e6465785d3b5f6973476573747572653d66616c73653b70686f746f73566965772e7363726f6c6c546f566965772876696577293b7d293b7269676874427574746f6e3d54692e55492e637265617465427574746f6e287b73797374656d427574746f6e3a54692e55492e6950686f6e652e53797374656d427574746f6e2e464153545f464f52574152447d293b7269676874427574746f6e2e6164644576656e744c697374656e65722827636c69636b272c66756e6374696f6e28297b76617220696e6465783d2870686f746f73566965772e63757272656e74506167652b313e3d70686f746f73566965772e76696577732e6c656e677468293f70686f746f73566965772e63757272656e74506167653a70686f746f73566965772e63757272656e74506167652b313b76617220766965773d70686f746f73566965772e76696577735b696e6465785d3b5f6973476573747572653d66616c73653b70686f746f73566965772e7363726f6c6c546f566965772876696577293b7d293b746f6f6c6261723d54692e55492e637265617465546f6f6c626172287b6974656d733a5b666c657853706163652c6c656674427574746f6e2c666c657853706163652c7269676874427574746f6e2c666c657853706163655d2c626f74746f6d3a302c626f72646572546f703a747275652c626f72646572426f74746f6d3a747275652c626172436f6c6f723a2723303030277d293b5f696d61676557696e2e61646428746f6f6c626172293b70686f746f73566965772e6164644576656e744c697374656e6572282773696e676c65746170272c66756e6374696f6e28297b6966285f697346756c6c73637265656e297b54692e55492e6950686f6e652e73686f7753746174757342617228293b5f696d61676557696e2e73686f774e617642617228293b746f6f6c6261722e73686f7728293b6465736372697074696f6e4c6162656c2e73686f7728293b7d656c73657b54692e55492e6950686f6e652e6869646553746174757342617228293b5f696d61676557696e2e686964654e617642617228293b746f6f6c6261722e6869646528293b6465736372697074696f6e4c6162656c2e6869646528293b7d0a5f697346756c6c73637265656e3d215f697346756c6c73637265656e3b7d293b70686f746f73566965772e6164644576656e744c697374656e657228277363726f6c6c272c66756e6374696f6e2865297b6966285f697347657374757265297b54692e55492e6950686f6e652e6869646553746174757342617228293b5f696d61676557696e2e686964654e617642617228293b746f6f6c6261722e6869646528293b6465736372697074696f6e4c6162656c2e6869646528293b5f697346756c6c73637265656e3d747275653b7d656c73657b5f6973476573747572653d747275653b7d0a6465736372697074696f6e4c6162656c2e746578743d5f696d616765735b652e63757272656e74506167655d2e63617074696f6e3b5f696d61676557696e2e7469746c653d652e63757272656e74506167652b312b27206f6620272b5f696d616765732e6c656e6774683b7d293b5f696d61676557696e2e616464286465736372697074696f6e4c6162656c293b7d3b6966285f67657444657669636546616d696c7928293d3d3d276970616427297b69662870726f706572746965732e726f77733d3d3d756e646566696e6564297b5f6e6f436f6c756d6e733d393b7d0a69662870726f706572746965732e7468756d6250616464696e673d3d3d756e646566696e6564297b5f7468756d6250616464696e673d31303b7d7d0a5f7363726f6c6c566965773d54692e55492e6372656174655363726f6c6c56696577287b636f6e74656e7457696474683a2731303025272c636f6e74656e744865696768743a276175746f272c746f703a302c6261636b67726f756e64436f6c6f723a2723303030272c73686f77566572746963616c5363726f6c6c496e64696361746f723a747275652c73686f77486f72697a6f6e74616c5363726f6c6c496e64696361746f723a66616c73657d293b666f722876617220693d302c623d5f696d616765732e6c656e6774683b693c623b692b2b297b766172205f696d673b6966285f636f6c756d6e73255f6e6f436f6c756d6e733d3d3d3026265f726f7773213d3d30297b5f636f6c756d6e506f736974696f6e2b3d5f7468756d6253697a652b5f7468756d6250616464696e673b5f726f77506f736974696f6e3d5f726f77506f736974696f6e52657365743b7d0a5f696d673d54692e55492e6372656174654c6162656c287b6261636b67726f756e64496d6167653a5f696d616765735b695d2e706174682c77696474683a5f7468756d6253697a652c6865696768743a5f7468756d6253697a652c6d7949443a692c6c6566743a5f726f77506f736974696f6e2c746f703a5f636f6c756d6e506f736974696f6e7d293b5f696d672e626f72646572436f6c6f723d6e756c6c3b5f696d672e626f7264657257696474683d303b5f696d672e6261636b67726f756e6450616464696e674c6566743d303b5f696d672e6261636b67726f756e6450616464696e6752696768743d303b5f696d672e6261636b67726f756e6450616464696e67546f703d303b5f696d672e6261636b67726f756e6450616464696e67426f74746f6d3d303b5f696d672e6261636b67726f756e644c6566744361703d303b5f696d672e6261636b67726f756e64546f704361703d303b5f696d672e6164644576656e744c697374656e65722827636c69636b272c66756e6374696f6e2865297b5f696d61676557696e3d54692e55492e63726561746557696e646f77287b6261636b67726f756e64436f6c6f723a2723303030272c7469746c653a652e736f757263652e6d7949442b312b27206f6620272b5f696d616765732e6c656e6774687d293b5f637265617465496d61676557696e28652e736f757263652e6d794944293b54692e55492e63757272656e745461622e6f70656e285f696d61676557696e293b7d293b5f7363726f6c6c566965772e616464285f696d67293b5f636f6c756d6e732b3d313b5f726f77732b3d313b5f726f77506f736974696f6e2b3d5f7468756d6253697a652b5f7468756d6250616464696e673b7d0a72657475726e205f7363726f6c6c566965773b7d3b"); 13 | } 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/ComCodeboxedImagegallery_Prefix.pch: -------------------------------------------------------------------------------- 1 | 2 | #ifdef __OBJC__ 3 | #import 4 | #endif 5 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Codeboxed 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Module/ios/imagegallery/README: -------------------------------------------------------------------------------- 1 | Appcelerator Titanium iPhone Module Project 2 | =========================================== 3 | 4 | This is a skeleton Titanium Mobile iPhone module project. Modules can be 5 | used to extend the functionality of Titanium by providing additional native 6 | code that is compiled into your application at build time and can expose certain 7 | APIs into JavaScript. 8 | 9 | MODULE NAMING 10 | -------------- 11 | 12 | Choose a unique module id for your module. This ID usually follows a namespace 13 | convention using DNS notation. For example, com.appcelerator.module.test. This 14 | ID can only be used once by all public modules in Titanium. 15 | 16 | 17 | COMPONENTS 18 | ----------- 19 | 20 | Components that are exposed by your module must follow a special naming convention. 21 | A component (widget, proxy, etc) must be named with the pattern: 22 | 23 | TiProxy 24 | 25 | For example, if you component was called Foo, your proxy would be named: 26 | 27 | TiMyfirstFooProxy 28 | 29 | For view proxies or widgets, you must create both a view proxy and a view implementation. 30 | If you widget was named proxy, you would create the following files: 31 | 32 | TiMyfirstFooProxy.h 33 | TiMyfirstFooProxy.m 34 | TiMyfirstFoo.h 35 | TiMyfirstFoo.m 36 | 37 | The view implementation is named the same except it does contain the suffix `Proxy`. 38 | 39 | View implementations extend the Titanium base class `TiUIView`. View Proxies extend the 40 | Titanium base class `TiUIViewProxy` or `TiUIWidgetProxy`. 41 | 42 | For proxies that are simply native objects that can be returned to JavaScript, you can 43 | simply extend `TiProxy` and no view implementation is required. 44 | 45 | 46 | GET STARTED 47 | ------------ 48 | 49 | 1. Edit manifest with the appropriate details about your module. 50 | 2. Edit LICENSE to add your license details. 51 | 3. Place any assets (such as PNG files) that are required in the assets folder. 52 | 4. Edit the titanium.xcconfig and make sure you're building for the right Titanium version. 53 | 5. Code and build. 54 | 55 | BUILD TIME COMPILER CONFIG 56 | -------------------------- 57 | 58 | You can edit the file `module.xcconfig` to include any build time settings that should be 59 | set during application compilation that your module requires. This file will automatically get `#include` in the main application project. 60 | 61 | For more information about this file, please see the Apple documentation at: 62 | 63 | 64 | 65 | 66 | DOCUMENTATION FOR YOUR MODULE 67 | ----------------------------- 68 | 69 | You should provide at least minimal documentation for your module in `documentation` folder using the Markdown syntax. 70 | 71 | For more information on the Markdown syntax, refer to this documentation at: 72 | 73 | 74 | 75 | 76 | TEST HARNESS EXAMPLE FOR YOUR MODULE 77 | ------------------------------------ 78 | 79 | The `example` directory contains a skeleton application test harness that can be 80 | used for testing and providing an example of usage to the users of your module. 81 | 82 | 83 | INSTALL YOUR MODULE 84 | -------------------- 85 | 86 | 1. Run `build.py` which creates your distribution 87 | 2. cd to `/Library/Application Support/Titanium` 88 | 3. copy this zip file into the folder of your Titanium SDK 89 | 90 | REGISTER YOUR MODULE 91 | --------------------- 92 | 93 | Register your module with your application by editing `tiapp.xml` and adding your module. 94 | Example: 95 | 96 | 97 | com.codeboxed.imagegallery 98 | 99 | 100 | When you run your project, the compiler will know automatically compile in your module 101 | dependencies and copy appropriate image assets into the application. 102 | 103 | USING YOUR MODULE IN CODE 104 | ------------------------- 105 | 106 | To use your module in code, you will need to require it. 107 | 108 | For example, 109 | 110 | var my_module = require('com.codeboxed.imagegallery'); 111 | my_module.foo(); 112 | 113 | WRITING PURE JS NATIVE MODULES 114 | ------------------------------ 115 | 116 | You can write a pure JavaScript "natively compiled" module. This is nice if you 117 | want to distribute a JS module pre-compiled. 118 | 119 | To create a module, create a file named com.codeboxed.imagegallery.js under the assets folder. 120 | This file must be in the Common JS format. For example: 121 | 122 | exports.echo = function(s) 123 | { 124 | return s; 125 | }; 126 | 127 | Any functions and properties that are exported will be made available as part of your 128 | module. All other code inside your JS will be private to your module. 129 | 130 | For pure JS module, you don't need to modify any of the Objective-C module code. You 131 | can leave it as-is and build. 132 | 133 | TESTING YOUR MODULE 134 | ------------------- 135 | 136 | Run the `titanium.py` script to test your module or test from within XCode. 137 | To test with the script, execute: 138 | 139 | titanium run --dir=YOURMODULEDIR 140 | 141 | 142 | This will execute the app.js in the example folder as a Titanium application. 143 | 144 | 145 | DISTRIBUTING YOUR MODULE 146 | ------------------------- 147 | 148 | Currently, you will need to manually distribution your module distribution zip file directly. However, in the near future, we will make module distribution and sharing built-in to Titanium Developer and in the Titanium Marketplace! 149 | 150 | 151 | Cheers! 152 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/assets/README: -------------------------------------------------------------------------------- 1 | Place your assets like PNG files in this directory and they will be packaged with your module. 2 | 3 | If you create a file named com.codeboxed.imagegallery.js in this directory, it will be 4 | compiled and used as your module. This allows you to run pure Javascript 5 | modules that are pre-compiled. 6 | 7 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/assets/com.codeboxed.imagegallery.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Titanium-Image-Gallery 3 | * Created by Codeboxed on 2011-07-03. 4 | */ 5 | 6 | /** 7 | * Create an image gallery 8 | * 9 | * @method create 10 | * @param properties The object to configure the library 11 | * @param properties.win (optional) The window to attach the image gallery to. 12 | * Only use the Ti.UI.currentWindow for now 13 | * @param properties.images An Array containg the image objects 14 | * @param properties.images[].path The relative path for the image 15 | * @param properties.images[].caption The image caption 16 | * @param properties.rows (optional) Number of rows 17 | * @param properties.thumbSize (optional) The square thumbnail size 18 | * @param properties.thumbPadding (optional) The square padding 19 | * @return {Titanium.UI.ScrollView} Returns a ScrollView 20 | */ 21 | exports.create = function (properties) { 22 | var 23 | /** 24 | * The rows pointer 25 | * @property _rows 26 | * @type Number 27 | */ 28 | _rows = 0, 29 | 30 | /** 31 | * The columns pointer 32 | * @property _columns 33 | * @type Number 34 | */ 35 | _columns = 0, 36 | 37 | /** 38 | * The row position pointer 39 | * @property _rowPosition 40 | * @type Number 41 | */ 42 | _rowPosition = 2, 43 | 44 | /** 45 | * @property _rowPositionReset 46 | * @type Number 47 | */ 48 | _rowPositionReset = 2, 49 | 50 | /** 51 | * @property _columnPosition 52 | * @type Number 53 | */ 54 | _columnPosition = 15, 55 | 56 | /** 57 | * @property _images 58 | * @type Array 59 | */ 60 | _images = properties.images, 61 | 62 | /** 63 | * @property _win 64 | * @type Titanium.UI.Window 65 | */ 66 | _win = properties.win, 67 | 68 | /** 69 | * @property _noColumns 70 | * @type Number 71 | */ 72 | _noColumns = properties.columns || 4, 73 | 74 | /** 75 | * The thumb size property 76 | * @property _thumbSize 77 | * @type Number 78 | */ 79 | _thumbSize = properties.thumbSize || 75, 80 | 81 | /** 82 | * The thumb padding property 83 | * @property _thumbPadding 84 | * @type Number 85 | */ 86 | _thumbPadding = properties.thumbPadding || 5, 87 | 88 | /** 89 | * @property _isFullscreen 90 | * @type Boolean 91 | */ 92 | _isFullscreen = false, 93 | 94 | /** 95 | * @property _isGesture 96 | * @type Boolean 97 | */ 98 | _isGesture = true, 99 | 100 | /** 101 | * @property _viewArray 102 | * @type Array 103 | */ 104 | _viewArray = [], 105 | 106 | /** 107 | * @property _imageWin 108 | * @type Titanium.UI.Window 109 | */ 110 | _imageWin = null, 111 | 112 | /** 113 | * @property _scrollView 114 | * @type Titanium.UI.ScrollView 115 | */ 116 | _scrollView = null; 117 | 118 | /** 119 | * Return the device family 120 | * 121 | * @method _getDeviceFamily 122 | * @return {String} The device family 123 | */ 124 | var _getDeviceFamily = function () { 125 | var deviceName = null; 126 | 127 | switch (Ti.Platform.name) { 128 | case 'android': 129 | deviceName = 'android'; 130 | break; 131 | 132 | case 'iPhone OS': 133 | if (Ti.Platform.displayCaps.dpi === 130) { 134 | deviceName = 'ipad'; 135 | } else { 136 | deviceName = 'iphone'; 137 | } 138 | break; 139 | } 140 | 141 | return deviceName; 142 | }; 143 | 144 | /** 145 | * Add elements to image window 146 | * 147 | * @method _createImageWin 148 | * @param {Number} The image to start with ID 149 | */ 150 | var _createImageWin = function (myID) { 151 | var photosView, 152 | descriptionLabel, 153 | view, 154 | flexSpace, 155 | leftButton, 156 | rightButton, 157 | toolbar; 158 | 159 | photosView = Ti.UI.createScrollableView({ 160 | width: '100%', 161 | height: '100%', 162 | top: 0, 163 | showPagingControl: false, 164 | pagingControlColor: '#fff', 165 | maxZoomScale: 2.0, 166 | currentPage: 0 167 | }); 168 | 169 | descriptionLabel = Ti.UI.createLabel({ 170 | text: _images[myID].caption, 171 | width: '100%', 172 | bottom: 45, 173 | height: 'auto', 174 | backgroundColor: '#000', 175 | font: { 176 | fontSize: 14, 177 | fontWeight: 'bold' 178 | }, 179 | color: '#FFF', 180 | zIndex: 2, 181 | opacity: 0.8 182 | }); 183 | 184 | for (var i = 0, b = _images.length; i < b; i++) { 185 | view = Ti.UI.createImageView({ 186 | backgroundColor: '#000', 187 | image: _images[i].path, 188 | width: '100%', 189 | height: '100%', 190 | top: -50 191 | }); 192 | 193 | _viewArray[i] = view; 194 | } 195 | 196 | photosView.views = _viewArray; 197 | photosView.currentPage = myID; 198 | 199 | _imageWin.add(photosView); 200 | 201 | _imageWin.hideTabBar(); 202 | 203 | flexSpace = Ti.UI.createButton({ 204 | systemButton: Ti.UI.iPhone.SystemButton.FLEXIBLE_SPACE 205 | }); 206 | 207 | leftButton = Ti.UI.createButton({ 208 | // TODO: Allow to pass the leftButton image as an option 209 | systemButton: Ti.UI.iPhone.SystemButton.REWIND 210 | }); 211 | 212 | leftButton.addEventListener('click', function() { 213 | // Defined the boundries 214 | var index = (photosView.currentPage - 1 < 0) ? 0: photosView.currentPage - 1; 215 | var view = photosView.views[index]; 216 | 217 | _isGesture = false; 218 | 219 | photosView.scrollToView(view); 220 | }); 221 | 222 | rightButton = Ti.UI.createButton({ 223 | // TODO: Allow to pass the rightButton image as an option 224 | systemButton: Ti.UI.iPhone.SystemButton.FAST_FORWARD 225 | }); 226 | 227 | rightButton.addEventListener('click', function() { 228 | // Defined the boundries 229 | var index = (photosView.currentPage + 1 >= photosView.views.length) ? photosView.currentPage: photosView.currentPage + 1; 230 | var view = photosView.views[index]; 231 | 232 | _isGesture = false; 233 | 234 | photosView.scrollToView(view); 235 | }); 236 | 237 | toolbar = Ti.UI.createToolbar({ 238 | items: [flexSpace, leftButton, flexSpace, rightButton, flexSpace], 239 | bottom: 0, 240 | borderTop: true, 241 | borderBottom: true, 242 | barColor: '#000' 243 | }); 244 | 245 | _imageWin.add(toolbar); 246 | 247 | photosView.addEventListener('singletap', function() { 248 | // If the view is fullscreen the exit fullscreen 249 | // else go fullscreen 250 | if (_isFullscreen) { 251 | // Exit fullscreen 252 | Ti.UI.iPhone.showStatusBar(); 253 | _imageWin.showNavBar(); 254 | toolbar.show(); 255 | descriptionLabel.show(); 256 | } else { 257 | // Go fullscreen 258 | Ti.UI.iPhone.hideStatusBar(); 259 | _imageWin.hideNavBar(); 260 | toolbar.hide(); 261 | descriptionLabel.hide(); 262 | } 263 | 264 | _isFullscreen = !_isFullscreen; 265 | }); 266 | 267 | photosView.addEventListener('scroll', function(e) { 268 | if (_isGesture) { 269 | Ti.UI.iPhone.hideStatusBar(); 270 | _imageWin.hideNavBar(); 271 | toolbar.hide(); 272 | descriptionLabel.hide(); 273 | 274 | _isFullscreen = true; 275 | } else { 276 | _isGesture = true; 277 | } 278 | 279 | descriptionLabel.text = _images[e.currentPage].caption; 280 | 281 | _imageWin.title = e.currentPage + 1 + ' of ' + _images.length; 282 | }); 283 | 284 | _imageWin.add(descriptionLabel); 285 | }; 286 | 287 | // Overwrite the default properties for iPad (if no defined by user) 288 | if (_getDeviceFamily() === 'ipad') { 289 | if (properties.rows === undefined) { 290 | _noColumns = 9; 291 | } 292 | 293 | if (properties.thumbPadding === undefined) { 294 | _thumbPadding = 10; 295 | } 296 | } 297 | 298 | // Create ScrollView 299 | _scrollView = Ti.UI.createScrollView({ 300 | contentWidth: '100%', 301 | contentHeight: 'auto', 302 | top: 0, 303 | backgroundColor: '#000', 304 | showVerticalScrollIndicator: true, 305 | showHorizontalScrollIndicator: false 306 | }); 307 | 308 | for (var i = 0, b = _images.length; i < b; i++) { 309 | var _img; 310 | 311 | // Display the thumbs on 4 collumns 312 | if (_columns % _noColumns === 0 && _rows !== 0) { 313 | _columnPosition += _thumbSize + _thumbPadding; 314 | _rowPosition = _rowPositionReset; 315 | } 316 | 317 | // Create the thumb as a label with a background image 318 | _img = Ti.UI.createLabel({ 319 | backgroundImage: _images[i].path, 320 | width: _thumbSize, 321 | height: _thumbSize, 322 | myID: i, 323 | left: _rowPosition, 324 | top: _columnPosition 325 | }); 326 | 327 | // Set the thumbs properties 328 | // TODO: Properties should be sent as an option 329 | _img.borderColor = null; 330 | _img.borderWidth = 0; 331 | _img.backgroundPaddingLeft = 0; 332 | _img.backgroundPaddingRight = 0; 333 | _img.backgroundPaddingTop = 0; 334 | _img.backgroundPaddingBottom = 0; 335 | _img.backgroundLeftCap = 0; 336 | _img.backgroundTopCap = 0; 337 | 338 | // Attach click listener to each thumb 339 | _img.addEventListener('click', function (e) { 340 | // Create a new window and show the image selected 341 | _imageWin = Ti.UI.createWindow({ 342 | backgroundColor: '#000', 343 | title: e.source.myID + 1 + ' of ' + _images.length 344 | }); 345 | 346 | // Add elements to the window 347 | _createImageWin(e.source.myID); 348 | 349 | // Push the window in the tabbar controller 350 | Ti.UI.currentTab.open(_imageWin); 351 | }); 352 | 353 | // Add thumb to the scrollview 354 | _scrollView.add(_img); 355 | 356 | // Increment pointers 357 | _columns += 1; 358 | _rows += 1; 359 | _rowPosition += _thumbSize + _thumbPadding; 360 | } 361 | 362 | return _scrollView; 363 | }; -------------------------------------------------------------------------------- /Module/ios/imagegallery/build.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Appcelerator Titanium Module Packager 4 | # 5 | # 6 | import os, sys, glob, string 7 | import zipfile 8 | from datetime import date 9 | 10 | cwd = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename)) 11 | os.chdir(cwd) 12 | required_module_keys = ['name','version','moduleid','description','copyright','license','copyright','platform','minsdk'] 13 | module_defaults = { 14 | 'description':'My module', 15 | 'author': 'Your Name', 16 | 'license' : 'Specify your license', 17 | 'copyright' : 'Copyright (c) %s by Your Company' % str(date.today().year), 18 | } 19 | module_license_default = "TODO: place your license here and we'll include it in the module distribution" 20 | 21 | def replace_vars(config,token): 22 | idx = token.find('$(') 23 | while idx != -1: 24 | idx2 = token.find(')',idx+2) 25 | if idx2 == -1: break 26 | key = token[idx+2:idx2] 27 | if not config.has_key(key): break 28 | token = token.replace('$(%s)' % key, config[key]) 29 | idx = token.find('$(') 30 | return token 31 | 32 | 33 | def read_ti_xcconfig(): 34 | contents = open(os.path.join(cwd,'titanium.xcconfig')).read() 35 | config = {} 36 | for line in contents.splitlines(False): 37 | line = line.strip() 38 | if line[0:2]=='//': continue 39 | idx = line.find('=') 40 | if idx > 0: 41 | key = line[0:idx].strip() 42 | value = line[idx+1:].strip() 43 | config[key] = replace_vars(config,value) 44 | return config 45 | 46 | def generate_doc(config): 47 | docdir = os.path.join(cwd,'documentation') 48 | if not os.path.exists(docdir): 49 | print "Couldn't find documentation file at: %s" % docdir 50 | return None 51 | sdk = config['TITANIUM_SDK'] 52 | support_dir = os.path.join(sdk,'module','support') 53 | sys.path.append(support_dir) 54 | import markdown 55 | documentation = [] 56 | for file in os.listdir(docdir): 57 | md = open(os.path.join(docdir,file)).read() 58 | html = markdown.markdown(md) 59 | documentation.append({file:html}); 60 | return documentation 61 | 62 | def compile_js(manifest,config): 63 | js_file = os.path.join(cwd,'assets','com.codeboxed.imagegallery.js') 64 | if not os.path.exists(js_file): return 65 | 66 | sdk = config['TITANIUM_SDK'] 67 | iphone_dir = os.path.join(sdk,'iphone') 68 | sys.path.insert(0,iphone_dir) 69 | from compiler import Compiler 70 | 71 | path = os.path.basename(js_file) 72 | metadata = Compiler.make_function_from_file(path,js_file) 73 | method = metadata['method'] 74 | eq = path.replace('.','_') 75 | method = ' return %s;' % method 76 | 77 | f = os.path.join(cwd,'Classes','ComCodeboxedImagegalleryModuleAssets.m') 78 | c = open(f).read() 79 | idx = c.find('return ') 80 | before = c[0:idx] 81 | after = """ 82 | } 83 | 84 | @end 85 | """ 86 | newc = before + method + after 87 | 88 | if newc!=c: 89 | x = open(f,'w') 90 | x.write(newc) 91 | x.close() 92 | 93 | def die(msg): 94 | print msg 95 | sys.exit(1) 96 | 97 | def warn(msg): 98 | print "[WARN] %s" % msg 99 | 100 | def validate_license(): 101 | c = open(os.path.join(cwd,'LICENSE')).read() 102 | if c.find(module_license_default)!=1: 103 | warn('please update the LICENSE file with your license text before distributing') 104 | 105 | def validate_manifest(): 106 | path = os.path.join(cwd,'manifest') 107 | f = open(path) 108 | if not os.path.exists(path): die("missing %s" % path) 109 | manifest = {} 110 | for line in f.readlines(): 111 | line = line.strip() 112 | if line[0:1]=='#': continue 113 | if line.find(':') < 0: continue 114 | key,value = line.split(':') 115 | manifest[key.strip()]=value.strip() 116 | for key in required_module_keys: 117 | if not manifest.has_key(key): die("missing required manifest key '%s'" % key) 118 | if module_defaults.has_key(key): 119 | defvalue = module_defaults[key] 120 | curvalue = manifest[key] 121 | if curvalue==defvalue: warn("please update the manifest key: '%s' to a non-default value" % key) 122 | return manifest,path 123 | 124 | ignoreFiles = ['.DS_Store','.gitignore','libTitanium.a','titanium.jar','README','com.codeboxed.imagegallery.js'] 125 | ignoreDirs = ['.DS_Store','.svn','.git','CVSROOT'] 126 | 127 | def zip_dir(zf,dir,basepath,ignore=[]): 128 | for root, dirs, files in os.walk(dir): 129 | for name in ignoreDirs: 130 | if name in dirs: 131 | dirs.remove(name) # don't visit ignored directories 132 | for file in files: 133 | if file in ignoreFiles: continue 134 | e = os.path.splitext(file) 135 | if len(e)==2 and e[1]=='.pyc':continue 136 | from_ = os.path.join(root, file) 137 | to_ = from_.replace(dir, basepath, 1) 138 | zf.write(from_, to_) 139 | 140 | def glob_libfiles(): 141 | files = [] 142 | for libfile in glob.glob('build/**/*.a'): 143 | if libfile.find('Release-')!=-1: 144 | files.append(libfile) 145 | return files 146 | 147 | def build_module(manifest,config): 148 | rc = os.system("xcodebuild -sdk iphoneos -configuration Release") 149 | if rc != 0: 150 | die("xcodebuild failed") 151 | rc = os.system("xcodebuild -sdk iphonesimulator -configuration Release") 152 | if rc != 0: 153 | die("xcodebuild failed") 154 | # build the merged library using lipo 155 | moduleid = manifest['moduleid'] 156 | libpaths = '' 157 | for libfile in glob_libfiles(): 158 | libpaths+='%s ' % libfile 159 | 160 | os.system("lipo %s -create -output build/lib%s.a" %(libpaths,moduleid)) 161 | 162 | def package_module(manifest,mf,config): 163 | name = manifest['name'].lower() 164 | moduleid = manifest['moduleid'].lower() 165 | version = manifest['version'] 166 | modulezip = '%s-iphone-%s.zip' % (moduleid,version) 167 | if os.path.exists(modulezip): os.remove(modulezip) 168 | zf = zipfile.ZipFile(modulezip, 'w', zipfile.ZIP_DEFLATED) 169 | modulepath = 'modules/iphone/%s/%s' % (moduleid,version) 170 | zf.write(mf,'%s/manifest' % modulepath) 171 | libname = 'lib%s.a' % moduleid 172 | zf.write('build/%s' % libname, '%s/%s' % (modulepath,libname)) 173 | docs = generate_doc(config) 174 | if docs!=None: 175 | for doc in docs: 176 | for file, html in doc.iteritems(): 177 | filename = string.replace(file,'.md','.html') 178 | zf.writestr('%s/documentation/%s'%(modulepath,filename),html) 179 | for dn in ('assets','example','platform'): 180 | if os.path.exists(dn): 181 | zip_dir(zf,dn,'%s/%s' % (modulepath,dn),['README']) 182 | zf.write('LICENSE','%s/LICENSE' % modulepath) 183 | zf.write('module.xcconfig','%s/module.xcconfig' % modulepath) 184 | zf.close() 185 | 186 | 187 | if __name__ == '__main__': 188 | manifest,mf = validate_manifest() 189 | validate_license() 190 | config = read_ti_xcconfig() 191 | compile_js(manifest,config) 192 | build_module(manifest,config) 193 | package_module(manifest,mf,config) 194 | sys.exit(0) 195 | 196 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/documentation/index.md: -------------------------------------------------------------------------------- 1 | # imagegallery Module 2 | 3 | ## Description 4 | 5 | Titanium Image Gallery Module 6 | 7 | ## Accessing the imagegallery Module 8 | 9 | To access this module from JavaScript, you would do the following: 10 | 11 | var imageGallery = require("com.codeboxed.imagegallery"); 12 | 13 | The imageGallery variable is a reference to the Module object. 14 | 15 | ## Reference 16 | 17 | ### imageGallery.create 18 | 19 | /** 20 | * Create an image gallery 21 | * 22 | * @method create 23 | * @param properties The object to configure the library 24 | * @param properties.win (optional) The window to attach the image gallery to. 25 | * Only use the Ti.UI.currentWindow for now 26 | * @param properties.images An Array containg the image objects 27 | * @param properties.images[].path The relative path for the image 28 | * @param properties.images[].caption The image caption 29 | * @param properties.rows (optional) Number of rows 30 | * @param properties.thumbSize (optional) The square thumbnail size 31 | * @param properties.thumbPadding (optional) The square padding 32 | * @return {Titanium.UI.ScrollView} Returns a ScrollView 33 | */ 34 | 35 | // Initialize the Image Gallery 36 | var imageGallery = ImageGallery.create({ 37 | images: imagesArray, 38 | columns: 4, // Set the numbers of columns (optional). Default is 4 39 | thumbSize: 75, // Set the thumb image size (optional). Default is 75 40 | thumbPadding: 5 // Set the thumb image padding (optional). Default is 5 41 | }); 42 | 43 | ## Usage 44 | 45 | // Import ImageGallery module 46 | var ImageGallery = require('com.codeboxed.imagegallery'); 47 | 48 | var win = Ti.UI.currentWindow; 49 | 50 | // Array with image objects 51 | var imagesArray = [ 52 | {path:'1.jpg', caption:'Kitten 1'}, 53 | {path:'2.jpg', caption:'Kitten 2'} 54 | ]; 55 | 56 | // Initialize the Image Gallery 57 | var imageGallery = ImageGallery.create({ 58 | images: imagesArray 59 | }); 60 | 61 | // Add it to the current window 62 | win.add(imageGallery); 63 | 64 | ## Author 65 | 66 | Codeboxed - 67 | 68 | ## License 69 | 70 | Copyright (c) 2011 Codeboxed 71 | 72 | Permission is hereby granted, free of charge, to any person 73 | obtaining a copy of this software and associated documentation 74 | files (the "Software"), to deal in the Software without 75 | restriction, including without limitation the rights to use, 76 | copy, modify, merge, publish, distribute, sublicense, and/or sell 77 | copies of the Software, and to permit persons to whom the 78 | Software is furnished to do so, subject to the following 79 | conditions: 80 | 81 | The above copyright notice and this permission notice shall be 82 | included in all copies or substantial portions of the Software. 83 | 84 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 85 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 86 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 87 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 88 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 89 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 90 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 91 | OTHER DEALINGS IN THE SOFTWARE. 92 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/example/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Module/ios/imagegallery/example/1.jpg -------------------------------------------------------------------------------- /Module/ios/imagegallery/example/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Module/ios/imagegallery/example/2.jpg -------------------------------------------------------------------------------- /Module/ios/imagegallery/example/app.js: -------------------------------------------------------------------------------- 1 | // Import ImageGallery module 2 | var ImageGallery = require('com.codeboxed.imagegallery'); 3 | 4 | var win = Ti.UI.createWindow(); 5 | 6 | // Array with image objects 7 | var imagesArray = [ 8 | {path:'1.jpg', caption:'Kitten 1'}, 9 | {path:'2.jpg', caption:'Kitten 2'} 10 | ]; 11 | 12 | // Initialize the Image Gallery 13 | var imageGallery = ImageGallery.create({ 14 | images: imagesArray 15 | }); 16 | 17 | // Add it to the window 18 | win.add(imageGallery); 19 | 20 | win.open(); 21 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/hooks/README: -------------------------------------------------------------------------------- 1 | These files are not yet supported as of 1.4.0 but will be in a near future release. 2 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/hooks/add.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # This is the module project add hook that will be 4 | # called when your module is added to a project 5 | # 6 | import os, sys 7 | 8 | def dequote(s): 9 | if s[0:1] == '"': 10 | return s[1:-1] 11 | return s 12 | 13 | def main(args,argc): 14 | # You will get the following command line arguments 15 | # in the following order: 16 | # 17 | # project_dir = the full path to the project root directory 18 | # project_type = the type of project (desktop, mobile, ipad) 19 | # project_name = the name of the project 20 | # 21 | project_dir = dequote(os.path.expanduser(args[1])) 22 | project_type = dequote(args[2]) 23 | project_name = dequote(args[3]) 24 | 25 | # TODO: write your add hook here (optional) 26 | 27 | 28 | # exit 29 | sys.exit(0) 30 | 31 | 32 | 33 | if __name__ == '__main__': 34 | main(sys.argv,len(sys.argv)) 35 | 36 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/hooks/install.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # This is the module install hook that will be 4 | # called when your module is first installed 5 | # 6 | import os, sys 7 | 8 | def main(args,argc): 9 | 10 | # TODO: write your install hook here (optional) 11 | 12 | # exit 13 | sys.exit(0) 14 | 15 | 16 | 17 | if __name__ == '__main__': 18 | main(sys.argv,len(sys.argv)) 19 | 20 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/hooks/remove.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # This is the module project remove hook that will be 4 | # called when your module is remove from a project 5 | # 6 | import os, sys 7 | 8 | def dequote(s): 9 | if s[0:1] == '"': 10 | return s[1:-1] 11 | return s 12 | 13 | def main(args,argc): 14 | # You will get the following command line arguments 15 | # in the following order: 16 | # 17 | # project_dir = the full path to the project root directory 18 | # project_type = the type of project (desktop, mobile, ipad) 19 | # project_name = the name of the project 20 | # 21 | project_dir = dequote(os.path.expanduser(args[1])) 22 | project_type = dequote(args[2]) 23 | project_name = dequote(args[3]) 24 | 25 | # TODO: write your remove hook here (optional) 26 | 27 | # exit 28 | sys.exit(0) 29 | 30 | 31 | 32 | if __name__ == '__main__': 33 | main(sys.argv,len(sys.argv)) 34 | 35 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/hooks/uninstall.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # This is the module uninstall hook that will be 4 | # called when your module is uninstalled 5 | # 6 | import os, sys 7 | 8 | def main(args,argc): 9 | 10 | # TODO: write your uninstall hook here (optional) 11 | 12 | # exit 13 | sys.exit(0) 14 | 15 | 16 | if __name__ == '__main__': 17 | main(sys.argv,len(sys.argv)) 18 | 19 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/imagegallery.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 45; 7 | objects = { 8 | 9 | /* Begin PBXAggregateTarget section */ 10 | 24416B8111C4CA220047AFDD /* Build & Test */ = { 11 | isa = PBXAggregateTarget; 12 | buildConfigurationList = 24416B8A11C4CA520047AFDD /* Build configuration list for PBXAggregateTarget "Build & Test" */; 13 | buildPhases = ( 14 | 24416B8011C4CA220047AFDD /* ShellScript */, 15 | ); 16 | dependencies = ( 17 | 24416B8511C4CA280047AFDD /* PBXTargetDependency */, 18 | ); 19 | name = "Build & Test"; 20 | productName = "Build & test"; 21 | }; 22 | /* End PBXAggregateTarget section */ 23 | 24 | /* Begin PBXBuildFile section */ 25 | 24DD6CF91134B3F500162E58 /* ComCodeboxedImagegalleryModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 24DD6CF71134B3F500162E58 /* ComCodeboxedImagegalleryModule.h */; }; 26 | 24DD6CFA1134B3F500162E58 /* ComCodeboxedImagegalleryModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 24DD6CF81134B3F500162E58 /* ComCodeboxedImagegalleryModule.m */; }; 27 | 24DE9E1111C5FE74003F90F6 /* ComCodeboxedImagegalleryModuleAssets.h in Headers */ = {isa = PBXBuildFile; fileRef = 24DE9E0F11C5FE74003F90F6 /* ComCodeboxedImagegalleryModuleAssets.h */; }; 28 | 24DE9E1211C5FE74003F90F6 /* ComCodeboxedImagegalleryModuleAssets.m in Sources */ = {isa = PBXBuildFile; fileRef = 24DE9E1011C5FE74003F90F6 /* ComCodeboxedImagegalleryModuleAssets.m */; }; 29 | AA747D9F0F9514B9006C5449 /* ComCodeboxedImagegallery_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = AA747D9E0F9514B9006C5449 /* ComCodeboxedImagegallery_Prefix.pch */; }; 30 | AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; }; 31 | /* End PBXBuildFile section */ 32 | 33 | /* Begin PBXContainerItemProxy section */ 34 | 24416B8411C4CA280047AFDD /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; 37 | proxyType = 1; 38 | remoteGlobalIDString = D2AAC07D0554694100DB518D; 39 | remoteInfo = "imagegallery"; 40 | }; 41 | /* End PBXContainerItemProxy section */ 42 | 43 | /* Begin PBXFileReference section */ 44 | 24DD6CF71134B3F500162E58 /* ComCodeboxedImagegalleryModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ComCodeboxedImagegalleryModule.h"; path = "Classes/ComCodeboxedImagegalleryModule.h"; sourceTree = ""; }; 45 | 24DD6CF81134B3F500162E58 /* ComCodeboxedImagegalleryModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "ComCodeboxedImagegalleryModule.m"; path = "Classes/ComCodeboxedImagegalleryModule.m"; sourceTree = ""; }; 46 | 24DD6D1B1134B66800162E58 /* titanium.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = titanium.xcconfig; sourceTree = ""; }; 47 | 24DE9E0F11C5FE74003F90F6 /* ComCodeboxedImagegalleryModuleAssets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ComCodeboxedImagegalleryModuleAssets.h"; path = "Classes/ComCodeboxedImagegalleryModuleAssets.h"; sourceTree = ""; }; 48 | 24DE9E1011C5FE74003F90F6 /* ComCodeboxedImagegalleryModuleAssets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "ComCodeboxedImagegalleryModuleAssets.m"; path = "Classes/ComCodeboxedImagegalleryModuleAssets.m"; sourceTree = ""; }; 49 | AA747D9E0F9514B9006C5449 /* ComCodeboxedImagegallery_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ComCodeboxedImagegallery_Prefix.pch"; sourceTree = SOURCE_ROOT; }; 50 | AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 51 | D2AAC07E0554694100DB518D /* libComCodeboxedImagegallery.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libComCodeboxedImagegallery.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | D2AAC07C0554694100DB518D /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */, 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | /* End PBXFrameworksBuildPhase section */ 64 | 65 | /* Begin PBXGroup section */ 66 | 034768DFFF38A50411DB9C8B /* Products */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | D2AAC07E0554694100DB518D /* libComCodeboxedImagegallery.a */, 70 | ); 71 | name = Products; 72 | sourceTree = ""; 73 | }; 74 | 0867D691FE84028FC02AAC07 /* imagegallery */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 08FB77AEFE84172EC02AAC07 /* Classes */, 78 | 32C88DFF0371C24200C91783 /* Other Sources */, 79 | 0867D69AFE84028FC02AAC07 /* Frameworks */, 80 | 034768DFFF38A50411DB9C8B /* Products */, 81 | ); 82 | name = "imagegallery"; 83 | sourceTree = ""; 84 | }; 85 | 0867D69AFE84028FC02AAC07 /* Frameworks */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | AACBBE490F95108600F1A2B1 /* Foundation.framework */, 89 | ); 90 | name = Frameworks; 91 | sourceTree = ""; 92 | }; 93 | 08FB77AEFE84172EC02AAC07 /* Classes */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 24DE9E0F11C5FE74003F90F6 /* ComCodeboxedImagegalleryModuleAssets.h */, 97 | 24DE9E1011C5FE74003F90F6 /* ComCodeboxedImagegalleryModuleAssets.m */, 98 | 24DD6CF71134B3F500162E58 /* ComCodeboxedImagegalleryModule.h */, 99 | 24DD6CF81134B3F500162E58 /* ComCodeboxedImagegalleryModule.m */, 100 | ); 101 | name = Classes; 102 | sourceTree = ""; 103 | }; 104 | 32C88DFF0371C24200C91783 /* Other Sources */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | AA747D9E0F9514B9006C5449 /* ComCodeboxedImagegallery_Prefix.pch */, 108 | 24DD6D1B1134B66800162E58 /* titanium.xcconfig */, 109 | ); 110 | name = "Other Sources"; 111 | sourceTree = ""; 112 | }; 113 | /* End PBXGroup section */ 114 | 115 | /* Begin PBXHeadersBuildPhase section */ 116 | D2AAC07A0554694100DB518D /* Headers */ = { 117 | isa = PBXHeadersBuildPhase; 118 | buildActionMask = 2147483647; 119 | files = ( 120 | AA747D9F0F9514B9006C5449 /* ComCodeboxedImagegallery_Prefix.pch in Headers */, 121 | 24DD6CF91134B3F500162E58 /* ComCodeboxedImagegalleryModule.h in Headers */, 122 | 24DE9E1111C5FE74003F90F6 /* ComCodeboxedImagegalleryModuleAssets.h in Headers */, 123 | ); 124 | runOnlyForDeploymentPostprocessing = 0; 125 | }; 126 | /* End PBXHeadersBuildPhase section */ 127 | 128 | /* Begin PBXNativeTarget section */ 129 | D2AAC07D0554694100DB518D /* imagegallery */ = { 130 | isa = PBXNativeTarget; 131 | buildConfigurationList = 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "imagegallery" */; 132 | buildPhases = ( 133 | D2AAC07A0554694100DB518D /* Headers */, 134 | D2AAC07B0554694100DB518D /* Sources */, 135 | D2AAC07C0554694100DB518D /* Frameworks */, 136 | ); 137 | buildRules = ( 138 | ); 139 | dependencies = ( 140 | ); 141 | name = "imagegallery"; 142 | productName = "imagegallery"; 143 | productReference = D2AAC07E0554694100DB518D /* libComCodeboxedImagegallery.a */; 144 | productType = "com.apple.product-type.library.static"; 145 | }; 146 | /* End PBXNativeTarget section */ 147 | 148 | /* Begin PBXProject section */ 149 | 0867D690FE84028FC02AAC07 /* Project object */ = { 150 | isa = PBXProject; 151 | buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "imagegallery" */; 152 | compatibilityVersion = "Xcode 3.1"; 153 | developmentRegion = English; 154 | hasScannedForEncodings = 1; 155 | knownRegions = ( 156 | English, 157 | Japanese, 158 | French, 159 | German, 160 | ); 161 | mainGroup = 0867D691FE84028FC02AAC07 /* imagegallery */; 162 | productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; 163 | projectDirPath = ""; 164 | projectRoot = ""; 165 | targets = ( 166 | D2AAC07D0554694100DB518D /* imagegallery */, 167 | 24416B8111C4CA220047AFDD /* Build & Test */, 168 | ); 169 | }; 170 | /* End PBXProject section */ 171 | 172 | /* Begin PBXShellScriptBuildPhase section */ 173 | 24416B8011C4CA220047AFDD /* ShellScript */ = { 174 | isa = PBXShellScriptBuildPhase; 175 | buildActionMask = 2147483647; 176 | files = ( 177 | ); 178 | inputPaths = ( 179 | ); 180 | outputPaths = ( 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | shellPath = /bin/sh; 184 | shellScript = "# shell script goes here\n\npython \"${TITANIUM_SDK}/titanium.py\" run --dir=\"${PROJECT_DIR}\"\nexit $?\n"; 185 | }; 186 | /* End PBXShellScriptBuildPhase section */ 187 | 188 | /* Begin PBXSourcesBuildPhase section */ 189 | D2AAC07B0554694100DB518D /* Sources */ = { 190 | isa = PBXSourcesBuildPhase; 191 | buildActionMask = 2147483647; 192 | files = ( 193 | 24DD6CFA1134B3F500162E58 /* ComCodeboxedImagegalleryModule.m in Sources */, 194 | 24DE9E1211C5FE74003F90F6 /* ComCodeboxedImagegalleryModuleAssets.m in Sources */, 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | }; 198 | /* End PBXSourcesBuildPhase section */ 199 | 200 | /* Begin PBXTargetDependency section */ 201 | 24416B8511C4CA280047AFDD /* PBXTargetDependency */ = { 202 | isa = PBXTargetDependency; 203 | target = D2AAC07D0554694100DB518D /* imagegallery */; 204 | targetProxy = 24416B8411C4CA280047AFDD /* PBXContainerItemProxy */; 205 | }; 206 | /* End PBXTargetDependency section */ 207 | 208 | /* Begin XCBuildConfiguration section */ 209 | 1DEB921F08733DC00010E9CD /* Debug */ = { 210 | isa = XCBuildConfiguration; 211 | baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; 212 | buildSettings = { 213 | ALWAYS_SEARCH_USER_PATHS = NO; 214 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 215 | COPY_PHASE_STRIP = NO; 216 | DSTROOT = "/tmp/ComCodeboxedImagegallery.dst"; 217 | GCC_DYNAMIC_NO_PIC = NO; 218 | GCC_ENABLE_FIX_AND_CONTINUE = YES; 219 | GCC_MODEL_TUNING = G5; 220 | GCC_OPTIMIZATION_LEVEL = 0; 221 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 222 | GCC_PREFIX_HEADER = "ComCodeboxedImagegallery_Prefix.pch"; 223 | INSTALL_PATH = /usr/local/lib; 224 | PRODUCT_NAME = "ComCodeboxedImagegallery"; 225 | }; 226 | name = Debug; 227 | }; 228 | 1DEB922008733DC00010E9CD /* Release */ = { 229 | isa = XCBuildConfiguration; 230 | baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; 231 | buildSettings = { 232 | ALWAYS_SEARCH_USER_PATHS = NO; 233 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 234 | DSTROOT = "/tmp/ComCodeboxedImagegallery.dst"; 235 | GCC_MODEL_TUNING = G5; 236 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 237 | GCC_PREFIX_HEADER = "ComCodeboxedImagegallery_Prefix.pch"; 238 | INSTALL_PATH = /usr/local/lib; 239 | PRODUCT_NAME = "ComCodeboxedImagegallery"; 240 | }; 241 | name = Release; 242 | }; 243 | 1DEB922308733DC00010E9CD /* Debug */ = { 244 | isa = XCBuildConfiguration; 245 | baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; 246 | buildSettings = { 247 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 248 | GCC_C_LANGUAGE_STANDARD = c99; 249 | GCC_OPTIMIZATION_LEVEL = 0; 250 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 251 | GCC_WARN_UNUSED_VARIABLE = YES; 252 | OTHER_LDFLAGS = ""; 253 | PREBINDING = NO; 254 | SDKROOT = iphoneos4.0; 255 | }; 256 | name = Debug; 257 | }; 258 | 1DEB922408733DC00010E9CD /* Release */ = { 259 | isa = XCBuildConfiguration; 260 | baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; 261 | buildSettings = { 262 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 263 | GCC_C_LANGUAGE_STANDARD = c99; 264 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 265 | GCC_WARN_UNUSED_VARIABLE = YES; 266 | OTHER_LDFLAGS = ""; 267 | PREBINDING = NO; 268 | SDKROOT = iphoneos4.0; 269 | }; 270 | name = Release; 271 | }; 272 | 24416B8211C4CA220047AFDD /* Debug */ = { 273 | isa = XCBuildConfiguration; 274 | baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; 275 | buildSettings = { 276 | COPY_PHASE_STRIP = NO; 277 | GCC_DYNAMIC_NO_PIC = NO; 278 | GCC_OPTIMIZATION_LEVEL = 0; 279 | PRODUCT_NAME = "Build & test"; 280 | }; 281 | name = Debug; 282 | }; 283 | 24416B8311C4CA220047AFDD /* Release */ = { 284 | isa = XCBuildConfiguration; 285 | baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; 286 | buildSettings = { 287 | COPY_PHASE_STRIP = YES; 288 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 289 | GCC_ENABLE_FIX_AND_CONTINUE = NO; 290 | PRODUCT_NAME = "Build & test"; 291 | ZERO_LINK = NO; 292 | }; 293 | name = Release; 294 | }; 295 | /* End XCBuildConfiguration section */ 296 | 297 | /* Begin XCConfigurationList section */ 298 | 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "imagegallery" */ = { 299 | isa = XCConfigurationList; 300 | buildConfigurations = ( 301 | 1DEB921F08733DC00010E9CD /* Debug */, 302 | 1DEB922008733DC00010E9CD /* Release */, 303 | ); 304 | defaultConfigurationIsVisible = 0; 305 | defaultConfigurationName = Release; 306 | }; 307 | 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "imagegallery" */ = { 308 | isa = XCConfigurationList; 309 | buildConfigurations = ( 310 | 1DEB922308733DC00010E9CD /* Debug */, 311 | 1DEB922408733DC00010E9CD /* Release */, 312 | ); 313 | defaultConfigurationIsVisible = 0; 314 | defaultConfigurationName = Release; 315 | }; 316 | 24416B8A11C4CA520047AFDD /* Build configuration list for PBXAggregateTarget "Build & Test" */ = { 317 | isa = XCConfigurationList; 318 | buildConfigurations = ( 319 | 24416B8211C4CA220047AFDD /* Debug */, 320 | 24416B8311C4CA220047AFDD /* Release */, 321 | ); 322 | defaultConfigurationIsVisible = 0; 323 | defaultConfigurationName = Release; 324 | }; 325 | /* End XCConfigurationList section */ 326 | }; 327 | rootObject = 0867D690FE84028FC02AAC07 /* Project object */; 328 | } 329 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/manifest: -------------------------------------------------------------------------------- 1 | # 2 | # this is your module manifest and used by Titanium 3 | # during compilation, packaging, distribution, etc. 4 | # 5 | version: 0.2 6 | description: Titanium Image Gallery 7 | author: Codeboxed 8 | license: MIT 9 | copyright: Copyright (c) 2011 by Codeboxed 10 | 11 | 12 | # these should not be edited 13 | name: imagegallery 14 | moduleid: com.codeboxed.imagegallery 15 | guid: 763f9e7d-ccdc-4791-9c98-35e4b86e1d3c 16 | platform: iphone 17 | minsdk: 1.7.0 18 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/module.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // PLACE ANY BUILD DEFINITIONS IN THIS FILE AND THEY WILL BE 3 | // PICKED UP DURING THE APP BUILD FOR YOUR MODULE 4 | // 5 | // see the following webpage for instructions on the settings 6 | // for this file: 7 | // http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/400-Build_Configurations/build_configs.html 8 | // 9 | 10 | // 11 | // How to add a Framework (example) 12 | // 13 | // OTHER_LDFLAGS=$(inherited) -framework Foo 14 | // 15 | // Adding a framework for a specific version(s) of iPhone: 16 | // 17 | // OTHER_LDFLAGS[sdk=iphoneos4*]=$(inherited) -framework Foo 18 | // OTHER_LDFLAGS[sdk=iphonesimulator4*]=$(inherited) -framework Foo 19 | // 20 | // 21 | // How to add a compiler define: 22 | // 23 | // OTHER_CFLAGS=$(inherited) -DFOO=1 24 | // 25 | // 26 | // IMPORTANT NOTE: always use $(inherited) in your overrides 27 | // 28 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/platform/README: -------------------------------------------------------------------------------- 1 | You can place platform-specific files here in sub-folders named "android" and/or "iphone", just as you can with normal Titanium Mobile SDK projects. Any folders and files you place here will be merged with the platform-specific files in a Titanium Mobile project that uses this module. 2 | 3 | When a Titanium Mobile project that uses this module is built, the files from this platform/ folder will be treated the same as files (if any) from the Titanium Mobile project's platform/ folder. 4 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/timodule.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Module/ios/imagegallery/titanium.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // 3 | // CHANGE THESE VALUES TO REFLECT THE VERSION (AND LOCATION IF DIFFERENT) 4 | // OF YOUR TITANIUM SDK YOU'RE BUILDING FOR 5 | // 6 | // 7 | TITANIUM_SDK_VERSION = 1.7.0 8 | 9 | 10 | // 11 | // THESE SHOULD BE OK GENERALLY AS-IS 12 | // 13 | TITANIUM_SDK = /Library/Application Support/Titanium/mobilesdk/osx/$(TITANIUM_SDK_VERSION) 14 | TITANIUM_BASE_SDK = "$(TITANIUM_SDK)/iphone/include" 15 | TITANIUM_BASE_SDK2 = "$(TITANIUM_SDK)/iphone/include/TiCore" 16 | HEADER_SEARCH_PATHS= $(TITANIUM_BASE_SDK) $(TITANIUM_BASE_SDK2) 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Welcome to your Appcelerator Titanium Mobile Project 2 | 3 | This is a blank project. Start by editing your application's app.js to 4 | make your first mobile project using Titanium. 5 | 6 | 7 | 8 | ---------------------------------- 9 | Stuff our legal folk make us say: 10 | 11 | Appcelerator, Appcelerator Titanium and associated marks and logos are 12 | trademarks of Appcelerator, Inc. 13 | 14 | Titanium is Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved. 15 | 16 | Titanium is licensed under the Apache Public License (Version 2). Please 17 | see the LICENSE file for the full license. 18 | 19 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | # Titanium Image Gallery 2 | 3 | Example implementation of an Image Gallery for Titanium Mobile. It runs on iOS and Android platforms. 4 | 5 | Created by: 6 | 7 | * Codeboxed - 8 | 9 | ## Use as a Titanium module 10 | 11 | ### Install the module 12 | 13 | 1. Run `Module/ios/imagegallery/build.py` or ant Module/android/imagegallery which creates your distribution or click `Downloads` and select your download 14 | 2. cd to `/Library/Application Support/Titanium` 15 | 3. copy this zip file into the folder of your Titanium SDK 16 | 17 | ### Register the module 18 | 19 | Register your module with your application by editing `tiapp.xml` and adding your module. 20 | Example: 21 | ```xml 22 | 23 | com.codeboxed.imagegallery 24 | com.codeboxed.imagegallery 25 | 26 | ``` 27 | When you run your project, the compiler will know automatically compile in your module 28 | dependencies and copy appropriate image assets into the application. 29 | 30 | ### Use the module 31 | ```javascript 32 | // Import ImageGallery module 33 | var ImageGallery = require('com.codeboxed.imagegallery'); 34 | 35 | var win = Ti.UI.currentWindow; 36 | 37 | // Array with image objects 38 | var imagesArray = [ 39 | {path:'1.jpg', caption:'Kitten 1'}, 40 | {path:'2.jpg', caption:'Kitten 2'} 41 | ]; 42 | 43 | // Initialize the Image Gallery 44 | var imageGallery = ImageGallery.create({ 45 | images: imagesArray, 46 | columns: 4, // Set the numbers of columns (optional). Default is 4 47 | thumbSize: 75, // Set the thumb image size (optional). Default is 75 48 | thumbPadding: 5 // Set the thumb image padding (optional). Default is 5 49 | }); 50 | 51 | // Add it to the current window 52 | win.add(imageGallery); 53 | ``` 54 | ## Notes 55 | * For an example on how to integrate the modules, check the Titanium mobile project included in the repo. 56 | * If you have any suggestions or bug reports, open a GitHub Issue. 57 | * If you have in mind any fixes/improvements, please feel free to contribute to the project. 58 | * Android is not supported any longer. It works with 1.6.x and hopefully will be supported again in the future. 59 | -------------------------------------------------------------------------------- /Resources/KS_nav_ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/KS_nav_ui.png -------------------------------------------------------------------------------- /Resources/KS_nav_views.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/KS_nav_views.png -------------------------------------------------------------------------------- /Resources/android/appicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/android/appicon.png -------------------------------------------------------------------------------- /Resources/android/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/android/default.png -------------------------------------------------------------------------------- /Resources/android/images/res-long-land-hdpi/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/android/images/res-long-land-hdpi/default.png -------------------------------------------------------------------------------- /Resources/android/images/res-long-land-ldpi/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/android/images/res-long-land-ldpi/default.png -------------------------------------------------------------------------------- /Resources/android/images/res-long-port-hdpi/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/android/images/res-long-port-hdpi/default.png -------------------------------------------------------------------------------- /Resources/android/images/res-long-port-ldpi/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/android/images/res-long-port-ldpi/default.png -------------------------------------------------------------------------------- /Resources/android/images/res-notlong-land-hdpi/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/android/images/res-notlong-land-hdpi/default.png -------------------------------------------------------------------------------- /Resources/android/images/res-notlong-land-ldpi/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/android/images/res-notlong-land-ldpi/default.png -------------------------------------------------------------------------------- /Resources/android/images/res-notlong-land-mdpi/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/android/images/res-notlong-land-mdpi/default.png -------------------------------------------------------------------------------- /Resources/android/images/res-notlong-port-hdpi/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/android/images/res-notlong-port-hdpi/default.png -------------------------------------------------------------------------------- /Resources/android/images/res-notlong-port-ldpi/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/android/images/res-notlong-port-ldpi/default.png -------------------------------------------------------------------------------- /Resources/android/images/res-notlong-port-mdpi/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/android/images/res-notlong-port-mdpi/default.png -------------------------------------------------------------------------------- /Resources/app.js: -------------------------------------------------------------------------------- 1 | // this sets the background color of the master UIView (when there are no windows/tab groups on it) 2 | Titanium.UI.setBackgroundColor('#000'); 3 | 4 | // create tab group 5 | var tabGroup = Titanium.UI.createTabGroup(); 6 | 7 | 8 | // 9 | // create base UI tab and root window 10 | // 11 | var win1 = Titanium.UI.createWindow({ 12 | title:'Image Gallery', 13 | backgroundColor:'#fff', 14 | url:'image_gallery.js' 15 | }); 16 | 17 | var tab1 = Titanium.UI.createTab({ 18 | icon:'KS_nav_views.png', 19 | title:'Image Gallery', 20 | window:win1 21 | }); 22 | 23 | var win2 = Titanium.UI.createWindow({ 24 | title:'Module', 25 | backgroundColor:'#fff', 26 | url:'image_gallery_module.js' 27 | }); 28 | 29 | var tab2 = Titanium.UI.createTab({ 30 | icon:'KS_nav_views.png', 31 | title:'Module', 32 | window:win2 33 | }); 34 | 35 | tabGroup.addTab(tab1); 36 | tabGroup.addTab(tab2); 37 | 38 | // open tab group 39 | tabGroup.open(); 40 | -------------------------------------------------------------------------------- /Resources/com.codeboxed.imagegallery.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Titanium-Image-Gallery 3 | * Created by Codeboxed on 2011-07-03. 4 | */ 5 | 6 | /** 7 | * Create an image gallery 8 | * 9 | * @method create 10 | * @param properties The object to configure the library 11 | * @param properties.win (optional) The window to attach the image gallery to. 12 | * Only use the Ti.UI.currentWindow for now 13 | * @param properties.images An Array containg the image objects 14 | * @param properties.images[].path The relative path for the image 15 | * @param properties.images[].caption The image caption 16 | * @return {Titanium.UI.ScrollView} Returns a ScrollView 17 | */ 18 | exports.create = function (properties) { 19 | var 20 | /** 21 | * The rows pointer 22 | * @property _rows 23 | * @type Number 24 | */ 25 | _rows = 0, 26 | 27 | /** 28 | * The columns pointer 29 | * @property _columns 30 | * @type Number 31 | */ 32 | _columns = 0, 33 | 34 | /** 35 | * The thumb padding setting 36 | * @property _thumbPadding 37 | * @type Number 38 | */ 39 | _thumbPadding = 5, 40 | 41 | /** 42 | * The row position pointer 43 | * @property _rowPosition 44 | * @type Number 45 | */ 46 | _rowPosition = 2, 47 | 48 | /** 49 | * @property _rowPositionReset 50 | * @type Number 51 | */ 52 | _rowPositionReset = 2, 53 | 54 | /** 55 | * @property _padding 56 | * @type Number 57 | */ 58 | _padding = 5, 59 | 60 | /** 61 | * @property _columnPosition 62 | * @type Number 63 | */ 64 | _columnPosition = 15, 65 | 66 | /** 67 | * @property _images 68 | * @type Array 69 | */ 70 | _images = properties.images, 71 | 72 | /** 73 | * @property _win 74 | * @type Titanium.UI.Window 75 | */ 76 | _win = properties.win, 77 | 78 | /** 79 | * @property _isFullscreen 80 | * @type Boolean 81 | */ 82 | _isFullscreen = false, 83 | 84 | /** 85 | * @property _isGesture 86 | * @type Boolean 87 | */ 88 | _isGesture = true, 89 | 90 | /** 91 | * @property _viewArray 92 | * @type Array 93 | */ 94 | _viewArray = [], 95 | 96 | /** 97 | * @property _imageWin 98 | * @type Titanium.UI.Window 99 | */ 100 | _imageWin = null, 101 | 102 | /** 103 | * @property _scrollView 104 | * @type Titanium.UI.ScrollView 105 | */ 106 | _scrollView = null; 107 | 108 | /** 109 | * Check if the platform is Android 110 | * 111 | * @method _isAndroid 112 | * @return {Boolean} True if Android, false otherwise 113 | */ 114 | var _isAndroid = function () { 115 | if (Ti.Platform.name === 'android') { 116 | return true; 117 | } 118 | 119 | return false; 120 | }; 121 | 122 | /** 123 | * Add elements to image window 124 | * 125 | * @method _createImageWin 126 | * @param {Number} The image to start with ID 127 | */ 128 | var _createImageWin = function (myID) { 129 | var photosView, 130 | descriptionLabel, 131 | view, 132 | flexSpace, 133 | leftButton, 134 | rightButton, 135 | toolbar; 136 | 137 | photosView = Ti.UI.createScrollableView({ 138 | width: 320, 139 | height: 480, 140 | top: 0, 141 | showPagingControl: false, 142 | pagingControlColor: '#fff', 143 | maxZoomScale: 2.0, 144 | currentPage: 0 145 | }); 146 | 147 | descriptionLabel = Ti.UI.createLabel({ 148 | text: _images[myID].caption, 149 | width: 320, 150 | bottom: 45, 151 | height: 'auto', 152 | backgroundColor: '#000', 153 | font: { 154 | fontSize: 12, 155 | fontWeight: 'bold' 156 | }, 157 | color: '#FFF', 158 | zIndex: 2, 159 | opacity: 0.8 160 | }); 161 | 162 | /* 163 | * Check for the platform 164 | * iPhone has more functionality 165 | */ 166 | if (_isAndroid()) { 167 | // Android 168 | view = Ti.UI.createImageView({ 169 | backgroundColor: '#000', 170 | image: _images[myID].path, 171 | width: 'auto', 172 | height: 350, 173 | top: 0, 174 | canScale: true 175 | }); 176 | 177 | // Add the image view to the window 178 | _imageWin.add(view); 179 | 180 | descriptionLabel.bottom = 0; 181 | } else { 182 | // iPhone 183 | for (var i = 0, b = _images.length; i < b; i++) { 184 | view = Ti.UI.createImageView({ 185 | backgroundColor: '#000', 186 | image: _images[i].path, 187 | width: 320, 188 | height: '100%', 189 | top: -50 190 | }); 191 | 192 | _viewArray[i] = view; 193 | } 194 | 195 | photosView.views = _viewArray; 196 | photosView.currentPage = myID; 197 | 198 | _imageWin.add(photosView); 199 | 200 | _imageWin.hideTabBar(); 201 | 202 | flexSpace = Ti.UI.createButton({ 203 | systemButton: Ti.UI.iPhone.SystemButton.FLEXIBLE_SPACE 204 | }); 205 | 206 | leftButton = Ti.UI.createButton({ 207 | // TODO: Allow to pass the leftButton image as an option 208 | systemButton: Ti.UI.iPhone.SystemButton.REWIND 209 | }); 210 | 211 | leftButton.addEventListener('click', function() { 212 | // Defined the boundries 213 | var index = (photosView.currentPage - 1 < 0) ? 0: photosView.currentPage - 1; 214 | var view = photosView.views[index]; 215 | 216 | _isGesture = false; 217 | 218 | photosView.scrollToView(view); 219 | }); 220 | 221 | rightButton = Ti.UI.createButton({ 222 | // TODO: Allow to pass the rightButton image as an option 223 | systemButton: Ti.UI.iPhone.SystemButton.FAST_FORWARD 224 | }); 225 | 226 | rightButton.addEventListener('click', function() { 227 | // Defined the boundries 228 | var index = (photosView.currentPage + 1 >= photosView.views.length) ? photosView.currentPage: photosView.currentPage + 1; 229 | var view = photosView.views[index]; 230 | 231 | _isGesture = false; 232 | 233 | photosView.scrollToView(view); 234 | }); 235 | 236 | toolbar = Ti.UI.createToolbar({ 237 | items: [flexSpace, leftButton, flexSpace, rightButton, flexSpace], 238 | bottom: 0, 239 | borderTop: true, 240 | borderBottom: true, 241 | barColor: '#000' 242 | }); 243 | 244 | _imageWin.add(toolbar); 245 | 246 | photosView.addEventListener('singletap', function() { 247 | // If the view is fullscreen the exit fullscreen 248 | // else go fullscreen 249 | if (_isFullscreen) { 250 | // Exit fullscreen 251 | Ti.UI.iPhone.showStatusBar(); 252 | _imageWin.showNavBar(); 253 | toolbar.show(); 254 | descriptionLabel.show(); 255 | } else { 256 | // Go fullscreen 257 | Ti.UI.iPhone.hideStatusBar(); 258 | _imageWin.hideNavBar(); 259 | toolbar.hide(); 260 | descriptionLabel.hide(); 261 | } 262 | 263 | _isFullscreen = !_isFullscreen; 264 | }); 265 | 266 | photosView.addEventListener('scroll', function(e) { 267 | if (_isGesture) { 268 | Ti.UI.iPhone.hideStatusBar(); 269 | _imageWin.hideNavBar(); 270 | toolbar.hide(); 271 | descriptionLabel.hide(); 272 | 273 | _isFullscreen = true; 274 | } else { 275 | _isGesture = true; 276 | } 277 | 278 | descriptionLabel.text = _images[e.currentPage].caption; 279 | 280 | _imageWin.title = e.currentPage + 1 + ' of ' + _images.length; 281 | }); 282 | } 283 | 284 | _imageWin.add(descriptionLabel); 285 | }; 286 | 287 | // Create ScrollView 288 | _scrollView = Ti.UI.createScrollView({ 289 | contentWidth: 320, 290 | contentHeight: 'auto', 291 | top: 0, 292 | backgroundColor: '#000', 293 | showVerticalScrollIndicator: true, 294 | showHorizontalScrollIndicator: false 295 | }); 296 | 297 | for (var i = 0, b = _images.length; i < b; i++) { 298 | var _img; 299 | 300 | // Display the thumbs on 4 collumns 301 | if (_columns % 4 === 0 && _rows !== 0) { 302 | _columnPosition += 75 + _thumbPadding; 303 | _rowPosition = _rowPositionReset; 304 | } 305 | 306 | // Create the thumb as a label with a background image 307 | _img = Ti.UI.createLabel({ 308 | backgroundImage: _images[i].path, 309 | width: 75, 310 | height: 75, 311 | myID: i, 312 | left: _rowPosition, 313 | top: _columnPosition 314 | }); 315 | 316 | // Set the thumbs properties 317 | // TODO: Properties should be sent as an option 318 | _img.borderColor = null; 319 | _img.borderWidth = 0; 320 | _img.backgroundPaddingLeft = 0; 321 | _img.backgroundPaddingRight = 0; 322 | _img.backgroundPaddingTop = 0; 323 | _img.backgroundPaddingBottom = 0; 324 | _img.backgroundLeftCap = 0; 325 | _img.backgroundTopCap = 0; 326 | 327 | // Attach click listener to each thumb 328 | _img.addEventListener('click', function (e) { 329 | // Create a new window and show the image selected 330 | _imageWin = Ti.UI.createWindow({ 331 | backgroundColor: '#000', 332 | title: e.source.myID + 1 + ' of ' + _images.length 333 | }); 334 | 335 | // Add elements to the window 336 | _createImageWin(e.source.myID); 337 | 338 | // Push the window in the tabbar controller 339 | Ti.UI.currentTab.open(_imageWin); 340 | }); 341 | 342 | // Add thumb to the scrollview 343 | _scrollView.add(_img); 344 | 345 | // Increment pointers 346 | _columns += 1; 347 | _rows += 1; 348 | _rowPosition += 75 + _padding; 349 | } 350 | 351 | return _scrollView; 352 | }; -------------------------------------------------------------------------------- /Resources/default_app_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/default_app_logo.png -------------------------------------------------------------------------------- /Resources/image_gallery.js: -------------------------------------------------------------------------------- 1 | /* 2 | image_gallery.js 3 | Titanium-Image-Gallery 4 | 5 | Created by Codeboxed on 2011-05-20. 6 | */ 7 | 8 | var win = Ti.UI.currentWindow; 9 | var isAndroid = false; 10 | 11 | if (Ti.Platform.name == 'android') { 12 | isAndroid = true; 13 | } 14 | 15 | // Images array 16 | var images = [ 17 | {filename: '1.jpg', caption: 'Kitten placeholder'}, 18 | {filename: '2.jpg', caption: 'Kitten placeholder'}, 19 | {filename: '3.jpg', caption: 'Kitten placeholder'}, 20 | {filename: '4.jpg', caption: 'Kitten placeholder'}, 21 | {filename: '5.jpg', caption: 'Kitten placeholder'}, 22 | {filename: '6.jpg', caption: 'Kitten placeholder'} 23 | ]; 24 | 25 | var rows = 0; 26 | var columns = 0; 27 | var thumbPadding = 5; 28 | 29 | var rowPosition = 2; 30 | var rowPositionReset = 2; 31 | var padding = 5; 32 | 33 | var columnPosition = 15; 34 | 35 | var imageLocation; 36 | 37 | if (isAndroid) { 38 | imageLocation = '/images/'; 39 | } else { 40 | imageLocation = 'images/'; 41 | } 42 | 43 | win.orientationModes = [ Ti.UI.PORTRAIT ]; 44 | 45 | var scrollView = Ti.UI.createScrollView({ 46 | contentWidth : 320, 47 | contentHeight : 'auto', 48 | top : 0, 49 | backgroundColor : '#000', 50 | showVerticalScrollIndicator : true, 51 | showHorizontalScrollIndicator : false 52 | }); 53 | 54 | for (i = 0, b = images.length; i < b; i++) { 55 | if (columns % 4 == 0 && rows != 0) { 56 | columnPosition += 75 + thumbPadding; 57 | rowPosition = rowPositionReset; 58 | } 59 | 60 | var img = Ti.UI.createLabel({ 61 | backgroundImage : imageLocation + images[i].filename, 62 | width : 75, 63 | height : 75, 64 | myID : i, 65 | left : rowPosition, 66 | top : columnPosition 67 | }); 68 | 69 | img.borderColor = null; 70 | img.borderWidth = 0; 71 | img.backgroundPaddingLeft = 0; 72 | img.backgroundPaddingRight = 0; 73 | img.backgroundPaddingTop = 0; 74 | img.backgroundPaddingBottom = 0; 75 | img.backgroundLeftCap = 0; 76 | img.backgroundTopCap = 0; 77 | 78 | img.addEventListener('click', function(e) { 79 | var win_photo = Ti.UI.createWindow({ 80 | backgroundColor : '#000', 81 | title : e.source.myID + 1 + ' of ' + images.length, 82 | windowInfo : images, 83 | myID : e.source.myID, 84 | url : 'image_gallery_single.js' 85 | }); 86 | 87 | win_photo.hideTabBar(); 88 | 89 | Ti.UI.currentTab.open(win_photo, { 90 | animated : true 91 | }); 92 | }); 93 | 94 | scrollView.add(img); 95 | 96 | columns++; 97 | rows++; 98 | rowPosition += 75 + padding; 99 | } 100 | 101 | win.add(scrollView); -------------------------------------------------------------------------------- /Resources/image_gallery_module.js: -------------------------------------------------------------------------------- 1 | var ImageGallery = require('com.codeboxed.imagegallery'); 2 | 3 | var win = Ti.UI.currentWindow; 4 | 5 | var imagesArray = [ 6 | {path:'images/1.jpg', caption:'Kitten 1'}, 7 | {path:'images/2.jpg', caption:'Kitten 2'}, 8 | {path:'images/3.jpg', caption:'Kitten 3'}, 9 | {path:'images/4.jpg', caption:'Kitten 4'}, 10 | {path:'images/5.jpg', caption:'Kitten 5'}, 11 | {path:'images/6.jpg', caption:'Kitten 6'} 12 | ]; 13 | 14 | var imageGallery = ImageGallery.create({ 15 | images: imagesArray 16 | }); 17 | 18 | win.add(imageGallery); -------------------------------------------------------------------------------- /Resources/image_gallery_single.js: -------------------------------------------------------------------------------- 1 | /* 2 | image_gallery_single.js 3 | Titanium-Image-Gallery 4 | 5 | Created by Codeboxed on 2011-05-20. 6 | */ 7 | 8 | var win = Ti.UI.currentWindow; 9 | var isAndroid = false; 10 | 11 | if (Ti.Platform.name == 'android') { 12 | isAndroid = true; 13 | } 14 | 15 | win.orientationModes = [ Ti.UI.PORTRAIT ]; 16 | 17 | var isFullscreen = false; 18 | var isGesture = true; 19 | var images = win.windowInfo; 20 | var myID = win.myID; 21 | var viewArray = []; 22 | 23 | if (isAndroid) { 24 | imageLocation = '/images/'; 25 | } else { 26 | imageLocation = 'images/'; 27 | } 28 | 29 | var photosView = Ti.UI.createScrollableView({ 30 | width : 320, 31 | height : 480, 32 | top : 0, 33 | showPagingControl : false, 34 | pagingControlColor : '#fff', 35 | maxZoomScale : 2.0, 36 | currentPage : 0 37 | }); 38 | 39 | var descriptionLabel = Ti.UI.createLabel({ 40 | text : images[myID].caption, 41 | width : 320, 42 | bottom : 45, 43 | height : 'auto', 44 | backgroundColor : '#000', 45 | font : { 46 | fontSize : 12, 47 | fontWeight : 'bold' 48 | }, 49 | color : '#FFF', 50 | zIndex : 2, 51 | opacity : 0.8 52 | }); 53 | 54 | if (!isAndroid) { 55 | for (i = 0; i < images.length; i++) { 56 | var view = Ti.UI.createImageView({ 57 | backgroundColor : '#000', 58 | image : imageLocation + images[i].filename, 59 | width : 320, 60 | height : '100%', 61 | top : -50 62 | }); 63 | 64 | viewArray[i] = view; 65 | } 66 | 67 | photosView.views = viewArray; 68 | } 69 | 70 | if (!isAndroid) { 71 | photosView.currentPage = myID; 72 | 73 | win.add(photosView); 74 | win.hideTabBar(); 75 | 76 | var flexSpace = Ti.UI.createButton({ 77 | systemButton : Ti.UI.iPhone.SystemButton.FLEXIBLE_SPACE 78 | }); 79 | 80 | var leftButton = Ti.UI.createButton({ 81 | image : 'images/icon_arrow_left.png' 82 | }); 83 | 84 | leftButton.addEventListener('click', function() { 85 | var index = (photosView.currentPage - 1 < 0) ? 0 86 | : photosView.currentPage - 1; 87 | var view = photosView.views[index]; 88 | 89 | isGesture = false; 90 | 91 | photosView.scrollToView(view); 92 | }); 93 | var rightButton = Ti.UI.createButton({ 94 | image : 'images/icon_arrow_right.png' 95 | }); 96 | 97 | rightButton.addEventListener('click', function() { 98 | var index = (photosView.currentPage + 1 >= photosView.views.length) ? photosView.currentPage : photosView.currentPage + 1; 99 | var view = photosView.views[index]; 100 | 101 | isGesture = false; 102 | 103 | photosView.scrollToView(view); 104 | }); 105 | 106 | var toolbar = Ti.UI.createToolbar({ 107 | items : [ flexSpace, leftButton, flexSpace, rightButton, flexSpace ], 108 | bottom : 0, 109 | borderTop : true, 110 | borderBottom : true, 111 | barColor : '#000' 112 | }); 113 | 114 | win.add(toolbar); 115 | 116 | photosView.addEventListener('singletap', function() { 117 | if (isFullscreen) { 118 | Ti.UI.iPhone.showStatusBar(); 119 | win.showNavBar(); 120 | toolbar.show(); 121 | descriptionLabel.show(); 122 | } else { 123 | Ti.UI.iPhone.hideStatusBar(); 124 | win.hideNavBar(); 125 | toolbar.hide(); 126 | descriptionLabel.hide(); 127 | } 128 | 129 | isFullscreen = !isFullscreen; 130 | }); 131 | 132 | photosView.addEventListener('scroll', function(e) { 133 | if (isGesture) { 134 | Ti.UI.iPhone.hideStatusBar(); 135 | win.hideNavBar(); 136 | toolbar.hide(); 137 | descriptionLabel.hide(); 138 | 139 | isFullscreen = true; 140 | } else { 141 | isGesture = true; 142 | } 143 | 144 | i = e.currentPage; 145 | activeView = e.view; 146 | descriptionLabel.text = images[i].caption; 147 | 148 | win.title = i + 1 + ' of ' + images.length; 149 | }); 150 | } else { 151 | var view = Ti.UI.createImageView({ 152 | backgroundColor : '#000', 153 | image : imageLocation + images[myID].filename, 154 | width : 'auto', 155 | height : 350, 156 | top : 0, 157 | canScale : true 158 | }); 159 | 160 | win.add(view); 161 | 162 | descriptionLabel.bottom = 0; 163 | } 164 | 165 | win.add(descriptionLabel); -------------------------------------------------------------------------------- /Resources/images/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/images/1.jpg -------------------------------------------------------------------------------- /Resources/images/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/images/2.jpg -------------------------------------------------------------------------------- /Resources/images/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/images/3.jpg -------------------------------------------------------------------------------- /Resources/images/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/images/4.jpg -------------------------------------------------------------------------------- /Resources/images/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/images/5.jpg -------------------------------------------------------------------------------- /Resources/images/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/images/6.jpg -------------------------------------------------------------------------------- /Resources/images/icon_arrow_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/images/icon_arrow_left.png -------------------------------------------------------------------------------- /Resources/images/icon_arrow_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/images/icon_arrow_right.png -------------------------------------------------------------------------------- /Resources/iphone/Default-Landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/iphone/Default-Landscape.png -------------------------------------------------------------------------------- /Resources/iphone/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/iphone/Default-Portrait.png -------------------------------------------------------------------------------- /Resources/iphone/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/iphone/Default.png -------------------------------------------------------------------------------- /Resources/iphone/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/iphone/Default@2x.png -------------------------------------------------------------------------------- /Resources/iphone/appicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeboxed/Titanium-Image-Gallery/ffebc1b614b356c1e6b980fdc6098cc54baab441/Resources/iphone/appicon.png -------------------------------------------------------------------------------- /manifest: -------------------------------------------------------------------------------- 1 | #appname: Titanium Image Gallery 2 | #publisher: morion 3 | #url: http:// 4 | #image: appicon.png 5 | #appid: com.codeboxed.imagegallery 6 | #desc: undefined 7 | #type: mobile 8 | #guid: c21bf7ad-c5c2-4894-88c6-c6f87e3019cf 9 | -------------------------------------------------------------------------------- /tiapp.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | true 6 | false 7 | true 8 | false 9 | 10 | com.codeboxed.imagegallery 11 | Titanium Image Gallery 12 | 0.1 13 | Codeboxed 14 | http://www.codeboxed.com 15 | Titanium Image Gallery 16 | 2011 by Codeboxed 17 | appicon.png 18 | false 19 | false 20 | default 21 | false 22 | false 23 | false 24 | true 25 | c21bf7ad-c5c2-4894-88c6-c6f87e3019cf 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 | com.codeboxed.imagegallery 41 | com.codeboxed.imagegallery 42 | 43 | 44 | --------------------------------------------------------------------------------