From 8a08a59b07d830f6cf8156ff4eb46ac8ac0573fa Mon Sep 17 00:00:00 2001 From: Jeroen Mols Date: Sun, 12 Mar 2017 21:23:20 +0100 Subject: [PATCH] Use builder in example --- .../CaptureDemoFragment.java | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/example/src/main/java/com/jmolsmobile/landscapevideocapture_sample/CaptureDemoFragment.java b/example/src/main/java/com/jmolsmobile/landscapevideocapture_sample/CaptureDemoFragment.java index 1cd2863..3ab70bf 100644 --- a/example/src/main/java/com/jmolsmobile/landscapevideocapture_sample/CaptureDemoFragment.java +++ b/example/src/main/java/com/jmolsmobile/landscapevideocapture_sample/CaptureDemoFragment.java @@ -45,7 +45,6 @@ import com.jmolsmobile.landscapevideocapture.VideoCaptureActivity; import com.jmolsmobile.landscapevideocapture.configuration.CaptureConfiguration; -import com.jmolsmobile.landscapevideocapture.configuration.PredefinedCaptureConfigurations; import com.jmolsmobile.landscapevideocapture.configuration.PredefinedCaptureConfigurations.CaptureQuality; import com.jmolsmobile.landscapevideocapture.configuration.PredefinedCaptureConfigurations.CaptureResolution; @@ -233,30 +232,35 @@ private Bitmap getThumbnail() { private CaptureConfiguration createCaptureConfiguration() { final CaptureResolution resolution = getResolution(resolutionSp.getSelectedItemPosition()); final CaptureQuality quality = getQuality(qualitySp.getSelectedItemPosition()); - int fileDuration = CaptureConfiguration.NO_DURATION_LIMIT; + + CaptureConfiguration.Builder builder = new CaptureConfiguration.Builder(resolution, quality); + try { - fileDuration = Integer.valueOf(maxDurationEt.getEditableText().toString()); + int maxDuration = Integer.valueOf(maxDurationEt.getEditableText().toString()); + builder.maxDuration(maxDuration); } catch (final Exception e) { //NOP } - int filesize = CaptureConfiguration.NO_FILESIZE_LIMIT; try { - filesize = Integer.valueOf(maxFilesizeEt.getEditableText().toString()); - } catch (final Exception e2) { + int maxFileSize = Integer.valueOf(maxFilesizeEt.getEditableText().toString()); + builder.maxFileSize(maxFileSize); + } catch (final Exception e) { //NOP } - int fps = PredefinedCaptureConfigurations.FPS_30; try { - fps = Integer.valueOf(fpsEt.getEditableText().toString()); - } catch (final Exception e2) { + int fps = Integer.valueOf(fpsEt.getEditableText().toString()); + builder.frameRate(fps); + } catch (final Exception e) { //NOP } - boolean showTimer = showTimerCb.isChecked(); - boolean allowFrontCamera = allowFrontCameraCb.isChecked(); - return new CaptureConfiguration(resolution, quality, - fileDuration, filesize, showTimer, - allowFrontCamera, - fps); + if (showTimerCb.isChecked()) { + builder.showRecordingTime(); + } + if (!allowFrontCameraCb.isChecked()) { + builder.noCameraToggle(); + } + + return builder.build(); } private CaptureQuality getQuality(int position) {