@Test public void videoSizeNoCamera() { RecordingInfo size = calculateRecordingInfo(1080, 1920, 160, false, -1, -1, 30, 100); assertThat(size.width).isEqualTo(1080); assertThat(size.height).isEqualTo(1920); assertThat(size.density).isEqualTo(160); }
static RecordingInfo calculateRecordingInfo(int displayWidth, int displayHeight, int displayDensity, boolean isLandscapeDevice, int cameraWidth, int cameraHeight, int cameraFrameRate, int sizePercentage) { displayWidth = displayWidth * sizePercentage / 100; displayHeight = displayHeight * sizePercentage / 100; if (cameraWidth == -1 && cameraHeight == -1) { return new RecordingInfo(displayWidth, displayHeight, cameraFrameRate, displayDensity); } int frameWidth = isLandscapeDevice ? cameraWidth : cameraHeight; int frameHeight = isLandscapeDevice ? cameraHeight : cameraWidth; if (frameWidth >= displayWidth && frameHeight >= displayHeight) { return new RecordingInfo(displayWidth, displayHeight, cameraFrameRate, displayDensity); } if (isLandscapeDevice) { frameWidth = displayWidth * frameHeight / displayHeight; } else { frameHeight = displayHeight * frameWidth / displayWidth; } return new RecordingInfo(frameWidth, frameHeight, cameraFrameRate, displayDensity); }
RecordingSession { static RecordingInfo calculateRecordingInfo(int displayWidth, int displayHeight, int displayDensity, boolean isLandscapeDevice, int cameraWidth, int cameraHeight, int cameraFrameRate, int sizePercentage) { displayWidth = displayWidth * sizePercentage / 100; displayHeight = displayHeight * sizePercentage / 100; if (cameraWidth == -1 && cameraHeight == -1) { return new RecordingInfo(displayWidth, displayHeight, cameraFrameRate, displayDensity); } int frameWidth = isLandscapeDevice ? cameraWidth : cameraHeight; int frameHeight = isLandscapeDevice ? cameraHeight : cameraWidth; if (frameWidth >= displayWidth && frameHeight >= displayHeight) { return new RecordingInfo(displayWidth, displayHeight, cameraFrameRate, displayDensity); } if (isLandscapeDevice) { frameWidth = displayWidth * frameHeight / displayHeight; } else { frameHeight = displayHeight * frameWidth / displayWidth; } return new RecordingInfo(frameWidth, frameHeight, cameraFrameRate, displayDensity); } }
RecordingSession { static RecordingInfo calculateRecordingInfo(int displayWidth, int displayHeight, int displayDensity, boolean isLandscapeDevice, int cameraWidth, int cameraHeight, int cameraFrameRate, int sizePercentage) { displayWidth = displayWidth * sizePercentage / 100; displayHeight = displayHeight * sizePercentage / 100; if (cameraWidth == -1 && cameraHeight == -1) { return new RecordingInfo(displayWidth, displayHeight, cameraFrameRate, displayDensity); } int frameWidth = isLandscapeDevice ? cameraWidth : cameraHeight; int frameHeight = isLandscapeDevice ? cameraHeight : cameraWidth; if (frameWidth >= displayWidth && frameHeight >= displayHeight) { return new RecordingInfo(displayWidth, displayHeight, cameraFrameRate, displayDensity); } if (isLandscapeDevice) { frameWidth = displayWidth * frameHeight / displayHeight; } else { frameHeight = displayHeight * frameWidth / displayWidth; } return new RecordingInfo(frameWidth, frameHeight, cameraFrameRate, displayDensity); } RecordingSession(Context context, Listener listener, int resultCode, Intent data,
      Analytics analytics, Provider<Boolean> showCountDown, Provider<Integer> videoSizePercentage); }
RecordingSession { static RecordingInfo calculateRecordingInfo(int displayWidth, int displayHeight, int displayDensity, boolean isLandscapeDevice, int cameraWidth, int cameraHeight, int cameraFrameRate, int sizePercentage) { displayWidth = displayWidth * sizePercentage / 100; displayHeight = displayHeight * sizePercentage / 100; if (cameraWidth == -1 && cameraHeight == -1) { return new RecordingInfo(displayWidth, displayHeight, cameraFrameRate, displayDensity); } int frameWidth = isLandscapeDevice ? cameraWidth : cameraHeight; int frameHeight = isLandscapeDevice ? cameraHeight : cameraWidth; if (frameWidth >= displayWidth && frameHeight >= displayHeight) { return new RecordingInfo(displayWidth, displayHeight, cameraFrameRate, displayDensity); } if (isLandscapeDevice) { frameWidth = displayWidth * frameHeight / displayHeight; } else { frameHeight = displayHeight * frameWidth / displayWidth; } return new RecordingInfo(frameWidth, frameHeight, cameraFrameRate, displayDensity); } RecordingSession(Context context, Listener listener, int resultCode, Intent data,
      Analytics analytics, Provider<Boolean> showCountDown, Provider<Integer> videoSizePercentage);  }
RecordingSession { static RecordingInfo calculateRecordingInfo(int displayWidth, int displayHeight, int displayDensity, boolean isLandscapeDevice, int cameraWidth, int cameraHeight, int cameraFrameRate, int sizePercentage) { displayWidth = displayWidth * sizePercentage / 100; displayHeight = displayHeight * sizePercentage / 100; if (cameraWidth == -1 && cameraHeight == -1) { return new RecordingInfo(displayWidth, displayHeight, cameraFrameRate, displayDensity); } int frameWidth = isLandscapeDevice ? cameraWidth : cameraHeight; int frameHeight = isLandscapeDevice ? cameraHeight : cameraWidth; if (frameWidth >= displayWidth && frameHeight >= displayHeight) { return new RecordingInfo(displayWidth, displayHeight, cameraFrameRate, displayDensity); } if (isLandscapeDevice) { frameWidth = displayWidth * frameHeight / displayHeight; } else { frameHeight = displayHeight * frameWidth / displayWidth; } return new RecordingInfo(frameWidth, frameHeight, cameraFrameRate, displayDensity); } RecordingSession(Context context, Listener listener, int resultCode, Intent data,
      Analytics analytics, Provider<Boolean> showCountDown, Provider<Integer> videoSizePercentage);   }