Skip to content

Instantly share code, notes, and snippets.

Titanium = {
'userAgent' : '',
'version' : '',
addEventListener : function(name, callback)
{
///<summary>add an event listener for the instance to receive view triggered events</summary>
///<param name="name" type="string">name of the event</param>
///<param name="callback" type="function">callback function to invoke when the event is fired</param>
///<return type="void"/>
return ;
@billdawson
billdawson / gist:725856
Created December 2, 2010 19:01
test info for LH ticket 2476
<!-- Make the 'android' element of your tiapp.xml look like this-->
<android xmlns:android="http://schemas.android.com/apk/res/android">
<activities>
<activity url="Test.js" dummy="dummy">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
</activities>
</android>
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
<id>com.billdawson.keyboardhide</id>
<name>KeyboardHide</name>
<version>1.0</version>
<publisher>Bill Dawson</publisher>
<url>billdawson.com</url>
<description>No description provided</description>
<copyright>2010 by Bill Dawson</copyright>
<property type="bool" name="ti.android.debug">true</property>
@billdawson
billdawson / all_ti_contacts.js
Created September 15, 2010 20:53
Show data for all contacts (Titanium)
function dosubs(person, property, labels) {
if (!(person[property])) {
return;
}
var pset = person[property];
for (var i = 0; i < labels.length; i++) {
var label = labels[i];
if (!(pset[label])) {
continue;
}
protected boolean keyChar(char arg0, int arg1, int arg2)
{
int key = (int) arg0;
boolean suppress = false;
if (key == Keypad.KEY_ENTER) {
if (proxy.hasDynamicValue("suppressReturn")) {
suppress = TiConvert.toBoolean(proxy.getDynamicValue("suppressReturn"));
}
}
if (suppress) {
var win = Ti.UI.currentWindow;
var view = Titanium.UI.createView({
backgroundColor:'red',
width:200,
height:200,
top: 0,
left: 0
});
@billdawson
billdawson / gist:378439
Created April 25, 2010 14:30
Suggestion for adding to top of Getting Started with Titanium Mobile
<h2>Pre-Requisites</h2>
<h3>For iPhone/iPad App Development</h3>
<p>Get the latest iPhone SDK from Apple's <a href="http://developer.apple.com/iphone">iPhone
Dev Center</a>. The standard SDK download will include XCode and all the other development
tools that we require. Note: You need at least iPhone SDK 3.2 if you want to develop for
both the iPhone and the iPad. </p>
<h3>For Android App Development</h3>
@billdawson
billdawson / gist:375136
Created April 22, 2010 12:06
Java and I
Java and I
==========
22 April 2010
My only Java code running in production is a relatively small,
single-purpose servlet developed a few months ago. Professionally
speaking, my background is MS dev tools (I'm an MCSD.) As a
hobbyist, I've followed Java since picking up the first edition of
Eckel's "Thinking in Java" back in the day. I run Eclipse Galileo
if platform.system() == 'Windows':
run.run([self.sdk.get_adb(), "start-server"], True, ignore_output=True)
import os,subprocess,types,sys
def run(args,ignore_error=False,debug=True, ignore_output=False):
if debug:
print "[DEBUG] %s"%(" ".join(args))
sys.stdout.flush()
if ignore_output:
subprocess.Popen(args, stderr=subprocess.PIPE, stdout=subprocess.PIPE).wait()
return None
(so,se) = subprocess.Popen(args, stderr=subprocess.PIPE, stdout=subprocess.PIPE).communicate()