Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengill committed Jul 11, 2011
2 parents b120601 + 3c4aa71 commit 959e516
Show file tree
Hide file tree
Showing 7 changed files with 864 additions and 51 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ OPEN = open
ECHO = echo
ECHO_N = echo -n
JAVA = java
PGVERSION = 1.0.0

NAME = `$(CAT) framework/appinfo.json | $(GREP) '"id"' | $(CUT) -d \" -f 4`
VERSION = `$(CAT) framework/appinfo.json | $(GREP) '"version"' | $(CUT) -d \" -f 4`
Expand All @@ -41,14 +42,14 @@ run:
palm-launch $(NAME)

copy_js:
cp lib/phonegap.js framework/phonegap.js
cp lib/phonegap.js framework/phonegap-$(PGVERSION).js

js: lib/phonegap.js

lib/phonegap.js: js/phonegap.js.base js/acceleration.js js/accelerometer.js js/application.js js/audio.js js/camera.js js/contacts.js js/debugconsole.js js/device.js js/file.js js/geolocation.js js/map.js js/mojo.js js/mouse.js js/network.js js/notification.js js/orientation.js js/position.js js/service.js js/sms.js js/telephony.js js/window.js js/windowproperties.js
lib/phonegap.js: js/phonegap-core.js js/acceleration.js js/accelerometer.js js/application.js js/audio.js js/camera.js js/contacts.js js/debugconsole.js js/device.js js/file.js js/geolocation.js js/map.js js/mojo.js js/mouse.js js/network.js js/notification.js js/orientation.js js/position.js js/service.js js/sms.js js/telephony.js js/window.js js/windowproperties.js lib/thumbs.0.5.2.js
$(MKPATH) lib
$(RM_F) $@
$(CAT) js/phonegap.js.base >> $@
$(CAT) js/phonegap-core.js >> $@
$(CAT) js/acceleration.js >> $@
$(CAT) js/accelerometer.js >> $@
$(CAT) js/application.js >> $@
Expand All @@ -71,3 +72,4 @@ lib/phonegap.js: js/phonegap.js.base js/acceleration.js js/accelerometer.js js/a
$(CAT) js/telephony.js >> $@
$(CAT) js/window.js >> $@
$(CAT) js/windowproperties.js >> $@
$(CAT) lib/thumbs.0.5.2.js >> $@
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Notes & Caveats
-----------------------------------------------------
- In order to use the vibration API on palm, your application needs to have a "com.palm.*" namespace, as vibration on webOS is a private API. The caveat of doing this is that you are essentially indicating that your app should pretend to be a "Palm app" (rather than a Nitobi app, for example) ... and as a result your app will be denied from the Palm app catalog.
- Currently the map.show function can only accept one position, as Palm uses google maps as its native maps application, and it only can take one marker as a parameter.
- Touch event not supported, natively. Must use the click event, or maybe we can emulate the touch event by capturing the click event.
- Touch event not supported, natively. PhoneGap now includes event handlers for mouse & touch events - please see the example app bundled with PhoneGap-webOS
- If using Lawnchair, the only supported adaptor is webkitsqlite.
- html select boxes are implemented by phonegap, not supported natively (believe it or not). only the most basic functionality is implemented, so be aware using this control could cause problems.
- To enable verbose logging, add the file framework_config.json to your framework/www/ folder, containing the following json content: { "logLevel": 99 }
Expand Down
5 changes: 1 addition & 4 deletions framework/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Dashboard</title>

<link rel="stylesheet" type="text/css" href="menu.css">

</head>
<body>
Win
Hello World
</body>
</html>
91 changes: 65 additions & 26 deletions framework/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,67 +16,83 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PhoneGap WebOS</title>

<link rel="stylesheet" href="jqtouch/jqtouch.css" />
<link rel="stylesheet" href="jqtouch/themes/default/theme.css" />
<link rel="stylesheet" href="css/main.css" />


<script type="text/javascript" src="phonegap.js"></script>
<script type="text/javascript" src="phonegap-1.0.0.js"></script>
<script type="text/javascript">
// create global var for sqlite database instance
var db;
</script>



<link rel="stylesheet" type="text/css" href="menu.css">

</head>
<body>

<a onclick="dashboard();">Dashboard</a>

<div id="menu">
<a onclick="page('screen');">Adjust Screen Settings</a>
<a onclick="page('notifications');">Notification Examples</a>
<a onclick="info();">Show Device Info</a>
<a onclick="net();">Show Network Info</a>
<a onclick="navigator.notification.showBanner('Banner test','banner');menu(false);">Show Banner Message</a>
<a onclick="net();">Show Network Info</a>
<a onclick="window.debug.log('trace this');">Console Logging</a>
<a onclick="launchmap()">Launch Map App</a>
<a onclick="navigator.window.newCard('about:blank', '<html><body>Hello again!</body></html>');menu(false);">Launch New Card</a>
<a onclick="navigator.window.newCard('dashboard.html'); menu(false);">Launch New Card</a>
<a onclick="getPicture();">Launch Camera</a>
<a onclick="storage();">Storage Tests</a>
<a onclick="storage();">Storage Tests</a>
<a onclick="callPhoneGapExec();menu(false);">PhoneGap Exec</a>
<a onclick="page('touchDemo');">Touch Events Examples</a>
<a onclick="menu(false);">Done</a>
</div>

