├── .gitignore
├── .jshintrc
├── DefaultIcon-ios.png
├── DefaultIcon.png
├── LICENSE
├── MarketplaceArtwork.png
├── README.md
├── app
├── README
├── alloy.js
├── assets
│ ├── android
│ │ ├── appicon.png
│ │ └── default.png
│ └── iphone
│ │ ├── Default-568h@2x.png
│ │ ├── Default-667h@2x.png
│ │ ├── Default-Landscape-736h@3x.png
│ │ ├── Default-Portrait-736h@3x.png
│ │ ├── Default.png
│ │ ├── Default@2x.png
│ │ ├── iTunesArtwork
│ │ └── iTunesArtwork@2x
├── config.json
├── controllers
│ ├── home.js
│ ├── index.js
│ ├── page.js
│ ├── page1.js
│ └── sidemenu.js
├── lib
│ └── xp.ui.js
├── styles
│ ├── app.tss
│ ├── index.tss
│ └── sidemenu.tss
├── views
│ ├── home.xml
│ ├── index.xml
│ ├── page.xml
│ ├── page1.xml
│ └── sidemenu.xml
└── widgets
│ └── nl.fokkezb.drawer
│ ├── README.md
│ ├── appc-npm
│ ├── controllers
│ └── widget.js
│ ├── package.json
│ ├── views
│ └── widget.xml
│ └── widget.json
├── iTunesConnect.png
├── modules
├── android
│ ├── com.tripvi.drawerlayout
│ │ └── 1.3.6
│ │ │ ├── LICENSE
│ │ │ ├── documentation
│ │ │ └── index.html
│ │ │ ├── drawerlayout.jar
│ │ │ ├── example
│ │ │ └── app.js
│ │ │ ├── libs
│ │ │ ├── armeabi-v7a
│ │ │ │ └── libcom.tripvi.drawerlayout.so
│ │ │ ├── armeabi
│ │ │ │ └── libcom.tripvi.drawerlayout.so
│ │ │ └── x86
│ │ │ │ └── libcom.tripvi.drawerlayout.so
│ │ │ ├── manifest
│ │ │ ├── platform
│ │ │ └── android
│ │ │ │ └── res
│ │ │ │ ├── drawable-hdpi
│ │ │ │ ├── drawer_shadow.9.png
│ │ │ │ └── ic_drawer.png
│ │ │ │ ├── drawable-mdpi
│ │ │ │ ├── drawer_shadow.9.png
│ │ │ │ └── ic_drawer.png
│ │ │ │ ├── drawable-xhdpi
│ │ │ │ ├── drawer_shadow.9.png
│ │ │ │ └── ic_drawer.png
│ │ │ │ ├── drawable-xxhdpi
│ │ │ │ ├── drawer_shadow.9.png
│ │ │ │ └── ic_drawer.png
│ │ │ │ ├── layout
│ │ │ │ └── drawer_main.xml
│ │ │ │ └── values
│ │ │ │ └── strings.xml
│ │ │ └── timodule.xml
│ └── dk.napp.drawer
│ │ └── 1.1.6
│ │ ├── LICENSE
│ │ ├── documentation
│ │ └── index.html
│ │ ├── example
│ │ └── app.js
│ │ ├── libs
│ │ ├── armeabi-v7a
│ │ │ └── libdk.napp.drawer.so
│ │ ├── armeabi
│ │ │ └── libdk.napp.drawer.so
│ │ └── x86
│ │ │ └── libdk.napp.drawer.so
│ │ ├── manifest
│ │ ├── nappslide.jar
│ │ ├── platform
│ │ └── android
│ │ │ └── res
│ │ │ └── values
│ │ │ ├── attrs.xml
│ │ │ └── ids.xml
│ │ └── timodule.xml
├── commonjs
│ └── ti-window-stack
│ │ └── 1.0.1
│ │ ├── LICENSE
│ │ ├── manifest
│ │ ├── package.json
│ │ └── ti-window-stack.js
└── iphone
│ └── dk.napp.drawer
│ └── 1.2.3
│ ├── LICENSE
│ ├── documentation
│ └── index.html
│ ├── libdk.napp.drawer.a
│ ├── manifest
│ └── module.xcconfig
├── plugins
└── ti.alloy
│ ├── hooks
│ ├── alloy.js
│ └── deepclean.js
│ └── plugin.py
├── screens
├── android.gif
└── iphone.gif
└── tiapp.xml
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | Resources
3 | build.log
4 | build
5 | npm-debug.log
6 | tmp
7 | .map
8 | .project
9 | .settings
10 | Thumbs.db
--------------------------------------------------------------------------------
/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "camelcase": true,
3 | "curly": true,
4 | "newcap": true,
5 | "noempty": true,
6 | "plusplus": false,
7 | "quotmark": false,
8 | "undef": true,
9 | "unused": true,
10 | "strict": false,
11 | "node": true,
12 | "predef": ["Ti", "Alloy", "Titanium", "require", "$", "L", "OS_IOS", "OS_ANDROID", "ENV_DEV", "setTimeout", "alert", "$model", "exports", "module", "_"]
13 | }
14 |
--------------------------------------------------------------------------------
/DefaultIcon-ios.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/DefaultIcon-ios.png
--------------------------------------------------------------------------------
/DefaultIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/DefaultIcon.png
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Hazem Khaled
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/MarketplaceArtwork.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/MarketplaceArtwork.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TiWindowStack example with SideMenu
2 | This is example using ti-window-stack CommonJS module with the common SideMenu/Drawe Widget by @fokkezb
3 |
4 | ## About
5 | Simply [TiWindowStack](http://gitt.io/component/ti-window-stack) module handle navigation Android Menu api for apps using [Fokke Drawer Widget](http://gitt.io/component/nl.fokkezb.drawer) over [NappDrawer](http://gitt.io/component/dk.napp.drawer) or [DrawerLayout](https://github.com/manumaticx/Ti.DrawerLayout)
6 |
7 |  
8 |
9 | ## Tutorial
10 | Sooooon
11 |
12 | ## License
13 | This tutorial depend on another great persons code, everything is open source for sure, but don't forget to check their license before use.
14 |
--------------------------------------------------------------------------------
/app/README:
--------------------------------------------------------------------------------
1 | Welcome to Alloy. Prepare to be amazed.
2 | =======================================
3 |
4 | Titanium Alloys are metals which contain a mixture of Titanium and other chemical elements. Such Alloys have very high tensile strength and toughness (even at extreme temperatures). They are light weight, have extraordinary corrosion resistance and the ability to withstand extreme temperatures [1].
5 |
6 | Alloy for Titanium provides you, the developer, with the ability to run fast, jump high and generally code like an amazing superstar.
7 |
8 | Codestrong!
9 |
10 | [1] http://en.wikipedia.org/wiki/Titanium_alloy
11 |
12 | -------------------------
13 | Now to the serious stuff.
14 | -------------------------
15 |
16 | Here's how your Alloy directory is laid out.
17 |
18 | models your model files go here
19 | controllers your controllers files go here
20 | views yep, the views go here. you're getting it
21 | styles your style (.tss) files for your views go here
22 | assets All files here will be deployed into Resources
23 |
24 | Folders not generated by Alloy automatically, but the developer can create and use.
25 |
26 | lib put your own libraries here and use require('name') to load it
27 | migrations generated model migrations go here
28 | widgets pre-built, reusable components for your Ally apps.
29 |
30 | Also, in the root is the alloy.jmk file and config.json. Alloy.jmk acts like a makefile and can be used to hook into the Alloy compiler to customize the build process. The config.json file is where you can declare runtime contstants, and widget dependencies.
31 |
32 |
--------------------------------------------------------------------------------
/app/alloy.js:
--------------------------------------------------------------------------------
1 | // The contents of this file will be executed before any of
2 | // your view controllers are ever executed, including the index.
3 | // You have access to all functionality on the `Alloy` namespace.
4 | //
5 | // This is a great place to do any initialization for your app
6 | // or create any global variables/functions that you'd like to
7 | // make available throughout your app. You can easily make things
8 | // accessible globally by attaching them to the `Alloy.Globals`
9 | // object. For example:
10 | //
11 | // Alloy.Globals.someGlobalFunction = function(){};
12 |
--------------------------------------------------------------------------------
/app/assets/android/appicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/app/assets/android/appicon.png
--------------------------------------------------------------------------------
/app/assets/android/default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/app/assets/android/default.png
--------------------------------------------------------------------------------
/app/assets/iphone/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/app/assets/iphone/Default-568h@2x.png
--------------------------------------------------------------------------------
/app/assets/iphone/Default-667h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/app/assets/iphone/Default-667h@2x.png
--------------------------------------------------------------------------------
/app/assets/iphone/Default-Landscape-736h@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/app/assets/iphone/Default-Landscape-736h@3x.png
--------------------------------------------------------------------------------
/app/assets/iphone/Default-Portrait-736h@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/app/assets/iphone/Default-Portrait-736h@3x.png
--------------------------------------------------------------------------------
/app/assets/iphone/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/app/assets/iphone/Default.png
--------------------------------------------------------------------------------
/app/assets/iphone/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/app/assets/iphone/Default@2x.png
--------------------------------------------------------------------------------
/app/assets/iphone/iTunesArtwork:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/app/assets/iphone/iTunesArtwork
--------------------------------------------------------------------------------
/app/assets/iphone/iTunesArtwork@2x:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/app/assets/iphone/iTunesArtwork@2x
--------------------------------------------------------------------------------
/app/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "global": {},
3 | "env:development": {},
4 | "env:test": {},
5 | "env:production": {},
6 | "os:android": {},
7 | "os:blackberry": {},
8 | "os:ios": {},
9 | "os:mobileweb": {},
10 | "os:windows": {},
11 | "dependencies": {
12 | "nl.fokkezb.drawer": "*"
13 | }
14 | }
--------------------------------------------------------------------------------
/app/controllers/home.js:
--------------------------------------------------------------------------------
1 | // Drawer come from right or left
2 | var direction = Ti.Locale.currentLanguage === 'ar' ? 'Right' : 'Left';
3 |
4 | function openPage1() {
5 | Alloy.Globals.windowStack.open(Alloy.createController('page').getView());
6 | }
7 |
8 | function toggle() {
9 | var fn = 'toggle' + direction + 'Window';
10 | Alloy.Globals.drawer[fn]();
11 | }
12 |
13 | if (OS_IOS) {
14 |
15 | var navButton = Ti.UI.createButton({
16 | title: 'Menu'
17 | });
18 | navButton.addEventListener('click', toggle);
19 |
20 | $.home[direction + 'NavButton'] = navButton;
21 | }
22 |
23 | $.home.onCreateOptionsMenu = function(e) {
24 |
25 | // Clean up all items from any other controller
26 | e.menu.clear();
27 |
28 | // Add our items
29 | var menuItem = e.menu.add({
30 | title: "Add Task"
31 | });
32 | menuItem.addEventListener("click", function() {
33 | alert("Let's add it");
34 | });
35 |
36 | // SearchView
37 | var searchView = Ti.UI.Android.createSearchView({
38 | hintText: "Search here ..."
39 | });
40 |
41 | searchView.addEventListener('submit', function(e) {
42 | alert('Search for: ' + e.source.value);
43 | });
44 |
45 | e.menu.add({
46 | title: 'Search',
47 | showAsAction: Ti.Android.SHOW_AS_ACTION_ALWAYS,
48 | actionView: searchView
49 | });
50 | };
51 |
--------------------------------------------------------------------------------
/app/controllers/index.js:
--------------------------------------------------------------------------------
1 | Alloy.Globals.windowStack = require('ti-window-stack').createWindowStack();
2 |
3 | Alloy.Globals.windowStack.open(Alloy.createController('home').getView(), $.drawer);
4 |
5 | // Drawer come from right or left
6 | var direction = Ti.Locale.currentLanguage === 'ar' ? 'Right' : 'Left';
7 |
8 | // set side menu view
9 | $.drawer['set' + direction + 'Window'](Alloy.createController('sidemenu').getView());
10 |
11 | // Add drawer to global for common use
12 | Alloy.Globals.drawer = $.drawer;
13 | $.drawer.addEventListener('close', function() {
14 | Alloy.Globals.drawer = null;
15 | });
16 |
17 | $.drawer.open();
18 |
--------------------------------------------------------------------------------
/app/controllers/page.js:
--------------------------------------------------------------------------------
1 | function openPage1() {
2 | Alloy.Globals.windowStack.open(Alloy.createController('page').getView());
3 | }
4 |
--------------------------------------------------------------------------------
/app/controllers/page1.js:
--------------------------------------------------------------------------------
1 | function openPage1() {
2 | Alloy.Globals.windowStack.open(Alloy.createController('page').getView());
3 | }
4 |
5 | $.page1.onCreateOptionsMenu = function(e) {
6 | // Clean up all items from any other controller
7 | e.menu.clear();
8 |
9 | // Add our items
10 | var menuItem = e.menu.add({
11 | title: "Button",
12 | showAsAction: Ti.Android.SHOW_AS_ACTION_ALWAYS
13 | });
14 | menuItem.addEventListener("click", function() {
15 | alert("Hey another button");
16 | });
17 | };
18 |
--------------------------------------------------------------------------------
/app/controllers/sidemenu.js:
--------------------------------------------------------------------------------
1 | var direction = Ti.Locale.currentLanguage === 'ar' ? 'Right' : 'Left';
2 |
3 | function onItemClick(e) {
4 | switch (e.itemIndex) {
5 | case 0:
6 | Alloy.Globals.windowStack.open(Alloy.createController('home').getView(), Alloy.Globals.drawer);
7 | break;
8 | case 1:
9 | Alloy.Globals.windowStack.open(Alloy.createController('page1').getView(), Alloy.Globals.drawer);
10 | break;
11 | case 3:
12 | Alloy.Globals.drawer.close();
13 | break;
14 | default:
15 | Alloy.Globals.windowStack.open(Alloy.createController('page').getView());
16 | }
17 |
18 | var fn = 'toggle' + direction + 'Window';
19 | Alloy.Globals.drawer[fn]();
20 | }
21 |
--------------------------------------------------------------------------------
/app/lib/xp.ui.js:
--------------------------------------------------------------------------------
1 | exports.createWindow = function(args) {
2 | return Ti.UI[OS_IOS ? 'createWindow' : 'createView'](args);
3 | };
4 |
--------------------------------------------------------------------------------
/app/styles/app.tss:
--------------------------------------------------------------------------------
1 | 'Label[platform=android,windows]' : {
2 | color: '#000'
3 | }
4 | 'Window' : {
5 | backgroundColor: '#fff'
6 | }
7 | 'TextField[platform=android]' : {
8 | height: Ti.UI.SIZE
9 | }
10 |
--------------------------------------------------------------------------------
/app/styles/index.tss:
--------------------------------------------------------------------------------
1 | '#drawer' : {
2 | openDrawerGestureMode: 'OPEN_MODE_ALL',
3 | closeDrawerGestureMode: 'CLOSE_MODE_MARGIN',
4 | leftDrawerWidth: 200,
5 | rightDrawerWidth: 200,
6 | // use DrawerLayout for Android
7 | drawerLayout: true
8 | }
9 |
--------------------------------------------------------------------------------
/app/styles/sidemenu.tss:
--------------------------------------------------------------------------------
1 | 'ListView' : {
2 | separatorColor: 'gray'
3 | }
4 | 'ListItem' : {
5 | height: 60,
6 | color: 'black',
7 | font: {
8 | fontSize: 20
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/app/views/home.xml:
--------------------------------------------------------------------------------
1 |
8 | Copyright 2014-2015 Fokke Zandbergen 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 |22 | -------------------------------------------------------------------------------- /app/widgets/nl.fokkezb.drawer/appc-npm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var path = require('path'); 4 | var fs = require('fs'); 5 | 6 | var pkg; 7 | 8 | try { 9 | pkg = JSON.parse(fs.readFileSync('package.json', { 10 | encoding: 'utf-8' 11 | })); 12 | } catch (e) { 13 | fail('Could not read package.json'); 14 | } 15 | 16 | var appcNPM = pkg['appc-npm']; 17 | 18 | if (typeof appcNPM !== 'object') { 19 | fail('Could not find \'appc-npm\' in package.json'); 20 | } 21 | 22 | var target = findTarget(__dirname); 23 | 24 | if (!target) { 25 | fail('Could not find project'); 26 | } 27 | 28 | var targetPath = (typeof appcNPM.target === 'object') ? appcNPM.target[target.name] : appcNPM.target; 29 | 30 | if (typeof targetPath !== 'string') { 31 | fail('Could not find \'appc-npm.target.' + target.name + '\' or \'appc-npm.target\' in package.json'); 32 | } 33 | 34 | var ignore = toArray(appcNPM.ignore); 35 | ignore.push('appc-npm'); 36 | 37 | copySync(__dirname, path.join(target.path, targetPath), function (fullPath) { 38 | var relPath = fullPath.substr(__dirname.length + 1); 39 | 40 | return ignore.indexOf(relPath) === -1; 41 | }); 42 | 43 | function findTarget(dir) { 44 | 45 | if (fs.existsSync(path.join(dir, 'appc.json'))) { 46 | return { 47 | name: 'arrow', 48 | path: dir 49 | }; 50 | } else if (fs.existsSync(path.join(dir, 'app', 'controllers', 'index.js'))) { 51 | return { 52 | name: 'alloy', 53 | path: dir 54 | }; 55 | } else if (fs.existsSync(path.join(dir, 'tiapp.xml'))) { 56 | return { 57 | name: 'titanium', 58 | path: dir 59 | }; 60 | } 61 | 62 | dirUp = path.resolve(dir, '..', '..'); 63 | 64 | if (!dirUp || dirUp === dir) { 65 | return; 66 | } 67 | 68 | return findTarget(dirUp); 69 | } 70 | 71 | function fail(err) { 72 | console.error(err); 73 | process.exit(1); 74 | } 75 | 76 | function toArray(val) { 77 | 78 | if (typeof val === 'string') { 79 | return [val]; 80 | } else if (Object.prototype.toString.call(val) === '[object Array]') { 81 | return val; 82 | } else { 83 | return []; 84 | } 85 | 86 | } 87 | 88 | /* jshint ignore:start */ 89 | 90 | // https://github.com/jprichardson/node-fs-extra/blob/master/lib/copy/copy-sync.js 91 | function copySync (src, dest, options) { 92 | if (typeof options === 'function' || options instanceof RegExp) { 93 | options = {filter: options} 94 | } 95 | 96 | options = options || {} 97 | options.recursive = !!options.recursive 98 | 99 | // default to true for now 100 | options.clobber = 'clobber' in options ? !!options.clobber : true 101 | 102 | options.filter = options.filter || function () { return true } 103 | 104 | var stats = options.recursive ? fs.lstatSync(src) : fs.statSync(src) 105 | var destFolder = path.dirname(dest) 106 | var destFolderExists = fs.existsSync(destFolder) 107 | var performCopy = false 108 | 109 | if (stats.isFile()) { 110 | if (options.filter instanceof RegExp) performCopy = options.filter.test(src) 111 | else if (typeof options.filter === 'function') performCopy = options.filter(src) 112 | 113 | if (performCopy) { 114 | if (!destFolderExists) mkdirsSync(destFolder) 115 | copyFileSync(src, dest, options.clobber) 116 | } 117 | } else if (stats.isDirectory()) { 118 | if (!fs.existsSync(dest)) mkdirsSync(dest) 119 | var contents = fs.readdirSync(src) 120 | contents.forEach(function (content) { 121 | copySync(path.join(src, content), path.join(dest, content), {filter: options.filter, recursive: true}) 122 | }) 123 | } else if (options.recursive && stats.isSymbolicLink()) { 124 | var srcPath = fs.readlinkSync(src) 125 | fs.symlinkSync(srcPath, dest) 126 | } 127 | } 128 | 129 | // https://github.com/jprichardson/node-fs-extra/blob/master/lib/copy/copy-file-sync.js 130 | function copyFileSync (srcFile, destFile, clobber) { 131 | 132 | if (fs.existsSync(destFile) && !clobber) { 133 | throw Error('EEXIST') 134 | } 135 | 136 | // simplified to work with vanilla fs 137 | fs.createReadStream(srcFile).pipe(fs.createWriteStream(destFile)); 138 | } 139 | 140 | // https://github.com/jprichardson/node-fs-extra/blob/master/lib/mkdirs/mkdirs.js 141 | var o777 = parseInt('0777', 8) 142 | 143 | function mkdirsSync (p, opts, made) { 144 | if (!opts || typeof opts !== 'object') { 145 | opts = { mode: opts } 146 | } 147 | 148 | var mode = opts.mode 149 | var xfs = opts.fs || fs 150 | 151 | if (mode === undefined) { 152 | mode = o777 & (~process.umask()) 153 | } 154 | if (!made) made = null 155 | 156 | p = path.resolve(p) 157 | 158 | try { 159 | xfs.mkdirSync(p)//, mode) 10 |
TODO: Enter your module description here
4 |To access this module from JavaScript, you would do the following:
6 |var nappslide = require("dk.napp.slidemenu");
7 |
8 | The nappslide variable is a reference to the Module object.
9 |TODO: If your module has an API, you should document 11 | the reference here.
12 |TODO: This is an example of a module function.
14 |TODO: This is an example of a module property.
16 |TODO: Enter your usage example here
18 |TODO: Enter your author name, email and other contact 20 | details you want to share here.
21 |TODO: Enter your license/legal information here.
-------------------------------------------------------------------------------- /modules/android/dk.napp.drawer/1.1.6/example/app.js: -------------------------------------------------------------------------------- 1 | 2 | var leftMenuView = Ti.UI.createView({ 3 | backgroundColor:'white', 4 | width: Ti.UI.FILL, 5 | height: Ti.UI.FILL 6 | }); 7 | 8 | var centerView = Ti.UI.createView({ 9 | backgroundColor:'white', 10 | width: Ti.UI.FILL, 11 | height: Ti.UI.FILL 12 | }); 13 | 14 | var rightMenuView = Ti.UI.createView({ 15 | backgroundColor:'#ddd', 16 | width: Ti.UI.FILL, 17 | height: Ti.UI.FILL 18 | }); 19 | 20 | 21 | // create a menu 22 | var leftTableView = Ti.UI.createTableView({ 23 | font:{fontSize:12}, 24 | rowHeight:40, 25 | data:[ 26 | {title:'Toggle Left View'}, 27 | {title:'Change Center Windowr'}, 28 | {title:'Default Window'} 29 | ] 30 | }); 31 | leftMenuView.add(leftTableView); 32 | leftTableView.addEventListener("click", function(e){ 33 | Ti.API.info("isAnyWindowOpen: " + drawer.isAnyWindowOpen()); 34 | switch(e.index){ 35 | case 0: 36 | drawer.toggleLeftWindow(); //animate back to center 37 | alert("You clicked " + e.rowData.title + ". Implement menu structure.. "); 38 | break; 39 | case 1: 40 | drawer.setCenterWindow(Ti.UI.createView({backgroundColor:"red"})); 41 | drawer.toggleLeftWindow(); //animate back to center 42 | break; 43 | case 2: 44 | drawer.setCenterWindow(centerView); 45 | drawer.toggleLeftWindow(); //animate back to center 46 | break; 47 | } 48 | }); 49 | 50 | 51 | // Action Bar - FAKE example 52 | var actionBar = Ti.UI.createView({ 53 | top:0, 54 | height:"44dp", 55 | backgroundColor:"#333" 56 | }); 57 | var leftToolbarBtn = Ti.UI.createButton({ 58 | title:"Left", 59 | left: "6dp", 60 | backgroundColor:"transparent", 61 | color: "#FFF" 62 | }); 63 | leftToolbarBtn.addEventListener("click", function(){ 64 | drawer.toggleLeftWindow(); 65 | }); 66 | var rightToolbarBtn = Ti.UI.createButton({ 67 | title:"Right", 68 | right: "6dp", 69 | backgroundColor:"transparent", 70 | color: "#FFF" 71 | }); 72 | rightToolbarBtn.addEventListener("click", function(){ 73 | drawer.toggleRightWindow(); 74 | }); 75 | var centerLabel = Ti.UI.createLabel({ 76 | text:"NappDrawer", 77 | font:{ 78 | fontSize:"14dp", 79 | fontWeight:"bold" 80 | }, 81 | color: "#FFF" 82 | }); 83 | actionBar.add(leftToolbarBtn); 84 | actionBar.add(rightToolbarBtn); 85 | actionBar.add(centerLabel); 86 | centerView.add(actionBar); 87 | 88 | 89 | 90 | // create interface 91 | var scrollView = Ti.UI.createScrollView({ 92 | layout:"vertical", 93 | left:0,right:0,top:"44dp", 94 | contentHeight:'auto', 95 | contentWidth:"100%", 96 | showVerticalScrollIndicator: true, 97 | showHorizontalScrollIndicator: false 98 | }); 99 | 100 | 101 | 102 | 103 | var slider = Ti.UI.createSlider({ 104 | top: "20dp", width: "280dp", 105 | min: 0, max: 1, 106 | value: 0.2 107 | }); 108 | var label = Ti.UI.createLabel({ 109 | text: "Parallax: " + slider.value, 110 | color:"#000", 111 | top: "15dp" 112 | }); 113 | slider.addEventListener('touchend', function(e) { 114 | label.setText("Parallax: " + e.source.value); 115 | drawer.setParallaxAmount(e.source.value); 116 | }); 117 | scrollView.add(label); 118 | scrollView.add(slider); 119 | 120 | var gestureModeBtn = Ti.UI.createButton({title:"Gesture Mode: ALL", toggled:true, top:10}); 121 | gestureModeBtn.addEventListener("click", function(e){ 122 | if(!e.source.toggled){ 123 | var mode = "ALL"; 124 | drawer.setOpenDrawerGestureMode(NappDrawerModule.OPEN_MODE_ALL); 125 | } else { 126 | var mode = "NONE"; 127 | drawer.setOpenDrawerGestureMode(NappDrawerModule.OPEN_MODE_NONE); 128 | } 129 | gestureModeBtn.setTitle("Gesture Mode: " + mode); 130 | e.source.toggled = !e.source.toggled; 131 | 132 | }); 133 | scrollView.add(gestureModeBtn); 134 | 135 | 136 | function updateSlider(value){ 137 | slider.value=value; 138 | slider.fireEvent("touchend", {source:{value:value}}); 139 | } 140 | 141 | // animation mode 142 | var animationMode = 0; 143 | var animationModeBtn = Ti.UI.createButton({ 144 | title:"Animation Mode: NONE", 145 | top:10 146 | }); 147 | var aniModeText; 148 | animationModeBtn.addEventListener("click", function(e){ 149 | if(animationMode == 3){ 150 | animationMode = 0; 151 | } else { 152 | animationMode++; 153 | } 154 | switch(animationMode){ 155 | case 0: 156 | drawer.setAnimationMode(NappDrawerModule.ANIMATION_NONE); 157 | updateSlider(0.2); 158 | aniModeText = "NONE"; 159 | break; 160 | case 1: 161 | drawer.setAnimationMode(NappDrawerModule.ANIMATION_SLIDEUP); 162 | updateSlider(0); 163 | aniModeText = "SLIDEUP"; 164 | break; 165 | case 2: 166 | drawer.setAnimationMode(NappDrawerModule.ANIMATION_ZOOM); 167 | updateSlider(0); 168 | aniModeText = "ZOOM"; 169 | break; 170 | case 3: 171 | drawer.setAnimationMode(NappDrawerModule.ANIMATION_SCALE); 172 | updateSlider(0); 173 | aniModeText = "SCALE"; 174 | break; 175 | } 176 | animationModeBtn.setTitle("Animation Mode: " + aniModeText); 177 | }); 178 | scrollView.add(animationModeBtn); 179 | 180 | centerView.add(scrollView); 181 | 182 | 183 | // CREATE THE MODULE 184 | var NappDrawerModule = require('dk.napp.drawer'); 185 | var drawer = NappDrawerModule.createDrawer({ 186 | fullscreen:false, 187 | leftWindow: leftMenuView, 188 | centerWindow: centerView, 189 | rightWindow: rightMenuView, 190 | fading: 0.2, // 0-1 191 | parallaxAmount: 0.2, //0-1 192 | shadowWidth:"40dp", 193 | leftDrawerWidth: "200dp", 194 | rightDrawerWidth: "200dp", 195 | animationMode: NappDrawerModule.ANIMATION_NONE, 196 | closeDrawerGestureMode: NappDrawerModule.CLOSE_MODE_MARGIN, 197 | openDrawerGestureMode: NappDrawerModule.OPEN_MODE_ALL, 198 | orientationModes: [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT] 199 | }); 200 | 201 | 202 | drawer.addEventListener("didChangeOffset", function(e){ 203 | //Ti.API.info("didChangeOffset: " + e.offset); 204 | }); 205 | 206 | drawer.addEventListener("windowDidOpen", function(e){ 207 | if(e.window == NappDrawerModule.LEFT_WINDOW) { 208 | Ti.API.info("windowDidOpen - LEFT DRAWER"); 209 | } else if (e.window == NappDrawerModule.RIGHT_WINDOW) { 210 | Ti.API.info("windowDidOpen - RIGHT DRAWER"); 211 | } 212 | }); 213 | drawer.addEventListener("windowDidClose", function(e){ 214 | Ti.API.info("windowDidClose"); 215 | }); 216 | 217 | 218 | // Action Bar - REAL example 219 | drawer.addEventListener('open', onNavDrawerWinOpen); 220 | function onNavDrawerWinOpen(evt) { 221 | this.removeEventListener('open', onNavDrawerWinOpen); 222 | 223 | if(this.getActivity()) { 224 | // need to explicitly use getXYZ methods 225 | var actionBar = this.getActivity().getActionBar(); 226 | 227 | if (actionBar) { 228 | // Now we can do stuff to the actionbar 229 | actionBar.setTitle('NappDrawer Example'); 230 | 231 | // show an angle bracket next to the home icon, 232 | // indicating to users that the home icon is tappable 233 | actionBar.setDisplayHomeAsUp(true); 234 | 235 | // toggle the left window when the home icon is selected 236 | actionBar.setOnHomeIconItemSelected(function() { 237 | drawer.toggleLeftWindow(); 238 | }); 239 | } 240 | } 241 | } 242 | 243 | 244 | // lets open it 245 | drawer.open(); 246 | -------------------------------------------------------------------------------- /modules/android/dk.napp.drawer/1.1.6/libs/armeabi-v7a/libdk.napp.drawer.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/modules/android/dk.napp.drawer/1.1.6/libs/armeabi-v7a/libdk.napp.drawer.so -------------------------------------------------------------------------------- /modules/android/dk.napp.drawer/1.1.6/libs/armeabi/libdk.napp.drawer.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/modules/android/dk.napp.drawer/1.1.6/libs/armeabi/libdk.napp.drawer.so -------------------------------------------------------------------------------- /modules/android/dk.napp.drawer/1.1.6/libs/x86/libdk.napp.drawer.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/modules/android/dk.napp.drawer/1.1.6/libs/x86/libdk.napp.drawer.so -------------------------------------------------------------------------------- /modules/android/dk.napp.drawer/1.1.6/manifest: -------------------------------------------------------------------------------- 1 | # 2 | # this is your module manifest and used by Titanium 3 | # during compilation, packaging, distribution, etc. 4 | # 5 | version: 1.1.6 6 | apiversion: 2 7 | description: Napp Drawer 8 | author: Mads Moller 9 | license: MIT 10 | copyright: Napp ApS 11 | architectures: armeabi armeabi-v7a x86 12 | 13 | # these should not be edited 14 | name: nappslide 15 | moduleid: dk.napp.drawer 16 | guid: 0f157d47-db5c-4891-8197-c851e8d329e0 17 | platform: android 18 | minsdk: 4.1.0.GA 19 | -------------------------------------------------------------------------------- /modules/android/dk.napp.drawer/1.1.6/nappslide.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/modules/android/dk.napp.drawer/1.1.6/nappslide.jar -------------------------------------------------------------------------------- /modules/android/dk.napp.drawer/1.1.6/platform/android/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 |The Napp Drawer module extends the Appcelerator Titanium Mobile framework. 4 | The module is licensed under the MIT license.
5 |Thanks to the folks at Mutual Mobile for their great work with MMDrawerController https://github.com/mutualmobile/MMDrawerController
6 |Find the newest version in the dist folder
8 |Simply add the following lines to your tiapp.xml
file:
<modules>
11 | <module platform="iphone">dk.napp.drawer</module>
12 | </modules>
13 |
14 | For more detailed code examples take a look into the example app
16 |Napp Drawer does not require you to use the 3 windows. You can also use either the combo of center/left or center/right for your desired needs.
18 |javascript
19 | var mainWindow = NappDrawerModule.createDrawer({
20 | centerWindow: navController,
21 | leftWindow: winLeft,
22 | rightWindow: winRight,
23 | closeDrawerGestureMode: NappDrawerModule.CLOSE_MODE_ALL,
24 | openDrawerGestureMode: NappDrawerModule.OPEN_MODE_ALL,
25 | leftDrawerWidth: 180,
26 | rightDrawerWidth: 220
27 | });
A method that allow change of a window. You can either use a window or a navigation group.
31 | javascript
32 | var newWin = Ti.UI.createWindow({
33 | backgroundColor: "#FF0000"
34 | };
35 | mainWindow.setCenterWindow(newWin);
Update the width with these methods. The default width is 280
javascript
39 | mainWindow.setLeftDrawerWidth(160);
Set different types of interactivity for the centerWindow.
42 |javascript
43 | mainWindow.setCenterHiddenInteractionMode(NappDrawerModule.OPEN_CENTER_MODE_FULL);
| input (constant) | Description | 45 | | ----- | ----------- | 46 | | OPEN_CENTER_MODE_NONE | The user can not interact with any content in the center view. | 47 | | OPEN_CENTER_MODE_FULL | The user can interact with all content in the center view. | 48 | | OPEN_CENTER_MODE_NAVBAR | The user can interact with only content on the navigation bar. The setting allows the menu button to still respond, allowing you to toggle the drawer closed when it is open. This is the default setting. |
49 |Set gesture support for opening the drawer through a mask.
51 |
javascript
53 | mainWindow.setOpenDrawerGestureMode(NappDrawerModule.OPEN_MODE_BEZEL_PANNING_CENTERWINDOW);
| input (constant) | Description | 55 | | ----- | ----------- | 56 | | OPEN_MODE_NONE | The user can not open the drawer by panning. | 57 | | OPEN_MODE_ALL | The user can open the drawer by panning anywhere. | 58 | | OPEN_MODE_PANNING_NAVBAR | The user can open the drawer by panning anywhere on the navigation bar. | 59 | | OPEN_MODE_PANNING_CENTERWINDOW | The user can open the drawer by panning anywhere on the center view. | 60 | | OPEN_MODE_BEZEL_PANNING_CENTERWINDOW | The user can open the drawer by starting a pan anywhere within 20 points of the bezel. |
61 |Set gesture support for closing the drawer through a mask.
63 |javascript
64 | mainWindow.setCloseDrawerGestureMode(NappDrawerModule.CLOSE_MODE_TAP_CENTERWINDOW);
| input (constant) | Description | 66 | | ----- | ----------- | 67 | | CLOSE_MODE_NONE | The user cannot close the drawer by any panning gestures. | 68 | | CLOSE_MODE_ALL | The user can close the drawer by panning anywhere. | 69 | | CLOSE_MODE_PANNING_NAVBAR | The user can close the drawer by panning anywhere on the navigation bar. | 70 | | CLOSE_MODE_PANNING_CENTERWINDOW | The user can close the drawer by panning anywhere on the center view. | 71 | | CLOSE_MODE_BEZEL_PANNING_CENTERWINDOW | The user can close the drawer by starting a pan anywhere within the bezel of the center view. | 72 | | CLOSE_MODE_TAP_NAVBAR | The user can close the drawer by tapping the navigation bar. | 73 | | CLOSE_MODE_TAP_CENTERWINDOW | The user can close the drawer by tapping the center view. | 74 | | CLOSE_MODE_PANNING_DRAWER | The user can close the drawer by panning anywhere on the drawer view. |
75 |Note that these gestures may impact touches sent to the child view controllers, so be sure to use these appropriately for your application.
76 |The animation velocity of the open and close methods, measured in points per second.
78 | By default, this is set to 840 points per second (three times the default drawer width), meaning it takes 1/3 of a second for the Window
to open/close across the default drawer width. Note that there is a minimum .1 second duration for built in animations, to account for small distance animations.
javascript
80 | mainWindow.setAnimationVelocity(400);
Should the shadow be visible?
83 |javascript
84 | mainWindow.setShowShadow(true);
A small effect when the drawer is dragged, the drawer stretches.
87 |javascript
88 | mainWindow.setShouldStretchDrawer(true);
toggleLeftWindow()
and toggleRightWindow()
are used to toggle each visibility of either the left or right window.
javascript
93 | mainWindow.toggleLeftWindow();
A small animation to show the app user that its possible to interact with the drawer.
96 |javascript
97 | mainWindow.bounceLeftWindow();
Mads Moller
106 | web: http://www.napp.dk
107 | email: mm@napp.dk
108 | twitter: @nappdev
109 |
Copyright (c) 2010-2013 Mads Moller
112 |
113 | Permission is hereby granted, free of charge, to any person obtaining a copy
114 | of this software and associated documentation files (the "Software"), to deal
115 | in the Software without restriction, including without limitation the rights
116 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
117 | copies of the Software, and to permit persons to whom the Software is
118 | furnished to do so, subject to the following conditions:
119 |
120 | The above copyright notice and this permission notice shall be included in
121 | all copies or substantial portions of the Software.
122 |
123 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
124 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
125 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
126 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
127 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
128 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
129 | THE SOFTWARE.
130 |
--------------------------------------------------------------------------------
/modules/iphone/dk.napp.drawer/1.2.3/libdk.napp.drawer.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/modules/iphone/dk.napp.drawer/1.2.3/libdk.napp.drawer.a
--------------------------------------------------------------------------------
/modules/iphone/dk.napp.drawer/1.2.3/manifest:
--------------------------------------------------------------------------------
1 | #
2 | # this is your module manifest and used by Titanium
3 | # during compilation, packaging, distribution, etc.
4 | #
5 | version: 1.2.3
6 | apiversion: 2
7 | architectures: armv7 i386 x86_64 arm64
8 | description: Drawer controller
9 | author: Mads Møller
10 | license: MIT
11 | copyright: Napp ApS
12 |
13 |
14 | # these should not be edited
15 | name: NappDrawer
16 | moduleid: dk.napp.drawer
17 | guid: 2a446559-1d59-4808-aefc-7d02d3130ebb
18 | platform: iphone
19 | minsdk: 3.4.1.GA
20 |
--------------------------------------------------------------------------------
/modules/iphone/dk.napp.drawer/1.2.3/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 | OTHER_LDFLAGS=$(inherited) -framework QuartzCore
--------------------------------------------------------------------------------
/plugins/ti.alloy/hooks/alloy.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Alloy
3 | * Copyright (c) 2012 by Appcelerator, Inc. All Rights Reserved.
4 | * See LICENSE for more information on licensing.
5 | */
6 |
7 | exports.cliVersion = '>=3.X';
8 | exports.version = '1.0.0';
9 | var SILENT = true;
10 |
11 | exports.init = function (logger, config, cli, appc) {
12 | var path = require('path'),
13 | fs = require('fs'),
14 | afs = appc.fs,
15 | i18n = appc.i18n(__dirname),
16 | __ = i18n.__,
17 | __n = i18n.__n,
18 | pkginfo = appc.pkginfo.package(module),
19 | exec = require('child_process').exec,
20 | spawn = require('child_process').spawn,
21 | parallel = appc.async.parallel;
22 |
23 | if(!process.env.sdk) {
24 | process.env.sdk = cli.sdk.name;
25 | }
26 |
27 | function run(deviceFamily, deployType, target, finished, silent) {
28 | var appDir = path.join(cli.argv['project-dir'], 'app');
29 | if (!afs.exists(appDir)) {
30 | logger.info(__('Project not an Alloy app, continuing'));
31 | finished();
32 | return;
33 | }
34 | logger.info(__('Found Alloy app in %s', appDir.cyan));
35 |
36 | // TODO: Make this check specific to a TiSDK version
37 | // create a .alloynewcli file to tell old plugins not to run
38 | var buildDir = path.join(cli.argv['project-dir'], 'build');
39 | if (!afs.exists(buildDir)) {
40 | fs.mkdirSync(buildDir);
41 | }
42 | fs.writeFileSync(path.join(buildDir, '.alloynewcli'), '');
43 |
44 | var cRequire = afs.resolvePath(__dirname, '..', 'Alloy', 'commands', 'compile', 'index.js'),
45 | config = {
46 | platform: /(?:iphone|ipad)/.test(cli.argv.platform) ? 'ios' : cli.argv.platform,
47 | version: '0',
48 | simtype: 'none',
49 | devicefamily: /(?:iphone|ios)/.test(cli.argv.platform) ? deviceFamily : 'none',
50 | deploytype: deployType || cli.argv['deploy-type'] || 'development',
51 | target: target
52 | };
53 | if(silent) {
54 | // turn off all logging output for code analyzer build hook
55 | config.noBanner = 'true';
56 | config.logLevel = '-1';
57 | }
58 |
59 | config = Object.keys(config).map(function (c) {
60 | return c + '=' + config[c];
61 | }).join(',');
62 |
63 | if (afs.exists(cRequire)) {
64 | // we're being invoked from the actual alloy directory!
65 | // no need to subprocess, just require() and run
66 | var origLimit = Error.stackTraceLimit;
67 | Error.stackTraceLimit = Infinity;
68 | try {
69 | require(cRequire)({}, {
70 | config: config,
71 | outputPath: cli.argv['project-dir'],
72 | _version: pkginfo.version
73 | });
74 | } catch (e) {
75 | logger.error(__('Alloy compiler failed'));
76 | e.toString().split('\n').forEach(function (line) {
77 | if (line) { logger.error(line); }
78 | });
79 | process.exit(1);
80 | }
81 | Error.stackTraceLimit = origLimit;
82 | finished();
83 | } else {
84 | // we have no clue where alloy is installed, so we're going to subprocess
85 | // alloy and hope it's in the system path or a well known place
86 | var paths = {};
87 | var locatorCmd = process.platform === 'win32' ? 'where' : 'which';
88 | parallel(this, ['alloy', 'node'].map(function (bin) {
89 | return function (done) {
90 | var envName = 'ALLOY_' + (bin === 'node' ? 'NODE_' : '') + 'PATH';
91 |
92 | paths[bin] = process.env[envName];
93 | if (paths[bin]) {
94 | done();
95 | } else if (process.platform === 'win32' && bin === 'alloy') {
96 | paths.alloy = 'alloy.cmd';
97 | done();
98 | } else {
99 | exec(locatorCmd + ' ' + bin, function (err, stdout, strerr) {
100 | if (!err) {
101 | paths[bin] = stdout.trim();
102 | done();
103 | } else {
104 | parallel(this, [
105 | '/usr/local/bin/' + bin,
106 | '/opt/local/bin/' + bin,
107 | path.join(process.env.HOME, 'local/bin', bin),
108 | '/opt/bin/' + bin,
109 | '/usr/bin/' + bin
110 | ].map(function (p) {
111 | return function (cb) {
112 | if (afs.exists(p)) { paths[bin] = p; }
113 | cb();
114 | };
115 | }), done);
116 | }
117 | });
118 | }
119 | };
120 | }), function () {
121 |
122 | // compose alloy command execution
123 | var cmd = [paths.node, paths.alloy, 'compile', appDir, '--config', config];
124 | if (cli.argv['no-colors'] || cli.argv['color'] === false) { cmd.push('--no-colors'); }
125 |
126 | // process each line of output from alloy
127 | function checkLine(line) {
128 | var re = new RegExp(
129 | '(?:\u001b\\[\\d+m)?\\[?(' +
130 | logger.getLevels().join('|') +
131 | ')\\]?\s*(?:\u001b\\[\\d+m)?(.*)', 'i'
132 | );
133 | if (line) {
134 | var m = line.match(re);
135 | if (m) {
136 | logger[m[1].toLowerCase()](m[2].trim());
137 | } else {
138 | logger.debug(line);
139 | }
140 | }
141 | }
142 |
143 | // execute alloy in os-specific manner
144 | var child;
145 | if (process.platform === 'win32' && paths.alloy === 'alloy.cmd') {
146 | cmd.shift();
147 | logger.info(__('Executing Alloy compile: %s',
148 | ['cmd','/s','/c'].concat(cmd).join(' ').cyan));
149 |
150 | // arg processing from https://github.com/MarcDiethelm/superspawn
151 | child = spawn('cmd', [['/s', '/c', '"' +
152 | cmd.map(function(a) {
153 | if (/^[^"].* .*[^"]/.test(a)) return '"'+a+'"'; return a;
154 | }).join(" ") + '"'].join(" ")], {
155 | stdio: 'inherit',
156 | windowsVerbatimArguments: true
157 | }
158 | );
159 | } else {
160 | logger.info(__('Executing Alloy compile: %s', cmd.join(' ').cyan));
161 | child = spawn(cmd.shift(), cmd);
162 | child.stdout.on('data', function (data) {
163 | data.toString().split('\n').forEach(checkLine);
164 | });
165 | child.stderr.on('data', function (data) {
166 | data.toString().split('\n').forEach(checkLine);
167 | });
168 | }
169 |
170 | // handle the completion of alloy, success or otherwise
171 | child.on('exit', function (code) {
172 | if (code) {
173 | logger.error(__('Alloy compiler failed'));
174 | process.exit(1);
175 | } else {
176 | logger.info(__('Alloy compiler completed successfully'));
177 |
178 | afs.exists(path.join(cli.argv["project-dir"], 'build', 'i18n')) && process.argv.push('--i18n-dir', 'build');
179 | afs.exists(path.join(cli.argv["project-dir"], 'build', 'platform')) && (cli.argv['platform-dir'] = 'build/platform');
180 | }
181 | finished();
182 | });
183 |
184 | });
185 | }
186 | }
187 |
188 | cli.addHook('build.pre.compile', function (build, finished) {
189 | var deployType = build.deployType,
190 | target = build.target;
191 |
192 | run(build.deviceFamily, deployType, target, finished);
193 | });
194 |
195 | cli.addHook('codeprocessor.pre.run', function (build, finished) {
196 | run('none', 'development', undefined, finished, SILENT);
197 | });
198 | };
199 |
--------------------------------------------------------------------------------
/plugins/ti.alloy/hooks/deepclean.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Alloy
3 | * Copyright (c) 2014 by Appcelerator, Inc. All Rights Reserved.
4 | * See LICENSE for more information on licensing.
5 | */
6 |
7 | exports.cliVersion = '>=3.X';
8 | var SILENT = true;
9 |
10 | exports.init = function (logger, config, cli, appc) {
11 | var path = require('path'),
12 | fs = require('fs'),
13 | afs = appc.fs;
14 |
15 | function run() {
16 | if(cli.argv['shallow'] === '') {
17 | logger.info('Not cleaning the Resources directory');
18 | return;
19 | }
20 | var appDir = path.join(cli.argv['project-dir'], 'app');
21 | if (!afs.exists(appDir)) {
22 | logger.debug('Project not an Alloy app, exiting.');
23 | finished();
24 | return;
25 | }
26 |
27 | var resourcesDir = path.join(cli.argv['project-dir'], 'Resources');
28 | if (!afs.exists(resourcesDir)) {
29 | logger.debug('Resources directory does not exist.');
30 | return;
31 | }
32 | rmdir(resourcesDir, fs, path, logger);
33 | logger.debug('Resources directory of %s has been emptied', appDir.cyan);
34 | }
35 |
36 | cli.addHook('clean.post', function (build, finished) {
37 | run();
38 | });
39 |
40 | };
41 |
42 | function rmdir(dirPath, fs, path, logger, removeSelf) {
43 | var files;
44 | try {
45 | files = fs.readdirSync(dirPath);
46 | }
47 | catch(e) {
48 | return;
49 | }
50 | if (files.length > 0) {
51 | for (var i = 0; i < files.length; i++) {
52 | var filePath = path.join(dirPath, files[i]);
53 | if (fs.statSync(filePath).isFile()) {
54 | fs.unlinkSync(filePath);
55 | } else {
56 | rmdir(filePath, fs, path, logger, true);
57 | }
58 | }
59 | }
60 | if (removeSelf) {
61 | fs.rmdirSync(dirPath);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/plugins/ti.alloy/plugin.py:
--------------------------------------------------------------------------------
1 | import os, sys, subprocess, hashlib
2 |
3 | import subprocess
4 |
5 | def check_output(*popenargs, **kwargs):
6 | r"""Run command with arguments and return its output as a byte string.
7 |
8 | Backported from Python 2.7 as it's implemented as pure python on stdlib.
9 |
10 | >>> check_output(['/usr/bin/python', '--version'])
11 | Python 2.6.2
12 | """
13 | process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
14 | output, unused_err = process.communicate()
15 | retcode = process.poll()
16 | if retcode:
17 | cmd = kwargs.get("args")
18 | if cmd is None:
19 | cmd = popenargs[0]
20 | error = subprocess.CalledProcessError(retcode, cmd)
21 | error.output = output
22 | raise error
23 | return output
24 |
25 | def compile(config):
26 | paths = {}
27 | binaries = ["alloy","node"]
28 |
29 | dotAlloy = os.path.abspath(os.path.join(config['project_dir'], 'build', '.alloynewcli'))
30 | if os.path.exists(dotAlloy):
31 | print "[DEBUG] build/.alloynewcli file found, skipping plugin..."
32 | os.remove(dotAlloy)
33 | else:
34 | for binary in binaries:
35 | try:
36 | # see if the environment variable is defined
37 | paths[binary] = os.environ["ALLOY_" + ("NODE_" if binary == "node" else "") + "PATH"]
38 | except KeyError as ex:
39 | # next try PATH, and then our guess paths
40 | if sys.platform == "darwin" or sys.platform.startswith('linux'):
41 | userPath = os.environ["HOME"]
42 | guessPaths = [
43 | "/usr/local/bin/"+binary,
44 | "/opt/local/bin/"+binary,
45 | userPath+"/local/bin/"+binary,
46 | "/opt/bin/"+binary,
47 | "/usr/bin/"+binary,
48 | "/usr/local/share/npm/bin/"+binary
49 | ]
50 |
51 | try:
52 | binaryPath = check_output(["which",binary], stderr=subprocess.STDOUT).strip()
53 | print "[DEBUG] %s installed at '%s'" % (binary,binaryPath)
54 | except:
55 | print "[WARN] Couldn't find %s on your PATH:" % binary
56 | print "[WARN] %s" % os.environ["PATH"]
57 | print "[WARN]"
58 | print "[WARN] Checking for %s in a few default locations:" % binary
59 | for p in guessPaths:
60 | sys.stdout.write("[WARN] %s -> " % p)
61 | if os.path.exists(p):
62 | binaryPath = p
63 | print "FOUND"
64 | break
65 | else:
66 | print "not found"
67 | binaryPath = None
68 |
69 | if binaryPath is None:
70 | print "[ERROR] Couldn't find %s" % binary
71 | sys.exit(1)
72 | else:
73 | paths[binary] = binaryPath
74 |
75 | # no guesses on windows, just use the PATH
76 | elif sys.platform == "win32":
77 | paths["alloy"] = "alloy.cmd"
78 |
79 | f = os.path.abspath(os.path.join(config['project_dir'], 'app'))
80 | if os.path.exists(f):
81 | print "[INFO] alloy app found at %s" % f
82 | rd = os.path.abspath(os.path.join(config['project_dir'], 'Resources'))
83 |
84 | devicefamily = 'none'
85 | simtype = 'none'
86 | version = '0'
87 | deploytype = 'development'
88 |
89 | if config['platform']==u'ios':
90 | version = config['iphone_version']
91 | devicefamily = config['devicefamily']
92 | deploytype = config['deploytype']
93 | if config['platform']==u'android':
94 | builder = config['android_builder']
95 | version = builder.tool_api_level
96 | deploytype = config['deploy_type']
97 | if config['platform']==u'mobileweb':
98 | builder = config['mobileweb_builder']
99 | deploytype = config['deploytype']
100 |
101 | cfg = "platform=%s,version=%s,simtype=%s,devicefamily=%s,deploytype=%s," % (config['platform'],version,simtype,devicefamily,deploytype)
102 |
103 | if sys.platform == "win32":
104 | cmd = [paths["alloy"], "compile", f, "--no-colors", "--config", cfg]
105 | else:
106 | cmd = [paths["node"], paths["alloy"], "compile", f, "--no-colors", "--config", cfg]
107 |
108 | print "[INFO] Executing Alloy compile:"
109 | print "[INFO] %s" % " ".join(cmd)
110 |
111 | try:
112 | print check_output(cmd, stderr=subprocess.STDOUT)
113 | except subprocess.CalledProcessError as ex:
114 | if hasattr(ex, 'output'):
115 | print ex.output
116 | print "[ERROR] Alloy compile failed"
117 | retcode = 1
118 | if hasattr(ex, 'returncode'):
119 | retcode = ex.returncode
120 | sys.exit(retcode)
121 | except EnvironmentError as ex:
122 | print "[ERROR] Unexpected error with Alloy compiler plugin: %s" % ex.strerror
123 | sys.exit(2)
124 |
--------------------------------------------------------------------------------
/screens/android.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/screens/android.gif
--------------------------------------------------------------------------------
/screens/iphone.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HazemKhaled/SideMenu-with-NavigationWindow-for-Titanium/8da42a2381e65f43b00571bb0099d16716472fe9/screens/iphone.gif
--------------------------------------------------------------------------------
/tiapp.xml:
--------------------------------------------------------------------------------
1 |