Skip to content

Instantly share code, notes, and snippets.

View egomez99's full-sized avatar

Eduardo Gomez egomez99

  • Automation Testing
  • Guadalajara, Mexico.
  • 11:30 (UTC -06:00)
View GitHub Profile
@egomez99
egomez99 / app.js
Created June 27, 2013 20:45
TIMOB-2433 Android: OptionMenu MenuItem's click callbacks don't persist w/ tabbed window switching
Ti.API.info("@ win_test.js");
var win = Ti.UI.createWindow();
win.backgroundColor = "#b5aea5";
win.open();
var button = Ti.UI.createButton({
title: 'new window'
});
button.addEventListener('click', function(e) {
var subwin = Ti.UI.createWindow({url: 'main.js', navBarHidden: 'true'});
@egomez99
egomez99 / app.js
Created June 10, 2013 23:18
Scroll View as a Table View Create a scroll view that contains a set of views in a layout to resemble a table view with rows. NOTE: This approach may mitigate the native behavior of nesting 2 scrollable items but performance issues might come into play!
var win = Ti.UI.createWindow({
backgroundColor : 'white',
layout : "vertical"
});
function createRow(i) {
var row = Ti.UI.createView({
height: 45,
width: Ti.UI.SIZE,
top: 0, left: 0,
@egomez99
egomez99 / app.js
Last active December 15, 2015 16:19
Expand-Collapse functionality
var win = Ti.UI.createWindow({
height : Ti.UI.FILL,
width : Ti.UI.FILL,
backgroundColor : '#fff',
windowSoftInputMode: (Ti.UI.Android) ? Ti.UI.Android.SOFT_INPUT_ADJUST_PAN : ''
});
var tableView = Ti.UI.createTableView({
width : Ti.UI.FILL,
height : Ti.UI.FILL,
@egomez99
egomez99 / app.js
Created March 22, 2013 18:11
App sample: Requires Crittercism module (v1.0.1) it was made to test try{}catch{} blocks and handledExceptions can report what are file name and line of code to narrow down an app crash e.g. crittercism.logHandledException(err); It has leaveBreadCrumb to follow the app flow taken prior getting the crash, e.g. crittercism.leaveBreadcrumb("it fail…
// An Example app to show usage of the Crittercism APIs
// this does not currently contain best practices for
// Crittercism in conjunction with Titanium
//
// Updated 02-13-2013
Ti.API.info("Ti App: importing Crittercism...");
var crittercism = require('com.crittercism.ti');
Ti.API.info("module is => " + crittercism + "\n");
@egomez99
egomez99 / UIApplicationInvalidInterfaceOrientation crash report
Created March 15, 2013 16:59
Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES
Stack Trace
_________________________________
0 CoreFoundation 0x31d642a3 __exceptionPreprocess + 163
1 libobjc.A.dylib 0x399fe97f objc_exception_throw + 31
2 CoreFoundation 0x31d641c5 -[NSException initWithCoder:] + 1
3 UIKit 0x33bd489f -[UIViewController __supportedInterfaceOrientations] + 475
4 UIKit 0x33bd46a9 -[UIViewController __withSupportedInterfaceOrientation:apply:] + 25
5 UIKit 0x33c19a41 -[UIViewController _updateLastKnownInterfaceOrientationOnPresentionStack:] + 185
6 UIKit 0x33c19aab -[UIViewController _updateLastKnownInterfaceOrientationOnPresentionStack:] + 291
7 UIKit 0x33bdf061 -[UIWindow _updateInterfaceOrientationFromDeviceOrientation:] + 985
@egomez99
egomez99 / app.js
Created November 21, 2012 22:44
TableView samples that use ClassName property
/*
//Sample 1
var tableView = require('tv_layout2');
tableView().open();
*/
/*
//Sample 2
var data = [];
@egomez99
egomez99 / ExampleService.js
Created November 10, 2012 03:13
Android Notifications
if(!Ti.App.Properties.hasProperty('notificationCount')) {
Ti.App.Properties.setInt('notificationCount', 0);
} else {
Ti.App.Properties.removeProperty('notificationCount');
var activity = Ti.Android.currentActivity;
var intent = Ti.Android.createIntent({
action : Ti.Android.ACTION_MAIN,
// you can use className or url to launch the app
// className and packageName can be found by looking in the build folder
@egomez99
egomez99 / app.js
Created November 10, 2012 03:11
OnNewIntent - Android Local Notification
var win = Ti.UI.createWindow({fullscreen:false});
//create some simple UI
var textfield = Ti.UI.createTextField({width:300, height:'auto', top:40, left:20, hintText:'enter message'});
var button = Ti.UI.createButton({title:'Send Notification', width:'auto', top:120, left:20, height:'auto'});
var label = Ti.UI.createLabel({width:'auto', top:200, left:20, height:'auto', width:200, text:'Message from intent:'});
var msgLabel = Ti.UI.createLabel({width:'auto', top:240, left:20, height:'auto', width:200, backgroundColor:'lightgrey', text:'---'});
win.add(textfield);
win.add(button);
@egomez99
egomez99 / app.js
Created October 20, 2012 03:25
Convert to BLOB
var win = Ti.UI.createWindow({
backgroundColor: 'white'
});
var data = [];
// populate array with rows
for (var i = 0; i < 40; i++)
{
var row = createRow(i);
@egomez99
egomez99 / app.js
Created September 26, 2012 21:28
Null vars: Release proxies
var navigator = require ('ui/navigator').createNavigator(),
mainWindow = require('ui/mainWindow').mainWindow();
navigator.open( mainWindow );
setTimeout(function(){
navigator.close(mainWindow);
//mainWindow = null;
//navigator = null;
}, 15000);