Exploring how it could be used to have a more iOS-autolayout-like layout system on Titanium.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Use this function to make calls to a JSON REST API see demo.js for useage | |
@param options | |
@param end (Callback) | |
**/ | |
exports.api = function(options, end) { | |
//This function makes calls to an Endpoint and then sends the data back via callback to the function that requested it. | |
//Alloy.CFG.conn_url is set in your config.json file and can be accessed depending on which environment you are using. | |
var method = options.method, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var loopback = require('loopback'); | |
module.exports = function(SampleModel) { | |
// Returns null if the access token is not valid | |
function getCurrentUserId() { | |
var ctx = loopback.getCurrentContext(); | |
var accessToken = ctx && ctx.get('accessToken'); | |
var userId = accessToken && accessToken.userId; | |
return userId; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// just a quick n dirty test. See result: http://monosnap.com/file/wT6dJZ4zOrHzjiXi1mhfnIocEZiAWW | |
var headerView = Ti.UI.createView({ | |
backgroundColor:'#fff', | |
height:80, | |
layout:'horizontal' | |
}); | |
headerView.add(Ti.UI.createButton({title:'$100',left:20,top:13,height:50,width:80,backgroundColor:'#ca3943',borderRadius:4,color:'#fff'})); | |
headerView.add(Ti.UI.createButton({title:'$500',left:20,top:13,height:50,width:80,backgroundColor:'#ca3943',borderRadius:4,color:'#fff'})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create a file in your lib folder, like **rootproject**/lib/routes.map.js | |
load the module in your file and initialize with the data: | |
var jsonCoordinates = { | |
'destination': dest.latitude + ',' + dest.longitude, | |
'origin': origin.latitude + ',' + origin.longitude, | |
}; | |
var routes = require("routes.map")(jsonCoordinates, mapview); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# | |
# cocos2d-x-icon-generator.py | |
# created by giginet on 2014/02/27 | |
# | |
import sys | |
from PIL import Image | |
SIZES = ( | |
(29, 29), | |
(40, 40), |
This guide has been updated for Titanium SDK 3.3.0 which uses AppCompat to bring the ActionBar to Android 2.3.x
Android has a build-in theming system. Using this feature you can easily change the base color Android uses for its controls across your app, allowing you to provide better branding and personalization, while maintaining Android's UI and UX.
Android built-in themes are:
- Holo (Mostly Black and Cyan)
- Holo Light (Mostly White and Gray)
When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.
-
Raw Attribute Strings
<div my-directive="some string" another-param="another string"></div>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The ADB excecutable lives in: | |
[path-to-android-sdk]/platform-tools/ | |
./adb -e logcat | grep TiAPI | |
or | |
./adb -d logcat | grep TiAPI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rootWin = Ti.UI.createWindow(); | |
var navGroup = Ti.UI.iPhone.createNavigationGroup({ | |
window: rootWin | |
}); | |
var button = Ti.UI.createButton({ | |
title: 'Open ListView Tests' | |
}); | |
button.addEventListener('click', function() { | |
openTestsWindow(); | |
}); |