mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-31 17:32:51 +08:00
Modify JS code to use service name rather than class name.
This commit is contained in:
parent
fb281ddc9f
commit
040a3d7d43
@ -1,25 +1,15 @@
|
||||
com.phonegap.CryptoHandlerProxy = function() {
|
||||
this.className = "com.phonegap.CryptoHandler";
|
||||
};
|
||||
com.phonegap.CryptoHandlerProxy.prototype.encrypt = function(pass, text) {
|
||||
return PhoneGap.exec(this.className, "encrypt", [pass, text]);
|
||||
};
|
||||
com.phonegap.CryptoHandlerProxy.prototype.decrypt = function(pass, text) {
|
||||
return PhoneGap.exec(this.className, "decrypt", [pass, text]);
|
||||
};
|
||||
com.phonegap.CryptoHandler = new com.phonegap.CryptoHandlerProxy();
|
||||
|
||||
var Crypto = function() {
|
||||
};
|
||||
|
||||
Crypto.prototype.encrypt = function(seed, string, callback) {
|
||||
com.phonegap.CryptoHandler.encrypt(seed, string);
|
||||
this.encryptWin = callback;
|
||||
PhoneGap.execAsync(null, null, "Crypto", "encrypt", [seed, string]);
|
||||
};
|
||||
|
||||
Crypto.prototype.decrypt = function(seed, string, callback) {
|
||||
com.phonegap.CryptoHandler.decrypt(seed, string);
|
||||
this.decryptWin = callback;
|
||||
PhoneGap.execAsync(null, null, "Crypto", "decrypt", [seed, string]);
|
||||
};
|
||||
|
||||
Crypto.prototype.gotCryptedString = function(string) {
|
||||
|
@ -135,21 +135,21 @@ MediaError.MEDIA_ERR_NONE_SUPPORTED = 4;
|
||||
* Start or resume playing audio file.
|
||||
*/
|
||||
Media.prototype.play = function() {
|
||||
PhoneGap.execAsync(null, null, "com.phonegap.AudioHandler", "startPlayingAudio", [this.id, this.src]);
|
||||
PhoneGap.execAsync(null, null, "Media", "startPlayingAudio", [this.id, this.src]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Stop playing audio file.
|
||||
*/
|
||||
Media.prototype.stop = function() {
|
||||
return PhoneGap.execAsync(null, null, "com.phonegap.AudioHandler", "stopPlayingAudio", [this.id]);
|
||||
return PhoneGap.execAsync(null, null, "Media", "stopPlayingAudio", [this.id]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Pause playing audio file.
|
||||
*/
|
||||
Media.prototype.pause = function() {
|
||||
PhoneGap.execAsync(null, null, "com.phonegap.AudioHandler", "pausePlayingAudio", [this.id]);
|
||||
PhoneGap.execAsync(null, null, "Media", "pausePlayingAudio", [this.id]);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -168,20 +168,20 @@ Media.prototype.getDuration = function() {
|
||||
* @return
|
||||
*/
|
||||
Media.prototype.getCurrentPosition = function(success, fail) {
|
||||
PhoneGap.execAsync(success, fail, "com.phonegap.AudioHandler", "getCurrentPositionAudio", [this.id]);
|
||||
PhoneGap.execAsync(success, fail, "Media", "getCurrentPositionAudio", [this.id]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Start recording audio file.
|
||||
*/
|
||||
Media.prototype.startRecord = function() {
|
||||
PhoneGap.execAsync(null, null, "com.phonegap.AudioHandler", "startRecordingAudio", [this.id, this.src]);
|
||||
PhoneGap.execAsync(null, null, "Media", "startRecordingAudio", [this.id, this.src]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Stop recording audio file.
|
||||
*/
|
||||
Media.prototype.stopRecord = function() {
|
||||
PhoneGap.execAsync(null, null, "com.phonegap.AudioHandler", "stopRecordingAudio", [this.id]);
|
||||
PhoneGap.execAsync(null, null, "Media", "stopRecordingAudio", [this.id]);
|
||||
};
|
||||
|
||||
|
@ -1,13 +1,3 @@
|
||||
com.phonegap.StorageProxy = function() {
|
||||
this.className = "com.phonegap.Storage";
|
||||
};
|
||||
com.phonegap.StorageProxy.prototype.executeSql = function(query, params, id) {
|
||||
return PhoneGap.exec(this.className, "executeSql", [query, params, id]);
|
||||
};
|
||||
com.phonegap.StorageProxy.prototype.openDatabase = function(name, version, display_name, size) {
|
||||
return PhoneGap.exec(this.className, "openDatabase", [name, version, display_name, size]);
|
||||
};
|
||||
com.phonegap.Storage = new com.phonegap.StorageProxy();
|
||||
|
||||
/*
|
||||
* This is purely for the Android 1.5/1.6 HTML 5 Storage
|
||||
@ -53,7 +43,7 @@ var Tx = function() {
|
||||
};
|
||||
|
||||
Tx.prototype.executeSql = function(query, params, win, fail) {
|
||||
com.phonegap.Storage.executeSql(query, params, this.id);
|
||||
PhoneGap.execAsync(null, null, "Storage", "executeSql", [query, params, this.id]);
|
||||
tx.win = win;
|
||||
tx.fail = fail;
|
||||
};
|
||||
@ -72,7 +62,7 @@ Rows.prototype.item = function(row_id) {
|
||||
};
|
||||
|
||||
var dbSetup = function(name, version, display_name, size) {
|
||||
com.phonegap.Storage.openDatabase(name, version, display_name, size)
|
||||
PhoneGap.execAsync(null, null, "Storage", "openDatabase", [name, version, display_name, size]);
|
||||
db_object = new DatabaseShell();
|
||||
return db_object;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user