Skip to content

Instantly share code, notes, and snippets.

View egomez99's full-sized avatar

Eduardo Gomez egomez99

  • Automation Testing
  • Guadalajara, Mexico.
  • 23:42 (UTC -06:00)
View GitHub Profile
@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 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 / 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 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 / 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 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
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 27, 2013 22:35
Start an activity and download a remote image
var win = Ti.UI.createWindow({
layout : 'vertical',
backgroundColor : "#b5aea5"
});
//attempt to start an activity while Image is downloading
var intent = Ti.Android.createIntent({
action : Ti.Android.ACTION_CALL,
data : 'tel:0133' + 31361035
});
@egomez99
egomez99 / app.js
Created June 28, 2013 23:19
iOS createDocumentViewer
var win = Titanium.UI.createWindow({
title : 'Window',
backgroundColor : '#fff',
className : 'navBarColor',
translucent : false
});
var scrollingView = Ti.UI.createScrollView({
top : 0,
left : 0,
@egomez99
egomez99 / app.js
Created August 6, 2013 22:43
Get WIFI SSID (network name) from Android module
// open a single window
var win = Ti.UI.createWindow({
backgroundColor : 'white'
});
var label = Ti.UI.createLabel();
win.add(label);
win.open();
// TODO: write your module tests here
var wifissid = require('org.appcelerator.wifissid');