diff --git a/Makefile b/Makefile index 080ff8c8..59517d0d 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ iphone: lib/iphone/phonegap-min.js lib/iphone/phonegap-min.js: lib/iphone/phonegap.js $(JAVA) -jar util/yuicompressor-2.4.2.jar --charset UTF-8 -o $@ lib/iphone/phonegap.js -lib/iphone/phonegap.js: javascripts/phonegap.js.base javascripts/acceleration.js javascripts/accelerometer.js javascripts/camera.js javascripts/contact.js javascripts/debugconsole.js javascripts/device.js javascripts/file.js javascripts/geolocation.js javascripts/compass.js javascripts/map.js javascripts/media.js javascripts/notification.js javascripts/orientation.js javascripts/position.js javascripts/sms.js javascripts/telephony.js javascripts/uicontrols.js javascripts/iphone/accelerometer.js javascripts/iphone/bonjour.js javascripts/iphone/contact.js javascripts/iphone/camera.js javascripts/iphone/debugconsole.js javascripts/iphone/device.js javascripts/iphone/geolocation.js javascripts/iphone/compass.js javascripts/iphone/media.js javascripts/iphone/notification.js javascripts/iphone/phonegap.js javascripts/iphone/uicontrols.js +lib/iphone/phonegap.js: javascripts/phonegap.js.base javascripts/acceleration.js javascripts/accelerometer.js javascripts/camera.js javascripts/contact.js javascripts/debugconsole.js javascripts/device.js javascripts/file.js javascripts/geolocation.js javascripts/compass.js javascripts/map.js javascripts/media.js javascripts/notification.js javascripts/orientation.js javascripts/position.js javascripts/sms.js javascripts/telephony.js javascripts/uicontrols.js javascripts/network.js javascripts/iphone/accelerometer.js javascripts/iphone/bonjour.js javascripts/iphone/contact.js javascripts/iphone/camera.js javascripts/iphone/debugconsole.js javascripts/iphone/device.js javascripts/iphone/geolocation.js javascripts/iphone/compass.js javascripts/iphone/media.js javascripts/iphone/notification.js javascripts/iphone/phonegap.js javascripts/iphone/uicontrols.js javascripts/iphone/network.js $(RM_RF) lib/iphone $(MKPATH) lib/iphone $(RM_F) $@ @@ -65,6 +65,7 @@ lib/iphone/phonegap.js: javascripts/phonegap.js.base javascripts/acceleration.js $(CAT) javascripts/sms.js >> $@ $(CAT) javascripts/telephony.js >> $@ $(CAT) javascripts/uicontrols.js >> $@ + $(CAT) javascripts/network.js >> $@ $(CAT) javascripts/iphone/accelerometer.js >> $@ $(CAT) javascripts/iphone/bonjour.js >> $@ $(CAT) javascripts/iphone/contact.js >> $@ @@ -77,6 +78,8 @@ lib/iphone/phonegap.js: javascripts/phonegap.js.base javascripts/acceleration.js $(CAT) javascripts/iphone/notification.js >> $@ $(CAT) javascripts/iphone/phonegap.js >> $@ $(CAT) javascripts/iphone/uicontrols.js >> $@ + $(CAT) javascripts/iphone/network.js >> $@ + blackberry: lib/blackberry/phonegap-min.js lib/blackberry/phonegap-min.js: lib/blackberry/phonegap.js @@ -111,8 +114,8 @@ android: lib/android/phonegap-min.js lib/android/phonegap-min.js: lib/android/phonegap.js $(JAVA) -jar util/yuicompressor-2.4.2.jar --charset UTF-8 -o $@ lib/android/phonegap.js -lib/android/phonegap.js: javascripts/phonegap.js.base javascripts/acceleration.js javascripts/accelerometer.js javascripts/camera.js javascripts/contact.js javascripts/debugconsole.js javascripts/device.js javascripts/file.js javascripts/geolocation.js javascripts/compass.js javascripts/map.js javascripts/media.js javascripts/notification.js javascripts/orientation.js javascripts/position.js javascripts/sms.js javascripts/telephony.js javascripts/uicontrols.js javascripts/android/device.js javascripts/android/geolocation.js javascripts/android/notification.js - $(RM_RF) lib/android +<<<<<<< HEAD:Makefile +lib/android/phonegap.js: javascripts/phonegap.js.base javascripts/acceleration.js javascripts/accelerometer.js javascripts/camera.js javascripts/contact.js javascripts/debugconsole.js javascripts/device.js javascripts/file.js javascripts/geolocation.js javascripts/map.js javascripts/media.js javascripts/notification.js javascripts/orientation.js javascripts/position.js javascripts/sms.js javascripts/telephony.js javascripts/uicontrols.js javascripts/android/device.js javascripts/android/geolocation.js javascripts/android/notification.js javascripts/android/camera.js $(MKPATH) lib/android $(RM_F) $@ $(CAT) javascripts/phonegap.js.base >> $@ @@ -137,3 +140,4 @@ lib/android/phonegap.js: javascripts/phonegap.js.base javascripts/acceleration.j $(CAT) javascripts/android/geolocation.js >> $@ $(CAT) javascripts/android/notification.js >> $@ $(CAT) javascripts/android/accelerometer.js >> $@ + $(CAT) javascripts/android/camera.js >> $@ diff --git a/android/.classpath b/android/.classpath index f0b94296..ff33dbc2 100644 --- a/android/.classpath +++ b/android/.classpath @@ -3,5 +3,6 @@ + diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 49712247..da6d3907 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -23,6 +23,11 @@ + + + diff --git a/android/assets/www/index.html b/android/assets/www/index.html index d1ac7d5d..c97d6120 100644 --- a/android/assets/www/index.html +++ b/android/assets/www/index.html @@ -8,7 +8,7 @@ +

