Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Lieder committed Nov 22, 2010
0 parents commit 6fa8604
Show file tree
Hide file tree
Showing 23 changed files with 1,377 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="build/.apt_generated"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/Developer/android-sdk-mac_86/platforms/android-8/android.jar"/>
<classpathentry kind="lib" path="/Developer/android-sdk-mac_86/add-ons/addon_google_apis_google_inc_8/libs/maps.jar"/>
<classpathentry kind="lib" path="/Library/Application Support/Titanium/mobilesdk/osx/1.5.0/android/titanium.jar" sourcepath="/Users/findlaw/Git/titanium_mobile/android/titanium/src"/>
<classpathentry kind="lib" path="/Library/Application Support/Titanium/mobilesdk/osx/1.5.0/android/js.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>titanium-c2dm</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
7 changes: 7 additions & 0 deletions .settings/org.eclipse.jdt.apt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#Thu Sep 02 15:18:34 CDT 2010
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=true
org.eclipse.jdt.apt.genSrcDir=.apt_generated
org.eclipse.jdt.apt.reconcileEnabled=true

org.eclipse.jdt.apt.processorOptions/kroll.jsonFile=c2dm.json
3 changes: 3 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#Thu Sep 02 15:18:34 CDT 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.processAnnotations=enabled
502 changes: 502 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions assets/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Place your assets like PNG files in this directory and they will be packaged with your module.

If you create a file named com.findlaw.titanium.c2dm.js in this directory, it will be
compiled and used as your module. This allows you to run pure Javascript
modules that are pre-compiled.

3 changes: 3 additions & 0 deletions build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
titanium.platform=/Library/Application Support/Titanium/mobilesdk/osx/1.5.0/android
android.platform=/opt/android-sdk/platforms/android-8
google.apis=/opt/android-sdk/add-ons/addon_google_apis_google_inc_8
10 changes: 10 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<project name="c2dm" default="dist">
<description>
Ant build script for Titanium Android module c2dm
</description>

<property name="ti.module.root" location="${basedir}"/>
<property file="build.properties" />

<import file="${titanium.platform}/../module/android/build.xml"/>
</project>
39 changes: 39 additions & 0 deletions documentation/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# c2dm Module

## Description

TODO: Enter your module description here

## Accessing the c2dm Module

To access this module from JavaScript, you would do the following:

var c2dm = require("com.findlaw.titanium.c2dm");

The c2dm variable is a reference to the Module object.

## Reference

TODO: If your module has an API, you should document
the reference here.

### ___PROJECTNAMEASIDENTIFIER__.function

TODO: This is an example of a module function.

### ___PROJECTNAMEASIDENTIFIER__.property

TODO: This is an example of a module property.

## Usage

TODO: Enter your usage example here

## Author

TODO: Enter your author name, email and other contact
details you want to share here.

## License

TODO: Enter your license/legal information here.
75 changes: 75 additions & 0 deletions example/AndroidManifest.custom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.findlaw.titanium.c2dm"
android:versionCode="1"
android:versionName="1"
>
<uses-sdk android:minSdkVersion="4" />

<supports-screens
android:smallScreens="false"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="false"
/>

<application
android:icon="@drawable/appicon"
android:label="c2dm"
android:name="C2dmApplication"
android:debuggable="false"
>
<activity
android:name=".C2dmActivity"
android:label="c2dm"
android:theme="@style/Theme.Titanium"
android:configChanges="keyboardHidden|orientation"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>


<activity
android:name="org.appcelerator.titanium.TiActivity"
android:configChanges="keyboardHidden|orientation"
/>
<activity android:name="org.appcelerator.titanium.TiModalActivity"
android:configChanges="keyboardHidden|orientation"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
/>
<activity android:name="ti.modules.titanium.ui.TiTabActivity"
android:configChanges="keyboardHidden|orientation"
/>
<activity android:name="ti.modules.titanium.media.TiVideoActivity"
android:configChanges="keyboardHidden|orientation"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
/>

<service
android:name="org.appcelerator.titanium.analytics.TiAnalyticsService"
android:exported="false"
/>



</application>

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>


<permission android:name="com.findlaw.titanium.c2dm.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.findlaw.titanium.c2dm.permission.C2D_MESSAGE" />

