-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
102 changed files
with
9,760 additions
and
601 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,10 @@ | ||
ui/test/app | ||
.DS_Store | ||
Resources | ||
build.log | ||
build | ||
npm-debug.log | ||
tmp | ||
.map | ||
.project | ||
.settings | ||
Thumbs.db |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// The contents of this file will be executed before any of | ||
// your view controllers are ever executed, including the index. | ||
// You have access to all functionality on the `Alloy` namespace. | ||
// | ||
// This is a great place to do any initialization for your app | ||
// or create any global variables/functions that you'd like to | ||
// make available throughout your app. You can easily make things | ||
// accessible globally by attaching them to the `Alloy.Globals` | ||
// object. For example: | ||
// | ||
// Alloy.Globals.someGlobalFunction = function(){}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"global": {}, | ||
"env:development": {}, | ||
"env:test": {}, | ||
"env:production": {}, | ||
"os:android": {}, | ||
"os:ios": {}, | ||
"os:mobileweb": {}, | ||
"os:windows": {}, | ||
"dependencies": {} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
var gate = require('gate'); | ||
|
||
(function constructor(args) { | ||
|
||
showStatus(); | ||
|
||
// Optionally override settings | ||
gate.locked = true; // Lock/Unlock gate | ||
gate.from = 1; // Minimum for random 'x' | ||
gate.to = 10; // Maximum for random 'y' | ||
|
||
// Optionally override texts (also via i18n) | ||
gate.title = 'Checking your IQ'; // gate_title | ||
gate.message = 'How much is %s ?'; // gate_message | ||
gate.button = 'Try'; // gate_button | ||
gate.error_title = 'You failed big time!'; // gate_error_title | ||
gate.error_message = 'No, you stupid! It was %s !'; // gate_error_message | ||
gate.error_button = 'OK'; // gate_error_button | ||
|
||
})(arguments[0] || {}); | ||
|
||
function onKeeperClick() { | ||
|
||
gate.keeper(function (success) { | ||
|
||
// Returns TRUE if the gate was unlocked or question was answered OK | ||
if (success) { | ||
alert('This alert is something for adults only.'); | ||
} | ||
|
||
// On FALSE an error dialog will be shown | ||
// No further action needed in most cases | ||
}); | ||
|
||
} | ||
|
||
function onToggleClick() { | ||
|
||
gate.toggle(function (locked) { | ||
// Returns TRUE if gate is now locked | ||
// Presents question only to unlock, not to lock | ||
|
||
showStatus(locked); | ||
}); | ||
} | ||
|
||
function showStatus(locked) { | ||
|
||
if (arguments.length === 0) { | ||
locked = gate.locked; | ||
} | ||
|
||
$.statusLabel.text = locked ? 'Locked' : 'Unlocked'; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var image = require('image'); | ||
|
||
(function constructor(args) {})(arguments[0] || {}); | ||
|
||
function onSelectClick() { | ||
|
||
image.select(function (err, media) { | ||
|
||
if (err) { | ||
return alert(err); | ||
} | ||
|
||
var dp = $.imageView.rect; | ||
|
||
$.imageView.image = image.crop(media, dp); | ||
|
||
var px = image.dpToPixels(dp); | ||
|
||
Ti.UI.createAlertDialog({ | ||
title: 'ImageView in DP: ' + dp.width + 'x' + dp.height, | ||
message: 'Image in PX: ' + px.width + 'x' + px.height | ||
}).show(); | ||
}); | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function doClick(e) { | ||
alert($.label.text); | ||
} | ||
|
||
$.index.open(); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
(function constructor(args) { | ||
|
||
$.singleBtn.addEventListenerSingle(onSingleClick); | ||
$.onceBtn.addEventListenerOnce('click', onOnceClick); | ||
|
||
})(arguments[0] || {}); | ||
|
||
function onSingleClick(e) { | ||
alert('I will now block for a while'); | ||
|
||
for (var i = 0; i < 1000000; i++) { | ||
Ti.Platform.createUUID(); | ||
} | ||
|
||
alert('You can now click me again'); | ||
} | ||
|
||
function onOnceClick(e) { | ||
alert('You can not click me again'); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(function constructor(args) {})(arguments[0] || {}); |
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
var logicalDensityFactor; | ||
|
||
exports.crop = crop; | ||
exports.dpToPixels = dpToPixels; | ||
exports.select = select; | ||
|
||
function crop(blob, options, height) { | ||
|
||
if (typeof options !== 'object') { | ||
options = { | ||
width: options, | ||
height: height | ||
} | ||
} | ||
|
||
if (!blob.width || !blob.width) { | ||
return blob; | ||
} | ||
|
||
// https://jira.appcelerator.org/browse/TIMOB-4865 | ||
if (options.fix !== false) { | ||
blob = blob.imageAsResized(blob.width, blob.height); | ||
} | ||
|
||
if (options.hires !== false) { | ||
options = dpToPixels(options); | ||
} | ||
|
||
if (options.width && options.height) { | ||
var blob_ratio = blob.width / blob.height; | ||
var ratio = options.width / options.height; | ||
|
||
if (blob_ratio !== ratio) { | ||
|
||
// Cut left and right | ||
if (blob_ratio > ratio) { | ||
blob = blob.imageAsCropped({ | ||
width: Math.round(blob.height * ratio), | ||
}); | ||
} | ||
|
||
// Cut top and bottom | ||
else { | ||
blob = blob.imageAsCropped({ | ||
height: Math.round(blob.width / ratio) | ||
}); | ||
} | ||
} | ||
|
||
if (blob.width !== options.width || blob.height !== options.height) { | ||
blob = blob.imageAsResized(options.width, options.height); | ||
} | ||
|
||
return blob | ||
|
||
} else { | ||
return blob.imageAsCropped(options); | ||
} | ||
} | ||
|
||
function dpToPixels(dimension) { | ||
|
||
if (!logicalDensityFactor) { | ||
logicalDensityFactor = Ti.Platform.displayCaps.logicalDensityFactor; | ||
} | ||
|
||
if (typeof dimension === 'number') { | ||
return dimension * logicalDensityFactor; | ||
} | ||
|
||
if (dimension.width) { | ||
dimension.width = dimension.width * logicalDensityFactor; | ||
} | ||
|
||
if (dimension.height) { | ||
dimension.height = dimension.height * logicalDensityFactor; | ||
} | ||
|
||
return dimension; | ||
} | ||
|
||
function select(opts, callback) { | ||
|
||
if (arguments.length === 1) { | ||
callback = opts; | ||
opts = {}; | ||
} | ||
|
||
if (!Ti.Media.isCameraSupported) { | ||
return _select('openPhotoGallery', opts, callback); | ||
} | ||
|
||
var dialog = Ti.UI.createOptionDialog({ | ||
options: [L('image_select_camera'), L('image_select_gallery'), L('cancel')], | ||
cancel: 2 | ||
}); | ||
|
||
dialog.addEventListener('click', function (e) { | ||
|
||
if (e.index === 0) { | ||
_select('showCamera', opts, _callback); | ||
} else if (e.index === 1) { | ||
_select('openPhotoGallery', opts, _callback); | ||
} | ||
}); | ||
|
||
dialog.show(); | ||
} | ||
|
||
function _select(fn, opts, callback) { | ||
|
||
if (arguments.length === 2 && _.isFunction(opts)) { | ||
callback = opts; | ||
opts = {}; | ||
} | ||
|
||
var defaults = { | ||
mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO] | ||
}; | ||
|
||
if (callback) { | ||
defaults.success = function (e) { | ||
callback(null, e.media); | ||
}; | ||
defaults.error = function (e) { | ||
callback(e.error); | ||
}; | ||
} | ||
|
||
opts = _.defaults(opts || {}, defaults); | ||
|
||
Ti.Media[fn](opts); | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.