Fix in-app camera rotation in multiview.

This commit is contained in:
Nicholas Tinsley
2024-03-18 15:44:25 -04:00
committed by Cody Henthorne
parent e24c951d83
commit 7d5627b17b

View File

@@ -143,6 +143,20 @@ public class CameraXFragment extends LoggingFragment implements CameraFragment {
return inflater.inflate(R.layout.camerax_fragment, container, false);
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (cameraController != null) {
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
orientationListener.enable();
} else {
orientationListener.disable();
cameraController.setImageRotation(0);
}
}
}
@SuppressLint("MissingPermission")
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {