You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2015/03/11 16:35:20 UTC
[09/13] cordova-plugin-file git commit: android: Use
`CordovaResourceApi.mapUriToFile()` rather than own custom logic in
ContentFilesystem
android: Use `CordovaResourceApi.mapUriToFile()` rather than own custom logic in ContentFilesystem
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/81ea13cf
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/81ea13cf
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/81ea13cf
Branch: refs/heads/master
Commit: 81ea13cf783359ee9db26bfd89bebcba241858e0
Parents: 4d1c277
Author: Andrew Grieve <ag...@chromium.org>
Authored: Mon Mar 9 14:19:52 2015 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Mar 11 11:35:07 2015 -0400
----------------------------------------------------------------------
src/android/ContentFilesystem.java | 21 ++-------------------
1 file changed, 2 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/81ea13cf/src/android/ContentFilesystem.java
----------------------------------------------------------------------
diff --git a/src/android/ContentFilesystem.java b/src/android/ContentFilesystem.java
index 79e1ecc..f577054 100644
--- a/src/android/ContentFilesystem.java
+++ b/src/android/ContentFilesystem.java
@@ -251,15 +251,6 @@ public class ContentFilesystem extends Filesystem {
return cursor;
}
- protected String filesystemPathForCursor(Cursor cursor) {
- final String[] LOCAL_FILE_PROJECTION = { MediaStore.Images.Media.DATA };
- int columnIndex = cursor.getColumnIndex(LOCAL_FILE_PROJECTION[0]);
- if (columnIndex != -1) {
- return cursor.getString(columnIndex);
- }
- return null;
- }
-
protected Integer resourceSizeForCursor(Cursor cursor) {
int columnIndex = cursor.getColumnIndex(OpenableColumns.SIZE);
if (columnIndex != -1) {
@@ -285,16 +276,8 @@ public class ContentFilesystem extends Filesystem {
@Override
public String filesystemPathForURL(LocalFilesystemURL url) {
- Cursor cursor = openCursorForURL(url);
- try {
- if (cursor != null && cursor.moveToFirst()) {
- return filesystemPathForCursor(cursor);
- }
- } finally {
- if (cursor != null)
- cursor.close();
- }
- return null;
+ File f = resourceApi.mapUriToFile(url.URL);
+ return f == null ? null : f.getAbsolutePath();
}
@Override
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org