diff options
author | kaiyiz <kaiyiz@codeaurora.org> | 2014-12-10 17:20:18 +0800 |
---|---|---|
committer | kaiyiz <kaiyiz@codeaurora.org> | 2014-12-11 14:06:24 +0800 |
commit | 9b405b8e1c3c8ccd9b75ff5f3a23b18ceb8842ae (patch) | |
tree | a5fb8d6222c97c0a0cd08afa68301a7f82527681 /src/org/codeaurora/gallery3d | |
parent | 946cc8ee895d01774c2a75239e5892e9593419d7 (diff) | |
download | android_packages_apps_Gallery2-9b405b8e1c3c8ccd9b75ff5f3a23b18ceb8842ae.tar.gz android_packages_apps_Gallery2-9b405b8e1c3c8ccd9b75ff5f3a23b18ceb8842ae.tar.bz2 android_packages_apps_Gallery2-9b405b8e1c3c8ccd9b75ff5f3a23b18ceb8842ae.zip |
Gallery2: Play all video file can pre/next in FileExplorer
The initial video can only previous and next in the current
directory.
List all video file and play it all through pre/next function
CRs-Fixed: 704384
Change-Id: Ifd2caac0f2f2df61ee08af82ac7324848807055c
Diffstat (limited to 'src/org/codeaurora/gallery3d')
-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; + } } } |