View SVGProduct.js
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
// app/lib/SVGProduct.js | |
function getImageFileFromSVG(svgOpts, name) { | |
var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationCacheDirectory, | |
Ti.Utils.md5HexDigest(JSON.stringify(svgOpts))); | |
if (!file.exists()) { | |
var SVG = require('com.geraudbourdin.svgview'); | |
if (!file.write(SVG.createView(svgOpts).toImage())) { | |
Ti.API.error("Can't save to file. Product:", name); | |
return null; |
View index.js
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
$.getView().backgroundImage = getImageFileFromSVG({ | |
image : "/images/hearts.svg", | |
width : 400, | |
height : 400, | |
top : 0, | |
left : 0 | |
}); | |
function getImageFileFromSVG(svgOpts) { | |
var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationCacheDirectory, |
View alloy.js
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
require('uiModules') |
View momentLang.js
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 moment = require('alloy/moment'); | |
// First add languages that support your application | |
var languages = ['ru', 'nl', 'fr', 'fr-ca']; | |
// Full language list: https://github.com/appcelerator/alloy/tree/master/Alloy/builtins/moment/lang | |
// You must explicit way to require language files in order to compiler saw their. | |
require('alloy/moment/lang/ru'); | |
require('alloy/moment/lang/nl'); | |
require('alloy/moment/lang/fr'); |
View alloy.js
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
Alloy.Globals.Android = Alloy.Globals.Android || {}; | |
_.extend(Alloy.Globals.Android.VERSION_CODES, { | |
CUR_DEVELOPMENT: 10000, | |
BASE: 1, | |
BASE_1_1: 2, | |
CUPCAKE: 3, | |
DONUT: 4, | |
ECLAIR: 5, | |
ECLAIR_0_1: 6, | |
ECLAIR_MR1: 7, |
View demo.js
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 args = arguments[0] || {};var url = "https://api.github.com/search/repositories?q=pushed:>2015-09-01&order=desc"; | |
var page = 1, | |
loading = false; | |
function init() { | |
$.activityIndicator.show(); | |
load(function(items) { | |
$.list.setItems(transform(items)); | |
$.activityIndicator.hide(); |
View index.js
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
function doClick(e) { | |
Alloy.createController("test").getView().open(); | |
} | |
$.index.open(); |
View base.js
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
exports.setMenuItemEnabled = function(menuItem, isEnabled) { | |
if(OS_ANDROID) { | |
if(Alloy.Globals.isAndroid3Plus && menuItem.actionView) { | |
menuItem.actionView.touchEnabled = isEnabled; | |
} | |
menuItem.setEnabled(isEnabled); | |
} | |
}; |