Skip to content

Commit

Permalink
feat(android): restore state when useCamera2api is enabled (react-nat…
Browse files Browse the repository at this point in the history
  • Loading branch information
Martlohmus12 authored and sibelius committed Dec 2, 2019
1 parent fe84811 commit 1f8b863
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ void setPictureSize(Size size) {
mStillImageReader.close();
}
if (size == null) {
if (mAspectRatio == null) {
if (mAspectRatio == null || mPictureSize == null) {
return;
}
mPictureSizes.sizes(mAspectRatio).last();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ public void setUsingCamera2Api(boolean useCamera2) {
} else {
mImpl = new Camera2Api23(mCallbacks, mImpl.mPreview, mContext, mBgHandler);
}

onRestoreInstanceState(state);
} else {
if (mImpl instanceof Camera1) {
return;
Expand All @@ -316,7 +318,7 @@ public void start() {
this.removeView(mImpl.getView());
}
//store the state and restore this state after fall back to Camera1
Parcelable state=onSaveInstanceState();
Parcelable state = onSaveInstanceState();
// Camera2 uses legacy hardware layer; fall back to Camera1
mImpl = new Camera1(mCallbacks, createPreviewImpl(getContext()), mBgHandler);
onRestoreInstanceState(state);
Expand Down

0 comments on commit 1f8b863

Please sign in to comment.