<div id="screen">
<p><input type="checkbox" onchange="navigator.window.setFullScreen(this.checked);">navigator.window.setFullScreen();</p>
<p><input type="checkbox" onchange="navigator.window.blockScreenTimeout(this.checked);">navigator.window.blockScreenTimeout();</p>
<p><input type="checkbox" onchange="navigator.accelerometer.setFastAccelerometer(this.checked);">navigator.accelerometer.fastAccelerometer();</p>

<p>navigator.orientation.setWindowOrientation();</p>
<input type="radio" onchange="navigator.orientation.setOrientation(this.value);" value="up" name="orientation" checked>up
<input type="radio" onchange="navigator.orientation.setOrientation(this.value);" value="down" name="orientation">down
<input type="radio" onchange="navigator.orientation.setOrientation(this.value);" value="left" name="orientation">left
<input type="radio" onchange="navigator.orientation.setOrientation(this.value);" value="right" name="orientation">right
<input type="radio" onchange="navigator.orientation.setOrientation(this.value);" value="free" name="orientation">free



<p>navigator.orientation.getCurrentOrientation()</p>
<input type="button" onclick="displayCurrentOrientation();" value="Get Current Orientation">
<button onclick="displayCurrentOrientation();">Get Current Orientation</button>
</div>

<div id="notifications" style="display: none;">
<p>navigator.notification.newDashboard();</p>
<button onclick="navigator.notification.newDashboard('dashboard.html');">Dashboard</button>

<p>navigator.notification.alert();</p>
<input type="button" onclick="navigator.notification.alert('alert');" value="Show Alert">
<button onclick="navigator.notification.alert('alert');">Show Alert</button>

<p>navigator.notification.showBanner();</p>
<button onclick="navigator.notification.showBanner('Banner test','banner');">Show Banner Message</button>
</div>

<div id="info"></div>
<div id="blank" width="100%" height="100%" style="background: #FFFFFF;"></div>

<div id="net"></div>
<div id="info" style="display: none;"></div>

<div id="camera"></div>
<div id="net" style="display: none;"></div>

<div id="camera" style="display: none;"></div>

<div id="touchDemo" style="display: none;">
<p>Touch Events Demo</p>
<button id="btnTouchStart">Touch Start</button>
<button id="btnTouchEnd">Touch End</button>
<p>Run your finger/mouse along button to trigger touchmove</p>
<button id="btnTouchMove" width="250">Touch Move</button>
<p>Mouse Events Demo</p>
<button id="btnMouseDown">Mouse Down</button>
<button id="btnMouseUp">Mouse Up</button>
<p>Run your finger/mouse along button to trigger mousemove</p>
<button id="btnMouseMove" width="250">Mouse Move</button>
</div>

<div id="storage" style="display: none">
<p>storage tests</p>
<input type="button" onclick="createDB();" value="Test SQLite DB">
<button onclick="createDB();">Test SQLite DB</button>
<div id="storageResults"></div>
</div>

Expand All @@ -85,6 +101,33 @@
// PhoneGap is ready, do all your stuf here
}, false);

// setup event listeners for touch events
document.querySelector('#btnTouchStart').addEventListener('touchstart', onTouchEvent, false);
document.querySelector('#btnTouchEnd').addEventListener('touchend', onTouchEvent, false);
document.querySelector('#btnTouchMove').addEventListener('touchmove', onTouchEvent, false);
// setup event listeners for mouse events
document.querySelector('#btnMouseDown').addEventListener('mousedown', onTouchEvent, false);
document.querySelector('#btnMouseUp').addEventListener('mouseup', onTouchEvent, false);
document.querySelector('#btnMouseMove').addEventListener('mousemove', onTouchEvent, false);

function onTouchEvent(event) {
navigator.notification.alert(event.type);
}

function callPhoneGapExec() {
//win, fail, clazz, action, args
PhoneGap.exec(success, fail, 'navigator.notification', 'alert', 'testing exec');

function success(msg) {
console.log(msg + ' exec succeeded');
}

function fail(msg) {
//navigator.notification.alert('exec failed');
console.log(msg + ' exec failed');
}
}

function createDB() {
document.getElementById('storageResults').innerHTML = '';
db = window.openDatabase("test", "1.0", "Test DB", false);
Expand Down Expand Up @@ -122,10 +165,6 @@
}
}

function dashboard() {
navigator.notification.newDashboard("dashboard.html");
}

function info() {
var deviceinfo = JSON.stringify(navigator.device.getDeviceInfo()).replace(/,/g, ', ');
page('info');
Expand Down
Loading

0 comments on commit 959e516

Please sign in to comment.