mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-01 02:12:58 +08:00
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-cordova-android
This commit is contained in:
commit
fc50a0d954
@ -1,6 +1,6 @@
|
|||||||
// commit a5f0a62f9a9dc5fd7af95ec3d09b6b17c0b89b44
|
// commit facaa38a0bd924aa15c14c372537c00382f1e593
|
||||||
|
|
||||||
// File generated at :: Mon May 07 2012 16:20:11 GMT-0700 (PDT)
|
// File generated at :: Thu May 10 2012 16:39:13 GMT-0700 (PDT)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
@ -98,17 +98,7 @@ var documentEventHandlers = {},
|
|||||||
|
|
||||||
document.addEventListener = function(evt, handler, capture) {
|
document.addEventListener = function(evt, handler, capture) {
|
||||||
var e = evt.toLowerCase();
|
var e = evt.toLowerCase();
|
||||||
if (e == 'deviceready') {
|
if (typeof documentEventHandlers[e] != 'undefined') {
|
||||||
channel.onDeviceReady.subscribeOnce(handler);
|
|
||||||
} else if (e == 'resume') {
|
|
||||||
channel.onResume.subscribe(handler);
|
|
||||||
// if subscribing listener after event has already fired, invoke the handler
|
|
||||||
if (channel.onResume.fired && typeof handler == 'function') {
|
|
||||||
handler();
|
|
||||||
}
|
|
||||||
} else if (e == 'pause') {
|
|
||||||
channel.onPause.subscribe(handler);
|
|
||||||
} else if (typeof documentEventHandlers[e] != 'undefined') {
|
|
||||||
documentEventHandlers[e].subscribe(handler);
|
documentEventHandlers[e].subscribe(handler);
|
||||||
} else {
|
} else {
|
||||||
m_document_addEventListener.call(document, evt, handler, capture);
|
m_document_addEventListener.call(document, evt, handler, capture);
|
||||||
@ -126,13 +116,8 @@ window.addEventListener = function(evt, handler, capture) {
|
|||||||
|
|
||||||
document.removeEventListener = function(evt, handler, capture) {
|
document.removeEventListener = function(evt, handler, capture) {
|
||||||
var e = evt.toLowerCase();
|
var e = evt.toLowerCase();
|
||||||
// Check for pause/resume events first.
|
|
||||||
if (e == 'resume') {
|
|
||||||
channel.onResume.unsubscribe(handler);
|
|
||||||
} else if (e == 'pause') {
|
|
||||||
channel.onPause.unsubscribe(handler);
|
|
||||||
// If unsubcribing from an event that is handled by a plugin
|
// If unsubcribing from an event that is handled by a plugin
|
||||||
} else if (typeof documentEventHandlers[e] != "undefined") {
|
if (typeof documentEventHandlers[e] != "undefined") {
|
||||||
documentEventHandlers[e].unsubscribe(handler);
|
documentEventHandlers[e].unsubscribe(handler);
|
||||||
} else {
|
} else {
|
||||||
m_document_removeEventListener.call(document, evt, handler, capture);
|
m_document_removeEventListener.call(document, evt, handler, capture);
|
||||||
@ -318,6 +303,11 @@ var cordova = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Register pause, resume and deviceready channels as events on document.
|
||||||
|
channel.onPause = cordova.addDocumentEventHandler('pause');
|
||||||
|
channel.onResume = cordova.addDocumentEventHandler('resume');
|
||||||
|
channel.onDeviceReady = cordova.addDocumentEventHandler('deviceready');
|
||||||
|
|
||||||
// Adds deprecation warnings to functions of an object (but only logs a message once)
|
// Adds deprecation warnings to functions of an object (but only logs a message once)
|
||||||
function deprecateFunctions(obj, objLabel) {
|
function deprecateFunctions(obj, objLabel) {
|
||||||
var newObj = {};
|
var newObj = {};
|
||||||
@ -645,10 +635,13 @@ Channel.prototype.unsubscribe = function(g) {
|
|||||||
if (g === null || g === undefined) { throw "You must pass _something_ into Channel.unsubscribe"; }
|
if (g === null || g === undefined) { throw "You must pass _something_ into Channel.unsubscribe"; }
|
||||||
|
|
||||||
if (typeof g == 'function') { g = g.observer_guid; }
|
if (typeof g == 'function') { g = g.observer_guid; }
|
||||||
|
var handler = this.handlers[g];
|
||||||
|
if (handler) {
|
||||||
this.handlers[g] = null;
|
this.handlers[g] = null;
|
||||||
delete this.handlers[g];
|
delete this.handlers[g];
|
||||||
this.numHandlers--;
|
this.numHandlers--;
|
||||||
if (this.events.onUnsubscribe) this.events.onUnsubscribe.call(this);
|
if (this.events.onUnsubscribe) this.events.onUnsubscribe.call(this);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1145,6 +1138,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// file: lib/common/plugin/Acceleration.js
|
// file: lib/common/plugin/Acceleration.js
|
||||||
@ -1986,6 +1980,21 @@ Entry.prototype.getMetadata = function(successCallback, errorCallback) {
|
|||||||
exec(success, fail, "File", "getMetadata", [this.fullPath]);
|
exec(success, fail, "File", "getMetadata", [this.fullPath]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the metadata of the entry.
|
||||||
|
*
|
||||||
|
* @param successCallback
|
||||||
|
* {Function} is called with a Metadata object
|
||||||
|
* @param errorCallback
|
||||||
|
* {Function} is called with a FileError
|
||||||
|
* @param metadataObject
|
||||||
|
* {Object} keys and values to set
|
||||||
|
*/
|
||||||
|
Entry.prototype.setMetadata = function(successCallback, errorCallback, metadataObject) {
|
||||||
|
|
||||||
|
exec(successCallback, errorCallback, "File", "setMetadata", [this.fullPath, metadataObject]);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move a file or directory to a new location.
|
* Move a file or directory to a new location.
|
||||||
*
|
*
|
||||||
|
@ -10,5 +10,5 @@
|
|||||||
# Indicates whether an apk should be generated for each density.
|
# Indicates whether an apk should be generated for each density.
|
||||||
split.density=false
|
split.density=false
|
||||||
# Project target.
|
# Project target.
|
||||||
target=android-14
|
target=Google Inc.:Google APIs:15
|
||||||
apk-configurations=
|
apk-configurations=
|
||||||
|
@ -813,7 +813,7 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send pause event to JavaScript
|
// Send pause event to JavaScript
|
||||||
this.appView.loadUrl("javascript:try{cordova.require('cordova/channel').onPause.fire();}catch(e){console.log('exception firing pause event from native');};");
|
this.appView.loadUrl("javascript:try{cordova.fireDocumentEvent('pause');}catch(e){console.log('exception firing pause event from native');};");
|
||||||
|
|
||||||
// Forward to plugins
|
// Forward to plugins
|
||||||
if (this.pluginManager != null) {
|
if (this.pluginManager != null) {
|
||||||
@ -858,7 +858,7 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send resume event to JavaScript
|
// Send resume event to JavaScript
|
||||||
this.appView.loadUrl("javascript:try{cordova.require('cordova/channel').onResume.fire();}catch(e){console.log('exception firing resume event from native');};");
|
this.appView.loadUrl("javascript:try{cordova.fireDocumentEvent('resume');}catch(e){console.log('exception firing resume event from native');};");
|
||||||
|
|
||||||
// Forward to plugins
|
// Forward to plugins
|
||||||
if (this.pluginManager != null) {
|
if (this.pluginManager != null) {
|
||||||
|
@ -220,7 +220,7 @@ public class FileUtils extends Plugin {
|
|||||||
* @param filePath the path to check
|
* @param filePath the path to check
|
||||||
*/
|
*/
|
||||||
private void notifyDelete(String filePath) {
|
private void notifyDelete(String filePath) {
|
||||||
String newFilePath = filePath.substring(7);
|
String newFilePath = stripFileProtocol(filePath);
|
||||||
int result = this.ctx.getContentResolver().delete(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
|
int result = this.ctx.getContentResolver().delete(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
|
||||||
MediaStore.Images.Media.DATA + " = ?",
|
MediaStore.Images.Media.DATA + " = ?",
|
||||||
new String[] {newFilePath});
|
new String[] {newFilePath});
|
||||||
|
Loading…
Reference in New Issue
Block a user