VideoIntent extends ContentIntent<VideoIntent> { @SuppressWarnings("ConstantConditions") @Override public VideoIntent withDefaultHandlers(@NonNull final Context context) { withHandlers( onCreateGalleryHandler(context.getResources()), cameraHandler = onCreateCameraHandler(context.getResources()) ); if (uri == null) { cameraHandler.intent.removeExtra(MediaStore.EXTRA_OUTPUT); } else { cameraHandler.intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); } return this; }  @NonNull static Intent createGalleryIntent(); @NonNull static Intent createCameraIntent(); @NonNull static Intent createCameraIntent(@Nullable final File outputFile); @NonNull static Intent createCameraIntent(@Nullable final Uri outputUri); @Nullable static File createVideoFile(); @Nullable static File createVideoFile(@NonNull final String fileName); @SuppressWarnings("ConstantConditions") @Override VideoIntent withDefaultHandlers(@NonNull final Context context); @Override VideoIntent input(@Nullable final Uri uri); @Override VideoIntent output(@Nullable final Uri uri); static final int REQUEST_CODE_GALLERY; static final int REQUEST_CODE_CAMERA; static final String VIDEO_FILE_NAME_FORMAT; }
@Test public void testWithDefaultHandlers() { final VideoIntent intent = new VideoIntent(); intent.withDefaultHandlers(context); final List<ContentIntent.ContentHandler> handlers = intent.handlers(); assertThat(handlers, is(notNullValue())); assertThat(handlers.size(), is(2)); final ContentIntent.ContentHandler galleryHandler = handlers.get(0); assertThat(galleryHandler.name().toString(), is("Gallery")); assertThat(galleryHandler.requestCode(), is(VideoIntent.REQUEST_CODE_GALLERY)); final ContentIntent.ContentHandler cameraHandler = handlers.get(1); assertThat(cameraHandler.name().toString(), is("Camera")); assertThat(cameraHandler.requestCode(), is(VideoIntent.REQUEST_CODE_CAMERA)); }