<!-- This app has permission to register and receive message -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

<!-- Send the registration id to the server -->
<uses-permission android:name="android.permission.INTERNET" />

</manifest>
48 changes: 48 additions & 0 deletions example/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// This is a test harness for your module
// You should do something interesting in this harness
// to test out the module and to provide instructions
// to users on how to use it by example.


var senderId = 'john.doe@gmail.com'; // You'll need to put in your own account here

var c2dm = require('com.findlaw.titanium.c2dm');
Ti.API.info("module is => " + c2dm);

c2dm.addEventListener('register', function(data) {
Ti.API.info('JS register event: ' + data.registrationId);
label.text = 'Registered: ' + data.registrationId;
});
c2dm.addEventListener('message', function(data) {
Ti.API.info('JS message event: ' + data.message);
label.text = 'Message: ' + data.message;
});


// open a single window
var window = Ti.UI.createWindow({
backgroundColor:'white'
});

var label = Ti.UI.createLabel({top: 20, left: 5, right: 5});
window.add(label);

var button = Ti.UI.createButton({title: 'Register'});
button.addEventListener('click', function() {
Ti.API.info('Registering...');
label.text = 'Registering...';
c2dm.register(senderId);
});
window.add(button);

window.open();


if(!c2dm.registrationId) {
Ti.API.info('Registering...');
label.text = 'Registering...';
c2dm.register(senderId);
} else {
Ti.API.info('Current registration id: ' + c2dm.registrationId);
label.text = 'Current registration id: ' + c2dm.registrationId;
}
1 change: 1 addition & 0 deletions hooks/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
These files are not yet supported as of 1.4.0 but will be in a near future release.
35 changes: 35 additions & 0 deletions hooks/add.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env python
#
# This is the module project add hook that will be
# called when your module is added to a project
#
import os, sys

def dequote(s):
if s[0:1] == '"':
return s[1:-1]
return s

def main(args,argc):
# You will get the following command line arguments
# in the following order:
#
# project_dir = the full path to the project root directory
# project_type = the type of project (desktop, mobile, ipad)
# project_name = the name of the project
#
project_dir = dequote(os.path.expanduser(args[1]))
project_type = dequote(args[2])
project_name = dequote(args[3])

# TODO: write your add hook here (optional)


# exit
sys.exit(0)



if __name__ == '__main__':
main(sys.argv,len(sys.argv))

19 changes: 19 additions & 0 deletions hooks/install.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python
#
# This is the module install hook that will be
# called when your module is first installed
#
import os, sys

def main(args,argc):

# TODO: write your install hook here (optional)

# exit
sys.exit(0)



if __name__ == '__main__':
main(sys.argv,len(sys.argv))

34 changes: 34 additions & 0 deletions hooks/remove.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python
#
# This is the module project remove hook that will be
# called when your module is remove from a project
#
import os, sys

def dequote(s):
if s[0:1] == '"':
return s[1:-1]
return s

def main(args,argc):
# You will get the following command line arguments
# in the following order:
#
# project_dir = the full path to the project root directory
# project_type = the type of project (desktop, mobile, ipad)
# project_name = the name of the project
#
project_dir = dequote(os.path.expanduser(args[1]))
project_type = dequote(args[2])
project_name = dequote(args[3])

# TODO: write your remove hook here (optional)

# exit
sys.exit(0)



if __name__ == '__main__':
main(sys.argv,len(sys.argv))

18 changes: 18 additions & 0 deletions hooks/uninstall.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python
#
# This is the module uninstall hook that will be
# called when your module is uninstalled
#
import os, sys

def main(args,argc):

# TODO: write your uninstall hook here (optional)

# exit
sys.exit(0)


if __name__ == '__main__':
main(sys.argv,len(sys.argv))

18 changes: 18 additions & 0 deletions manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 0.1
description: titanium-c2dm
author: Matthew Lieder
license: LGPL 2.1
copyright: Copyright (c) 2010 by Matthew Lieder


# these should not be edited
name: c2dm
moduleid: com.findlaw.titanium.c2dm
guid: bc223a51-1bf1-4014-bc0c-483a783b1c7e
platform: android
minsdk: 1.5.0
android.sdk: /opt/android-sdk
Loading

0 comments on commit 6fa8604

Please sign in to comment.