Welcome to PhoneGap!

@@ -85,6 +111,10 @@

UUID:  

Get Location Call 411 Beep - Vibrate + Vibrate + Get a Picture +
+ +
diff --git a/android/assets/www/master.css b/android/assets/www/master.css index 1d1bea20..6a9b7218 100644 --- a/android/assets/www/master.css +++ b/android/assets/www/master.css @@ -93,3 +93,7 @@ width:308px; padding:1.2em 0; } + + #viewport { + display: none; + } diff --git a/android/assets/www/phonegap.js b/android/assets/www/phonegap.js index 75ac2872..8f246d3f 100644 --- a/android/assets/www/phonegap.js +++ b/android/assets/www/phonegap.js @@ -308,6 +308,13 @@ function Device() { this.gap = null; this.uuid = null; try { +<<<<<<< HEAD:android/assets/www/phonegap.js + if (window['DroidGap'] != undefined && window.DroidGap.exists()) { + this.available = true; + this.isAndroid = true; + this.uuid = window.DroidGap.getUuid(); + this.gapVersion = window.DroidGap.getVersion(); +======= if (window.DroidGap) { this.available = true; this.uuid = window.DroidGap.getUuid(); @@ -315,6 +322,7 @@ function Device() { this.gapVersion = window.DroidGap.getVersion(); this.platform = window.DroidGap.getPlatform(); this.name = window.DroidGap.getProductName(); +>>>>>>> 4c08b34a81e55a3146e67a8ad2282b7082b640e0:android/assets/www/phonegap.js } else { this.platform = DeviceInfo.platform; this.version = DeviceInfo.version; @@ -510,6 +518,12 @@ function Media(src) { this.src = src; } +<<<<<<< HEAD:android/assets/www/phonegap.js +Media.prototype.record = function() { +} + +======= +>>>>>>> 4c08b34a81e55a3146e67a8ad2282b7082b640e0:android/assets/www/phonegap.js Media.prototype.play = function() { } @@ -676,6 +690,241 @@ PhoneGap.addConstructor(function() { * @param {Object} vel * @constructor */ +<<<<<<< HEAD:android/assets/www/phonegap.js +function Position(lat, lng, acc, alt, altacc, head, vel) { + /** + * The latitude of the position. + */ + this.latitude = lat; + /** + * The longitude of the position, + */ + this.longitude = lng; + /** + * The accuracy of the position. + */ + this.accuracy = acc; + /** + * The altitude of the position. + */ + this.altitude = alt; + /** + * The altitude accuracy of the position. + */ + this.altitudeAccuracy = altacc; + /** + * The direction the device is moving at the position. + */ + this.heading = head; + /** + * The velocity with which the device is moving at the position. + */ + this.velocity = vel; + /** + * The time that the position was obtained. + */ + this.timestamp = new Date().getTime(); +} + +/** + * This class specifies the options for requesting position data. + * @constructor + */ +function PositionOptions() { + /** + * Specifies the desired position accuracy. + */ + this.enableHighAccuracy = true; + /** + * The timeout after which if position data cannot be obtained the errorCallback + * is called. + */ + this.timeout = 10000; +} + +/** + * This class contains information about any GSP errors. + * @constructor + */ +function PositionError() { + this.code = null; + this.message = ""; +} + +PositionError.UNKNOWN_ERROR = 0; +PositionError.PERMISSION_DENIED = 1; +PositionError.POSITION_UNAVAILABLE = 2; +PositionError.TIMEOUT = 3; +/** + * This class provides access to the device SMS functionality. + * @constructor + */ +function Sms() { + +} + +/** + * Sends an SMS message. + * @param {Integer} number The phone number to send the message to. + * @param {String} message The contents of the SMS message to send. + * @param {Function} successCallback The function to call when the SMS message is sent. + * @param {Function} errorCallback The function to call when there is an error sending the SMS message. + * @param {PositionOptions} options The options for accessing the GPS location such as timeout and accuracy. + */ +Sms.prototype.send = function(number, message, successCallback, errorCallback, options) { + +} + +PhoneGap.addConstructor(function() { + if (typeof navigator.sms == "undefined") navigator.sms = new Sms(); +}); +/** + * This class provides access to the telephony features of the device. + * @constructor + */ +function Telephony() { + +} + +/** + * Calls the specifed number. + * @param {Integer} number The number to be called. + */ +Telephony.prototype.call = function(number) { + +} + +PhoneGap.addConstructor(function() { + if (typeof navigator.telephony == "undefined") navigator.telephony = new Telephony(); +}); +/** + * This class exposes mobile phone interface controls to JavaScript, such as + * native tab and tool bars, etc. + * @constructor + */ +function UIControls() { + this.tabBarTag = 0; + this.tabBarCallbacks = {}; +} + +/** + * Create a native tab bar that can have tab buttons added to it which can respond to events. + */ +UIControls.prototype.createTabBar = function() {}; + +/** + * Show a tab bar. The tab bar has to be created first. + * @param {Object} [options] Options indicating how the tab bar should be shown: + * - \c height integer indicating the height of the tab bar (default: \c 49) + * - \c position specifies whether the tab bar will be placed at the \c top or \c bottom of the screen (default: \c bottom) + */ +UIControls.prototype.showTabBar = function(options) {}; + +/** + * Hide a tab bar. The tab bar has to be created first. + */ +UIControls.prototype.hideTabBar = function(animate) {}; + +/** + * Create a new tab bar item for use on a previously created tab bar. Use ::showTabBarItems to show the new item on the tab bar. + * + * If the supplied image name is one of the labels listed below, then this method will construct a tab button + * using the standard system buttons. Note that if you use one of the system images, that the \c title you supply will be ignored. + * + * Tab Buttons + * - tabButton:More + * - tabButton:Favorites + * - tabButton:Featured + * - tabButton:TopRated + * - tabButton:Recents + * - tabButton:Contacts + * - tabButton:History + * - tabButton:Bookmarks + * - tabButton:Search + * - tabButton:Downloads + * - tabButton:MostRecent + * - tabButton:MostViewed + * @param {String} name internal name to refer to this tab by + * @param {String} [title] title text to show on the tab, or null if no text should be shown + * @param {String} [image] image filename or internal identifier to show, or null if now image should be shown + * @param {Object} [options] Options for customizing the individual tab item + * - \c badge value to display in the optional circular badge on the item; if null or unspecified, the badge will be hidden + */ +UIControls.prototype.createTabBarItem = function(name, label, image, options) {}; + +/** + * Update an existing tab bar item to change its badge value. + * @param {String} name internal name used to represent this item when it was created + * @param {Object} options Options for customizing the individual tab item + * - \c badge value to display in the optional circular badge on the item; if null or unspecified, the badge will be hidden + */ +UIControls.prototype.updateTabBarItem = function(name, options) {}; + +/** + * Show previously created items on the tab bar + * @param {String} arguments... the item names to be shown + * @param {Object} [options] dictionary of options, notable options including: + * - \c animate indicates that the items should animate onto the tab bar + * @see createTabBarItem + * @see createTabBar + */ +UIControls.prototype.showTabBarItems = function(tabs, options) {}; + +/** + * Manually select an individual tab bar item, or nil for deselecting a currently selected tab bar item. + * @param {String} tabName the name of the tab to select, or null if all tabs should be deselected + * @see createTabBarItem + * @see showTabBarItems + */ +UIControls.prototype.selectTabBarItem = function(tab) {}; + +/** + * Function called when a tab bar item has been selected. + * @param {Number} tag the tag number for the item that has been selected + */ +UIControls.prototype.tabBarItemSelected = function(tag) { + if (typeof(this.tabBarCallbacks[tag]) == 'function') + this.tabBarCallbacks[tag](); +}; + +/** + * Create a toolbar. + */ +UIControls.prototype.createToolBar = function() {}; + +/** + * Function called when a tab bar item has been selected. + * @param {String} title the title to set within the toolbar + */ +UIControls.prototype.setToolBarTitle = function(title) {}; + +PhoneGap.addConstructor(function() { + window.uicontrols = new UIControls(); +}); +/* + * This is because strings are not exposed + * + */ +var Device = { + + platform: "", + version: "", + uuid: "", + + init: function() { + Device.platform = DroidGap.getPlatform(); + Device.version = Droidap.getVersion(); + Device.uuid = DroidGap.getUuid(); + }, + vibrate: function(mills) + { + DroidGap.vibrate(mills); + }, + beep: function() + { + DroidGap.beep(); + } +======= function Position(coords, timestamp) { this.coords = coords; this.timestamp = new Date().getTime(); @@ -755,6 +1004,7 @@ function Sms() { */ Sms.prototype.send = function(number, message, successCallback, errorCallback, options) { +>>>>>>> 4c08b34a81e55a3146e67a8ad2282b7082b640e0:android/assets/www/phonegap.js } PhoneGap.addConstructor(function() { @@ -891,24 +1141,37 @@ PhoneGap.addConstructor(function() { Geolocation.prototype.getCurrentPosition = function(successCallback, errorCallback, options) { +<<<<<<< HEAD:android/assets/www/phonegap.js + var position = Geo.getCurrentPosition(); +======= var position = Geo.getCurrentLocation(); +>>>>>>> 4c08b34a81e55a3146e67a8ad2282b7082b640e0:android/assets/www/phonegap.js this.global_success = successCallback; this.fail = errorCallback; } // Run the global callback +<<<<<<< HEAD:android/assets/www/phonegap.js +Geolocation.prototype.gotCurrentPosition = function(lat, lng) +======= Geolocation.prototype.gotCurrentPosition = function(lat, lng, alt, altacc, head, vel, stamp) +>>>>>>> 4c08b34a81e55a3146e67a8ad2282b7082b640e0:android/assets/www/phonegap.js { - if (lat == "undefined" || lng == "undefined") + if (lat == 0 || lng == 0) { this.fail(); } else { +<<<<<<< HEAD:android/assets/www/phonegap.js + var p = { "lat" : lat, "lng": lng }; + this.global_success(p); +======= coords = new Coordinates(lat, lng, alt, altacc, head, vel); loc = new Position(coords, stamp); this.global_success(loc); +>>>>>>> 4c08b34a81e55a3146e67a8ad2282b7082b640e0:android/assets/www/phonegap.js } } @@ -937,14 +1200,18 @@ Geolocation.prototype.watchPosition = function(successCallback, errorCallback, o * Retrieve and stop this listener from listening to the GPS * */ +<<<<<<< HEAD:android/assets/www/phonegap.js +Geolocation.prototype.success(key, lat, lng) +======= Geolocation.prototype.success = function(key, lat, lng, alt, altacc, head, vel, stamp) +>>>>>>> 4c08b34a81e55a3146e67a8ad2282b7082b640e0:android/assets/www/phonegap.js { var coords = new Coordinates(lat, lng, alt, altacc, head, vel); var loc = new Position(coords, stamp); this.listeners[key].success(loc); } -Geolocation.prototype.fail = function(key) +Geolocation.prototype.fail(key) { this.listeners[key].fail(); } @@ -954,6 +1221,24 @@ Geolocation.prototype.clearWatch = function(watchId) Geo.stop(watchId); } +<<<<<<< HEAD:android/assets/www/phonegap.js + +Notification.prototype.vibrate = function(mills) +{ + Device.vibrate(mills); +} + +/* + * On the Android, we don't beep, we notify you with your + * notification! We shouldn't keep hammering on this, and should + * review what we want beep to do. + */ + +Notification.prototype.beep = function(count, volume) +{ + Device.notify(); +} +======= Notification.prototype.vibrate = function(mills) { @@ -1047,3 +1332,4 @@ Accelerometer.prototype.clearWatch = function(watchId) { PhoneGap.addConstructor(function() { if (typeof navigator.accelerometer == "undefined") navigator.accelerometer = new Accelerometer(); }); +>>>>>>> 4c08b34a81e55a3146e67a8ad2282b7082b640e0:android/assets/www/phonegap.js diff --git a/android/libs/commons-codec-1.3.jar b/android/libs/commons-codec-1.3.jar new file mode 100644 index 00000000..957b6752 Binary files /dev/null and b/android/libs/commons-codec-1.3.jar differ diff --git a/android/local.properties b/android/local.properties index e3fc4c14..68fc6af4 100644 --- a/android/local.properties +++ b/android/local.properties @@ -7,4 +7,4 @@ # location of the SDK. This is only used by Ant # For customization when using a Version Control System, please read the # header note. -sdk-location=/home/bowserj/android-sdk-linux_x86-1.5_r1 +sdk-location=/home/bowserj/android-sdk-linux_x86-1.5_r3 diff --git a/android/res/layout/preview.xml b/android/res/layout/preview.xml new file mode 100644 index 00000000..f7fe83aa --- /dev/null +++ b/android/res/layout/preview.xml @@ -0,0 +1,23 @@ + + + + +