mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
When you use the File API to remove a file need to check to see if we need to delete a row from the content store
This commit is contained in:
parent
367d7500d5
commit
6098f46d08
@ -158,6 +158,7 @@ public class FileUtils extends Plugin {
|
|||||||
success = remove(args.getString(0));
|
success = remove(args.getString(0));
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
|
notifyDelete(args.getString(0));
|
||||||
return new PluginResult(status);
|
return new PluginResult(status);
|
||||||
} else {
|
} else {
|
||||||
JSONObject error = new JSONObject().put("code", FileUtils.NO_MODIFICATION_ALLOWED_ERR);
|
JSONObject error = new JSONObject().put("code", FileUtils.NO_MODIFICATION_ALLOWED_ERR);
|
||||||
@ -221,6 +222,17 @@ public class FileUtils extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Need to check to see if we need to clean up the content store
|
||||||
|
*
|
||||||
|
* @param filePath the path to check
|
||||||
|
*/
|
||||||
|
private void notifyDelete(String filePath) {
|
||||||
|
int result = this.ctx.getContentResolver().delete(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
|
||||||
|
MediaStore.Images.Media.DATA + " = ?",
|
||||||
|
new String[] {filePath});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* Allows the user to look up the Entry for a file or directory referred to by a local URI.
|
* Allows the user to look up the Entry for a file or directory referred to by a local URI.
|
||||||
*
|
*
|
||||||
* @param url of the file/directory to look up
|
* @param url of the file/directory to look up
|
||||||
|
Loading…
Reference in New Issue
Block a user