summaryrefslogtreecommitdiffstats
path: root/src/org/codeaurora/gallery3d/ext/MovieListLoader.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/codeaurora/gallery3d/ext/MovieListLoader.java')
-rw-r--r--src/org/codeaurora/gallery3d/ext/MovieListLoader.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/org/codeaurora/gallery3d/ext/MovieListLoader.java b/src/org/codeaurora/gallery3d/ext/MovieListLoader.java
index cb3505650..840477ff6 100644
--- a/src/org/codeaurora/gallery3d/ext/MovieListLoader.java
+++ b/src/org/codeaurora/gallery3d/ext/MovieListLoader.java
@@ -115,6 +115,9 @@ public class MovieListLoader implements IMovieListLoader {
//from gallery, gallery3D, videoplayer
long curId = Long.parseLong(uri.getPathSegments().get(3));
movieList = fillUriList(null, null, curId, params[0]);
+ } else if (uristr.toLowerCase().startsWith("file://")) {
+ long curId = getCursorId(uri);
+ movieList = fillUriList(null, null, curId, params[0]);
}
}
} else { //get current list
@@ -199,5 +202,30 @@ public class MovieListLoader implements IMovieListLoader {
}
return movieList;
}
+
+ private long getCursorId(Uri uri) {
+ long curId = -1;
+ Cursor cursor = null;
+ String data = Uri.decode(uri.toString());
+ data = data.replaceAll("'", "''");
+ String where = "_data LIKE '%" + data.replaceFirst("file:///", "") + "'";
+ try {
+ cursor = mCr.query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
+ new String[] {
+ "_id"
+ }, where, null, null);
+
+ if (cursor != null && cursor.moveToFirst()) {
+ curId = cursor.getLong(0);
+ }
+ } catch (final SQLiteException e) {
+ e.printStackTrace();
+ } finally {
+ if (cursor != null) {
+ cursor.close();
+ }
+ }
+ return curId;
+ }
}
}