diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2014-12-15 16:15:37 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2014-12-15 16:15:37 -0800 |
commit | 3ff555aa6f6ef4cb342bef60d277df38b60483fc (patch) | |
tree | 3428e6c4e9c1ba64bdfef57550d04c32bc5c8ab1 /src/org | |
parent | 0505335eb9301983e082a680d1fc59f8c93c9323 (diff) | |
parent | 9b405b8e1c3c8ccd9b75ff5f3a23b18ceb8842ae (diff) | |
download | android_packages_apps_Gallery2-3ff555aa6f6ef4cb342bef60d277df38b60483fc.tar.gz android_packages_apps_Gallery2-3ff555aa6f6ef4cb342bef60d277df38b60483fc.tar.bz2 android_packages_apps_Gallery2-3ff555aa6f6ef4cb342bef60d277df38b60483fc.zip |
Merge "Gallery2: Play all video file can pre/next in FileExplorer"
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/codeaurora/gallery3d/ext/MovieListLoader.java | 28 |
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; + } } } |