Loading src/com/android/gallery3d/app/Gallery.java +21 −6 Original line number Diff line number Diff line Loading @@ -152,7 +152,14 @@ public final class Gallery extends AbstractGalleryActivity { finish(); return; } if (contentType.startsWith( if (uri == null) { int typeBits = GalleryUtils.determineTypeBits(this, intent); data.putInt(KEY_TYPE_BITS, typeBits); data.putString(AlbumSetPage.KEY_MEDIA_PATH, getDataManager().getTopSetPath(typeBits)); getStateManager().setLaunchGalleryOnTop(true); getStateManager().startState(AlbumSetPage.class, data); } else if (contentType.startsWith( ContentResolver.CURSOR_DIR_BASE_TYPE)) { int mediaType = intent.getIntExtra(KEY_MEDIA_TYPES, 0); if (mediaType != 0) { Loading @@ -160,11 +167,19 @@ public final class Gallery extends AbstractGalleryActivity { KEY_MEDIA_TYPES, String.valueOf(mediaType)) .build(); } Path albumPath = dm.findPathByUri(uri); if (albumPath != null) { MediaSet mediaSet = (MediaSet) dm.getMediaObject(albumPath); data.putString(AlbumPage.KEY_MEDIA_PATH, albumPath.toString()); Path setPath = dm.findPathByUri(uri); MediaSet mediaSet = null; if (setPath != null) { mediaSet = (MediaSet) dm.getMediaObject(setPath); } if (mediaSet != null) { if (mediaSet.isLeafAlbum()) { data.putString(AlbumPage.KEY_MEDIA_PATH, setPath.toString()); getStateManager().startState(AlbumPage.class, data); } else { data.putString(AlbumSetPage.KEY_MEDIA_PATH, setPath.toString()); getStateManager().startState(AlbumSetPage.class, data); } } else { startDefaultPage(); } Loading src/com/android/gallery3d/util/GalleryUtils.java +16 −16 Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ public class GalleryUtils { private static final String MIME_TYPE_IMAGE = "image/*"; private static final String MIME_TYPE_VIDEO = "video/*"; private static final String MIME_TYPE_ALL = "*/*"; private static final String DIR_TYPE_IMAGE = "vnd.android.cursor.dir/image"; private static final String DIR_TYPE_VIDEO = "vnd.android.cursor.dir/video"; private static final String PREFIX_PHOTO_EDITOR_UPDATE = "editor-update-"; private static final String PREFIX_HAS_PHOTO_EDITOR = "has-editor-"; Loading Loading @@ -277,24 +279,22 @@ public class GalleryUtils { public static int determineTypeBits(Context context, Intent intent) { int typeBits = 0; String type = intent.resolveType(context); if (intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY, false)) { if (MIME_TYPE_ALL.equals(type)) { typeBits = DataManager.INCLUDE_LOCAL_ALL_ONLY; } else if (MIME_TYPE_IMAGE.equals(type)) { typeBits = DataManager.INCLUDE_LOCAL_IMAGE_ONLY; } else if (MIME_TYPE_VIDEO.equals(type)) { typeBits = DataManager.INCLUDE_LOCAL_VIDEO_ONLY; } } else { if (MIME_TYPE_ALL.equals(type)) { typeBits = DataManager.INCLUDE_ALL; } else if (MIME_TYPE_IMAGE.equals(type)) { } else if (MIME_TYPE_IMAGE.equals(type) || DIR_TYPE_IMAGE.equals(type)) { typeBits = DataManager.INCLUDE_IMAGE; } else if (MIME_TYPE_VIDEO.equals(type)) { } else if (MIME_TYPE_VIDEO.equals(type) || DIR_TYPE_VIDEO.equals(type)) { typeBits = DataManager.INCLUDE_VIDEO; } else { typeBits = DataManager.INCLUDE_ALL; } if (intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY, false)) { typeBits |= DataManager.INCLUDE_LOCAL_ONLY; } if (typeBits == 0) typeBits = DataManager.INCLUDE_ALL; return typeBits; } Loading Loading
src/com/android/gallery3d/app/Gallery.java +21 −6 Original line number Diff line number Diff line Loading @@ -152,7 +152,14 @@ public final class Gallery extends AbstractGalleryActivity { finish(); return; } if (contentType.startsWith( if (uri == null) { int typeBits = GalleryUtils.determineTypeBits(this, intent); data.putInt(KEY_TYPE_BITS, typeBits); data.putString(AlbumSetPage.KEY_MEDIA_PATH, getDataManager().getTopSetPath(typeBits)); getStateManager().setLaunchGalleryOnTop(true); getStateManager().startState(AlbumSetPage.class, data); } else if (contentType.startsWith( ContentResolver.CURSOR_DIR_BASE_TYPE)) { int mediaType = intent.getIntExtra(KEY_MEDIA_TYPES, 0); if (mediaType != 0) { Loading @@ -160,11 +167,19 @@ public final class Gallery extends AbstractGalleryActivity { KEY_MEDIA_TYPES, String.valueOf(mediaType)) .build(); } Path albumPath = dm.findPathByUri(uri); if (albumPath != null) { MediaSet mediaSet = (MediaSet) dm.getMediaObject(albumPath); data.putString(AlbumPage.KEY_MEDIA_PATH, albumPath.toString()); Path setPath = dm.findPathByUri(uri); MediaSet mediaSet = null; if (setPath != null) { mediaSet = (MediaSet) dm.getMediaObject(setPath); } if (mediaSet != null) { if (mediaSet.isLeafAlbum()) { data.putString(AlbumPage.KEY_MEDIA_PATH, setPath.toString()); getStateManager().startState(AlbumPage.class, data); } else { data.putString(AlbumSetPage.KEY_MEDIA_PATH, setPath.toString()); getStateManager().startState(AlbumSetPage.class, data); } } else { startDefaultPage(); } Loading
src/com/android/gallery3d/util/GalleryUtils.java +16 −16 Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ public class GalleryUtils { private static final String MIME_TYPE_IMAGE = "image/*"; private static final String MIME_TYPE_VIDEO = "video/*"; private static final String MIME_TYPE_ALL = "*/*"; private static final String DIR_TYPE_IMAGE = "vnd.android.cursor.dir/image"; private static final String DIR_TYPE_VIDEO = "vnd.android.cursor.dir/video"; private static final String PREFIX_PHOTO_EDITOR_UPDATE = "editor-update-"; private static final String PREFIX_HAS_PHOTO_EDITOR = "has-editor-"; Loading Loading @@ -277,24 +279,22 @@ public class GalleryUtils { public static int determineTypeBits(Context context, Intent intent) { int typeBits = 0; String type = intent.resolveType(context); if (intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY, false)) { if (MIME_TYPE_ALL.equals(type)) { typeBits = DataManager.INCLUDE_LOCAL_ALL_ONLY; } else if (MIME_TYPE_IMAGE.equals(type)) { typeBits = DataManager.INCLUDE_LOCAL_IMAGE_ONLY; } else if (MIME_TYPE_VIDEO.equals(type)) { typeBits = DataManager.INCLUDE_LOCAL_VIDEO_ONLY; } } else { if (MIME_TYPE_ALL.equals(type)) { typeBits = DataManager.INCLUDE_ALL; } else if (MIME_TYPE_IMAGE.equals(type)) { } else if (MIME_TYPE_IMAGE.equals(type) || DIR_TYPE_IMAGE.equals(type)) { typeBits = DataManager.INCLUDE_IMAGE; } else if (MIME_TYPE_VIDEO.equals(type)) { } else if (MIME_TYPE_VIDEO.equals(type) || DIR_TYPE_VIDEO.equals(type)) { typeBits = DataManager.INCLUDE_VIDEO; } else { typeBits = DataManager.INCLUDE_ALL; } if (intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY, false)) { typeBits |= DataManager.INCLUDE_LOCAL_ONLY; } if (typeBits == 0) typeBits = DataManager.INCLUDE_ALL; return typeBits; } Loading