Fixing eclipse classpath

This commit is contained in:
Joe Bowser
2012-04-10 14:22:25 -07:00
14 changed files with 402 additions and 224 deletions
+129 -82
View File
@@ -1,3 +1,5 @@
// File generated at :: Tue Apr 10 2012 11:22:35 GMT-0700 (PDT)
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -143,6 +145,13 @@ function createEvent(type, data) {
return event;
}
if(typeof window.console === "undefined")
{
window.console = {
log:function(){}
};
}
var cordova = {
define:define,
require:require,
@@ -161,6 +170,15 @@ var cordova = {
removeDocumentEventHandler:function(event) {
delete documentEventHandlers[event];
},
/**
* Retreive original event handlers that were replaced by Cordova
*
* @return object
*/
getOriginalHandlers: function() {
return {'document': {'addEventListener': m_document_addEventListener, 'removeEventListener': m_document_removeEventListener},
'window': {'addEventListener': m_window_addEventListener, 'removeEventListener': m_window_removeEventListener}};
},
/**
* Method to fire event from native code
*/
@@ -302,7 +320,7 @@ if (!window.plugins) {
module.exports = cordova;
})
});
// file: lib/common/builder.js
define("cordova/builder", function(require, exports, module) {
@@ -393,7 +411,7 @@ module.exports = {
}
};
})
});
// file: lib/common/channel.js
define("cordova/channel", function(require, exports, module) {
@@ -605,7 +623,7 @@ channel.waitForInitialization('onCordovaConnectionReady');
module.exports = channel;
})
});
// file: lib/common/common.js
define("cordova/common", function(require, exports, module) {
@@ -790,7 +808,7 @@ module.exports = {
}
};
})
});
// file: lib/android/exec.js
define("cordova/exec", function(require, exports, module) {
@@ -877,7 +895,7 @@ module.exports = function(success, fail, service, action, args) {
}
};
})
});
// file: lib/android/platform.js
define("cordova/platform", function(require, exports, module) {
@@ -1022,7 +1040,7 @@ module.exports = {
}
};
})
});
// file: lib/common/plugin/Acceleration.js
define("cordova/plugin/Acceleration", function(require, exports, module) {
@@ -1035,7 +1053,7 @@ var Acceleration = function(x, y, z) {
module.exports = Acceleration;
})
});
// file: lib/common/plugin/Camera.js
define("cordova/plugin/Camera", function(require, exports, module) {
@@ -1121,14 +1139,31 @@ cameraExport.getPicture = function(successCallback, errorCallback, options) {
if (typeof options.mediaType == "number") {
mediaType = options.mediaType;
}
// TODO: enable allow edit?
var allowEdit = false;
if (typeof options.allowEdit == "boolean") {
allowEdit = options.allowEdit;
} else if (typeof options.allowEdit == "number") {
allowEdit = options.allowEdit <= 0 ? false : true;
}
var correctOrientation = false;
if (typeof options.correctOrientation == "boolean") {
correctOrientation = options.correctOrientation;
} else if (typeof options.correctOrientation == "number") {
correctOrientation = options.correctOrientation <=0 ? false : true;
}
var saveToPhotoAlbum = false;
if (typeof options.saveToPhotoAlbum == "boolean") {
saveToPhotoAlbum = options.saveToPhotoAlbum;
} else if (typeof options.saveToPhotoAlbum == "number") {
saveToPhotoAlbum = options.saveToPhotoAlbum <=0 ? false : true;
}
exec(successCallback, errorCallback, "Camera", "takePicture", [quality, destinationType, sourceType, targetWidth, targetHeight, encodingType, mediaType]);
exec(successCallback, errorCallback, "Camera", "takePicture", [quality, destinationType, sourceType, targetWidth, targetHeight, encodingType, mediaType, allowEdit, correctOrientation, saveToPhotoAlbum]);
}
module.exports = cameraExport;
})
});
// file: lib/common/plugin/CameraConstants.js
define("cordova/plugin/CameraConstants", function(require, exports, module) {
@@ -1153,7 +1188,7 @@ module.exports = {
}
};
})
});
// file: lib/common/plugin/CaptureAudioOptions.js
define("cordova/plugin/CaptureAudioOptions", function(require, exports, module) {
@@ -1171,7 +1206,7 @@ var CaptureAudioOptions = function(){
module.exports = CaptureAudioOptions;
})
});
// file: lib/common/plugin/CaptureError.js
define("cordova/plugin/CaptureError", function(require, exports, module) {
@@ -1195,7 +1230,7 @@ CaptureError.CAPTURE_NOT_SUPPORTED = 20;
module.exports = CaptureError;
})
});
// file: lib/common/plugin/CaptureImageOptions.js
define("cordova/plugin/CaptureImageOptions", function(require, exports, module) {
@@ -1211,7 +1246,7 @@ var CaptureImageOptions = function(){
module.exports = CaptureImageOptions;
})
});
// file: lib/common/plugin/CaptureVideoOptions.js
define("cordova/plugin/CaptureVideoOptions", function(require, exports, module) {
@@ -1229,7 +1264,7 @@ var CaptureVideoOptions = function(){
module.exports = CaptureVideoOptions;
})
});
// file: lib/common/plugin/CompassError.js
define("cordova/plugin/CompassError", function(require, exports, module) {
@@ -1247,7 +1282,7 @@ CompassError.COMPASS_NOT_SUPPORTED = 20;
module.exports = CompassError;
})
});
// file: lib/common/plugin/CompassHeading.js
define("cordova/plugin/CompassHeading", function(require, exports, module) {
@@ -1255,12 +1290,12 @@ var CompassHeading = function(magneticHeading, trueHeading, headingAccuracy, tim
this.magneticHeading = (magneticHeading !== undefined ? magneticHeading : null);
this.trueHeading = (trueHeading !== undefined ? trueHeading : null);
this.headingAccuracy = (headingAccuracy !== undefined ? headingAccuracy : null);
this.timestamp = (timestamp !== undefined ? new Date(timestamp) : new Date());
this.timestamp = (timestamp !== undefined ? timestamp : new Date().getTime());
};
module.exports = CompassHeading;
})
});
// file: lib/common/plugin/ConfigurationData.js
define("cordova/plugin/ConfigurationData", function(require, exports, module) {
@@ -1280,7 +1315,7 @@ function ConfigurationData() {
module.exports = ConfigurationData;
})
});
// file: lib/common/plugin/Connection.js
define("cordova/plugin/Connection", function(require, exports, module) {
@@ -1297,7 +1332,7 @@ module.exports = {
NONE: "none"
};
})
});
// file: lib/common/plugin/Contact.js
define("cordova/plugin/Contact", function(require, exports, module) {
@@ -1479,7 +1514,7 @@ Contact.prototype.save = function(successCB, errorCB) {
module.exports = Contact;
})
});
// file: lib/common/plugin/ContactAddress.js
define("cordova/plugin/ContactAddress", function(require, exports, module) {
@@ -1509,7 +1544,7 @@ var ContactAddress = function(pref, type, formatted, streetAddress, locality, re
module.exports = ContactAddress;
})
});
// file: lib/common/plugin/ContactError.js
define("cordova/plugin/ContactError", function(require, exports, module) {
@@ -1535,7 +1570,7 @@ ContactError.PERMISSION_DENIED_ERROR = 20;
module.exports = ContactError;
})
});
// file: lib/common/plugin/ContactField.js
define("cordova/plugin/ContactField", function(require, exports, module) {
@@ -1556,7 +1591,7 @@ var ContactField = function(type, value, pref) {
module.exports = ContactField;
})
});
// file: lib/common/plugin/ContactFindOptions.js
define("cordova/plugin/ContactFindOptions", function(require, exports, module) {
@@ -1574,7 +1609,7 @@ var ContactFindOptions = function(filter, multiple) {
module.exports = ContactFindOptions;
})
});
// file: lib/common/plugin/ContactName.js
define("cordova/plugin/ContactName", function(require, exports, module) {
@@ -1599,7 +1634,7 @@ var ContactName = function(formatted, familyName, givenName, middle, prefix, suf
module.exports = ContactName;
})
});
// file: lib/common/plugin/ContactOrganization.js
define("cordova/plugin/ContactOrganization", function(require, exports, module) {
@@ -1627,7 +1662,7 @@ var ContactOrganization = function(pref, type, name, dept, title) {
module.exports = ContactOrganization;
})
});
// file: lib/common/plugin/Coordinates.js
define("cordova/plugin/Coordinates", function(require, exports, module) {
@@ -1675,7 +1710,7 @@ var Coordinates = function(lat, lng, alt, acc, head, vel, altacc) {
module.exports = Coordinates;
})
});
// file: lib/common/plugin/DirectoryEntry.js
define("cordova/plugin/DirectoryEntry", function(require, exports, module) {
@@ -1760,7 +1795,7 @@ DirectoryEntry.prototype.getFile = function(path, options, successCallback, erro
module.exports = DirectoryEntry;
})
});
// file: lib/common/plugin/DirectoryReader.js
define("cordova/plugin/DirectoryReader", function(require, exports, module) {
@@ -1806,7 +1841,7 @@ DirectoryReader.prototype.readEntries = function(successCallback, errorCallback)
module.exports = DirectoryReader;
})
});
// file: lib/common/plugin/Entry.js
define("cordova/plugin/Entry", function(require, exports, module) {
@@ -2014,7 +2049,7 @@ Entry.prototype.getParent = function(successCallback, errorCallback) {
module.exports = Entry;
})
});
// file: lib/common/plugin/File.js
define("cordova/plugin/File", function(require, exports, module) {
@@ -2037,7 +2072,7 @@ var File = function(name, fullPath, type, lastModifiedDate, size){
module.exports = File;
})
});
// file: lib/common/plugin/FileEntry.js
define("cordova/plugin/FileEntry", function(require, exports, module) {
@@ -2105,7 +2140,7 @@ FileEntry.prototype.file = function(successCallback, errorCallback) {
module.exports = FileEntry;
})
});
// file: lib/common/plugin/FileError.js
define("cordova/plugin/FileError", function(require, exports, module) {
@@ -2135,7 +2170,7 @@ FileError.PATH_EXISTS_ERR = 12;
module.exports = FileError;
})
});
// file: lib/common/plugin/FileReader.js
define("cordova/plugin/FileReader", function(require, exports, module) {
@@ -2389,7 +2424,7 @@ FileReader.prototype.readAsArrayBuffer = function(file) {
module.exports = FileReader;
})
});
// file: lib/common/plugin/FileSystem.js
define("cordova/plugin/FileSystem", function(require, exports, module) {
@@ -2411,7 +2446,7 @@ var FileSystem = function(name, root) {
module.exports = FileSystem;
})
});
// file: lib/common/plugin/FileTransfer.js
define("cordova/plugin/FileTransfer", function(require, exports, module) {
@@ -2431,8 +2466,9 @@ var FileTransfer = function() {};
* @param successCallback (Function} Callback to be invoked when upload has completed
* @param errorCallback {Function} Callback to be invoked upon error
* @param options {FileUploadOptions} Optional parameters such as file name and mimetype
* @param trustAllHosts {Boolean} Optional trust all hosts (e.g. for self-signed certs), defaults to false
*/
FileTransfer.prototype.upload = function(filePath, server, successCallback, errorCallback, options, debug) {
FileTransfer.prototype.upload = function(filePath, server, successCallback, errorCallback, options, trustAllHosts) {
// check for options
var fileKey = null;
var fileName = null;
@@ -2454,7 +2490,7 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback, erro
}
}
exec(successCallback, errorCallback, 'FileTransfer', 'upload', [filePath, server, fileKey, fileName, mimeType, params, debug, chunkedMode]);
exec(successCallback, errorCallback, 'FileTransfer', 'upload', [filePath, server, fileKey, fileName, mimeType, params, trustAllHosts, chunkedMode]);
};
/**
@@ -2484,7 +2520,7 @@ FileTransfer.prototype.download = function(source, target, successCallback, erro
module.exports = FileTransfer;
})
});
// file: lib/common/plugin/FileTransferError.js
define("cordova/plugin/FileTransferError", function(require, exports, module) {
@@ -2502,7 +2538,7 @@ FileTransferError.CONNECTION_ERR = 3;
module.exports = FileTransferError;
})
});
// file: lib/common/plugin/FileUploadOptions.js
define("cordova/plugin/FileUploadOptions", function(require, exports, module) {
@@ -2523,7 +2559,7 @@ var FileUploadOptions = function(fileKey, fileName, mimeType, params) {
module.exports = FileUploadOptions;
})
});
// file: lib/common/plugin/FileUploadResult.js
define("cordova/plugin/FileUploadResult", function(require, exports, module) {
@@ -2539,7 +2575,7 @@ var FileUploadResult = function() {
module.exports = FileUploadResult;
})
});
// file: lib/common/plugin/FileWriter.js
define("cordova/plugin/FileWriter", function(require, exports, module) {
@@ -2797,7 +2833,7 @@ FileWriter.prototype.truncate = function(size) {
module.exports = FileWriter;
})
});
// file: lib/common/plugin/Flags.js
define("cordova/plugin/Flags", function(require, exports, module) {
@@ -2817,7 +2853,7 @@ function Flags(create, exclusive) {
module.exports = Flags;
})
});
// file: lib/common/plugin/LocalFileSystem.js
define("cordova/plugin/LocalFileSystem", function(require, exports, module) {
@@ -2835,7 +2871,7 @@ LocalFileSystem.PERSISTENT = 1; //persistent
module.exports = LocalFileSystem;
})
});
// file: lib/common/plugin/Media.js
define("cordova/plugin/Media", function(require, exports, module) {
@@ -3027,7 +3063,7 @@ Media.onStatus = function(id, msg, value) {
module.exports = Media;
})
});
// file: lib/common/plugin/MediaError.js
define("cordova/plugin/MediaError", function(require, exports, module) {
@@ -3048,7 +3084,7 @@ MediaError.MEDIA_ERR_NONE_SUPPORTED = 4;
module.exports = MediaError;
})
});
// file: lib/common/plugin/MediaFile.js
define("cordova/plugin/MediaFile", function(require, exports, module) {
@@ -3109,7 +3145,7 @@ MediaFile.cast = function(pluginResult) {
module.exports = MediaFile;
})
});
// file: lib/common/plugin/MediaFileData.js
define("cordova/plugin/MediaFileData", function(require, exports, module) {
@@ -3132,7 +3168,7 @@ var MediaFileData = function(codecs, bitrate, height, width, duration){
module.exports = MediaFileData;
})
});
// file: lib/common/plugin/Metadata.js
define("cordova/plugin/Metadata", function(require, exports, module) {
@@ -3147,7 +3183,7 @@ var Metadata = function(time) {
module.exports = Metadata;
})
});
// file: lib/common/plugin/Position.js
define("cordova/plugin/Position", function(require, exports, module) {
@@ -3160,7 +3196,7 @@ var Position = function(coords, timestamp) {
module.exports = Position;
})
});
// file: lib/common/plugin/PositionError.js
define("cordova/plugin/PositionError", function(require, exports, module) {
@@ -3182,7 +3218,7 @@ PositionError.TIMEOUT = 3;
module.exports = PositionError;
})
});
// file: lib/common/plugin/ProgressEvent.js
define("cordova/plugin/ProgressEvent", function(require, exports, module) {
@@ -3233,7 +3269,7 @@ var ProgressEvent = (function() {
module.exports = ProgressEvent;
})
});
// file: lib/common/plugin/accelerometer.js
define("cordova/plugin/accelerometer", function(require, exports, module) {
@@ -3333,7 +3369,7 @@ var accelerometer = {
module.exports = accelerometer;
})
});
// file: lib/android/plugin/android/app.js
define("cordova/plugin/android/app", function(require, exports, module) {
@@ -3409,7 +3445,7 @@ module.exports = {
}
};
})
});
// file: lib/android/plugin/android/callback.js
define("cordova/plugin/android/callback", function(require, exports, module) {
@@ -3499,7 +3535,7 @@ var port = null,
module.exports = callback;
})
});
// file: lib/android/plugin/android/device.js
define("cordova/plugin/android/device", function(require, exports, module) {
@@ -3597,7 +3633,7 @@ Device.prototype.exitApp = function() {
module.exports = new Device();
})
});
// file: lib/android/plugin/android/notification.js
define("cordova/plugin/android/notification", function(require, exports, module) {
@@ -3654,7 +3690,7 @@ module.exports = {
exec(null, null, 'Notification', 'progressValue', [ value ]);
},
};
})
});
// file: lib/android/plugin/android/polling.js
define("cordova/plugin/android/polling", function(require, exports, module) {
@@ -3692,7 +3728,7 @@ var cordova = require('cordova'),
module.exports = polling;
})
});
// file: lib/android/plugin/android/storage.js
define("cordova/plugin/android/storage", function(require, exports, module) {
@@ -4074,7 +4110,7 @@ module.exports = {
completeQuery:completeQuery
};
})
});
// file: lib/common/plugin/battery.js
define("cordova/plugin/battery", function(require, exports, module) {
@@ -4166,7 +4202,7 @@ var battery = new Battery();
module.exports = battery;
})
});
// file: lib/common/plugin/capture.js
define("cordova/plugin/capture", function(require, exports, module) {
@@ -4243,7 +4279,7 @@ Capture.prototype.captureVideo = function(successCallback, errorCallback, option
module.exports = new Capture();
})
});
// file: lib/common/plugin/compass.js
define("cordova/plugin/compass", function(require, exports, module) {
@@ -4261,7 +4297,7 @@ var exec = require('cordova/exec'),
* getting the heading data.
* @param {CompassOptions} options The options for getting the heading data (not used).
*/
getCurrentHeading:function(successCallback, errorCallback) {
getCurrentHeading:function(successCallback, errorCallback, options) {
// successCallback required
if (typeof successCallback !== "function") {
console.log("Compass Error: successCallback is not a function");
@@ -4284,7 +4320,7 @@ var exec = require('cordova/exec'),
}
// Get heading
exec(win, fail, "Compass", "getHeading", []);
exec(win, fail, "Compass", "getHeading", [options]);
},
/**
@@ -4294,11 +4330,13 @@ var exec = require('cordova/exec'),
* @param {Function} errorCallback The function to call when there is an error
* getting the heading data.
* @param {HeadingOptions} options The options for getting the heading data
* such as timeout and the frequency of the watch.
* such as timeout and the frequency of the watch. For iOS, filter parameter
* specifies to watch via a distance filter rather than time.
*/
watchHeading:function(successCallback, errorCallback, options) {
// Default interval (100 msec)
var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100;
var filter = (options !== undefined && options.filter !== undefined) ? options.filter : 0;
// successCallback required
if (typeof successCallback !== "function") {
@@ -4312,13 +4350,18 @@ var exec = require('cordova/exec'),
return;
}
// Start watch timer to get headings
var id = utils.createUUID();
timers[id] = window.setInterval(function() {
compass.getCurrentHeading(successCallback, errorCallback);
}, frequency);
if (filter > 0) {
// is an iOS request for watch by filter, no timer needed
timers[id] = "iOS";
compass.getCurrentHeading(successCallback, errorCallback, options);
} else {
// Start watch timer to get headings
timers[id] = window.setInterval(function() {
compass.getCurrentHeading(successCallback, errorCallback);
}, frequency);
}
return id;
},
@@ -4329,16 +4372,20 @@ var exec = require('cordova/exec'),
clearWatch:function(id) {
// Stop javascript timer & remove from timer list
if (id && timers[id]) {
clearInterval(timers[id]);
delete timers[id];
if (timers[id] != "iOS") {
clearInterval(timers[id]);
} else {
// is iOS watch by filter so call into device to stop
exec(null, null, "Compass", "stopHeading", []);
}
delete timers[id];
}
}
// TODO: add the filter-based iOS-only methods
};
module.exports = compass;
})
});
// file: lib/common/plugin/contacts.js
define("cordova/plugin/contacts", function(require, exports, module) {
@@ -4400,7 +4447,7 @@ var contacts = {
module.exports = contacts;
})
});
// file: lib/common/plugin/geolocation.js
define("cordova/plugin/geolocation", function(require, exports, module) {
@@ -4499,7 +4546,7 @@ var geolocation = {
module.exports = geolocation;
})
});
// file: lib/common/plugin/network.js
define("cordova/plugin/network", function(require, exports, module) {
@@ -4564,7 +4611,7 @@ NetworkConnection.prototype.getInfo = function (successCallback, errorCallback)
module.exports = new NetworkConnection();
})
});
// file: lib/common/plugin/notification.js
define("cordova/plugin/notification", function(require, exports, module) {
@@ -4625,7 +4672,7 @@ module.exports = {
}
};
})
});
// file: lib/common/plugin/requestFileSystem.js
define("cordova/plugin/requestFileSystem", function(require, exports, module) {
@@ -4670,7 +4717,7 @@ var requestFileSystem = function(type, size, successCallback, errorCallback) {
module.exports = requestFileSystem;
})
});
// file: lib/common/plugin/resolveLocalFileSystemURI.js
define("cordova/plugin/resolveLocalFileSystemURI", function(require, exports, module) {
@@ -4716,7 +4763,7 @@ module.exports = function(uri, successCallback, errorCallback) {
exec(success, fail, "File", "resolveLocalFileSystemURI", [uri]);
};
})
});
// file: lib/common/utils.js
define("cordova/utils", function(require, exports, module) {
@@ -4825,7 +4872,7 @@ var _self = {
module.exports = _self;
})
});
window.cordova = require('cordova');
+1 -1
View File
@@ -19,7 +19,7 @@
<html>
<head>
<title></title>
<script src="cordova-1.5.0.js"></script>
<script src="cordova-1.6.0.js"></script>
</head>
<body>
@@ -28,6 +28,7 @@ import android.os.Environment;
import android.util.Log;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
/**
@@ -116,7 +117,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On
public void startRecording(String file) {
if (this.mPlayer != null) {
Log.d(LOG_TAG, "AudioPlayer Error: Can't record in play mode.");
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERR_ABORTED+");");
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});");
}
// Make sure we're not already recording
@@ -137,11 +138,11 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On
} catch (IOException e) {
e.printStackTrace();
}
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERR_ABORTED+");");
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});");
}
else {
Log.d(LOG_TAG, "AudioPlayer Error: Already recording.");
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERR_ABORTED+");");
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});");
}
}
@@ -183,7 +184,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On
public void startPlaying(String file) {
if (this.recorder != null) {
Log.d(LOG_TAG, "AudioPlayer Error: Can't play in record mode.");
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERR_ABORTED+");");
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});");
}
// If this is a new request to play audio, or stopped
@@ -215,9 +216,16 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On
android.content.res.AssetFileDescriptor fd = this.handler.ctx.getBaseContext().getAssets().openFd(f);
this.mPlayer.setDataSource(fd.getFileDescriptor(), fd.getStartOffset(), fd.getLength());
}
else {
this.mPlayer.setDataSource("/sdcard/" + file);
}
else {
File fp = new File(file);
if (fp.exists()) {
FileInputStream fileInputStream = new FileInputStream(file);
this.mPlayer.setDataSource(fileInputStream.getFD());
}
else {
this.mPlayer.setDataSource("/sdcard/" + file);
}
}
this.setState(MEDIA_STARTING);
this.mPlayer.setOnPreparedListener(this);
this.mPlayer.prepare();
@@ -228,7 +236,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On
}
catch (Exception e) {
e.printStackTrace();
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERR_ABORTED+");");
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});");
}
}
@@ -242,7 +250,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On
}
else {
Log.d(LOG_TAG, "AudioPlayer Error: startPlaying() called during invalid state: "+this.state);
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERR_ABORTED+");");
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});");
}
}
}
@@ -270,7 +278,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On
}
else {
Log.d(LOG_TAG, "AudioPlayer Error: pausePlaying() called during invalid state: "+this.state);
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERR_NONE_ACTIVE+");");
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_NONE_ACTIVE+"});");
}
}
@@ -284,7 +292,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On
}
else {
Log.d(LOG_TAG, "AudioPlayer Error: stopPlaying() called during invalid state: "+this.state);
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERR_NONE_ACTIVE+");");
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_NONE_ACTIVE+"});");
}
}
@@ -413,7 +421,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On
this.mPlayer.release();
// Send error notification to JavaScript
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", "+arg1+");");
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', { \"code\":"+arg1+"});");
return false;
}
+1 -1
View File
@@ -38,7 +38,7 @@ import android.telephony.TelephonyManager;
public class Device extends Plugin {
public static final String TAG = "Device";
public static String cordovaVersion = "1.6.0rc1"; // Cordova version
public static String cordovaVersion = "1.6.0"; // Cordova version
public static String platform = "Android"; // Device OS
public static String uuid; // Device UUID
+10 -10
View File
@@ -973,23 +973,23 @@ public class FileUtils extends Plugin {
/**/
public long write(String filename, String data, int offset) throws FileNotFoundException, IOException {
filename = stripFileProtocol(filename);
boolean append = false;
if (offset > 0) {
this.truncateFile(filename, offset);
append = true;
}
byte [] rawData = data.getBytes();
ByteArrayInputStream in = new ByteArrayInputStream(rawData);
FileOutputStream out = new FileOutputStream(filename, append);
byte buff[] = new byte[rawData.length];
in.read(buff, 0, buff.length);
out.write(buff, 0, rawData.length);
out.flush();
out.close();
byte [] rawData = data.getBytes();
ByteArrayInputStream in = new ByteArrayInputStream(rawData);
FileOutputStream out = new FileOutputStream(filename, append);
byte buff[] = new byte[rawData.length];
in.read(buff, 0, buff.length);
out.write(buff, 0, rawData.length);
out.flush();
out.close();
return data.length();
return rawData.length;
}
/**