Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions library/src/main/api21/com/google/android/cameraview/Camera2.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,19 @@ Set<AspectRatio> getSupportedAspectRatios() {

@Override
boolean setAspectRatio(AspectRatio ratio) {
if (ratio == null || ratio.equals(mAspectRatio) ||
!mPreviewSizes.ratios().contains(ratio)) {
if (ratio == null || ratio.equals(mAspectRatio)) {
// TODO: Better error handling
return false;
}
if (!mPreviewSizes.ratios().contains(ratio)) {
if (mPreviewSizes.ratios().size() <= 0) {
// may be initialized from layout xml
mAspectRatio = ratio;
return true;
}
return false;
}

mAspectRatio = ratio;
prepareImageReader();
if (mCaptureSession != null) {
Expand Down