|
|
|
@ -151,6 +151,7 @@ public class CameraView extends FrameLayout implements LifecycleObserver { |
|
|
|
|
setPermissions(mPermissions); |
|
|
|
|
setVideoQuality(mVideoQuality); |
|
|
|
|
|
|
|
|
|
if (!isInEditMode()) { |
|
|
|
|
mDisplayOrientationDetector = new DisplayOrientationDetector(context) { |
|
|
|
|
@Override |
|
|
|
|
public void onDisplayOrientationChanged(int displayOrientation) { |
|
|
|
@ -173,22 +174,27 @@ public class CameraView extends FrameLayout implements LifecycleObserver { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
mLifecycle = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected void onAttachedToWindow() { |
|
|
|
|
super.onAttachedToWindow(); |
|
|
|
|
if (!isInEditMode()) { |
|
|
|
|
mDisplayOrientationDetector.enable( |
|
|
|
|
ViewCompat.isAttachedToWindow(this) |
|
|
|
|
? DisplayManagerCompat.getInstance(getContext()).getDisplay(Display.DEFAULT_DISPLAY) |
|
|
|
|
: null |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected void onDetachedFromWindow() { |
|
|
|
|
if (!isInEditMode()) { |
|
|
|
|
mDisplayOrientationDetector.disable(); |
|
|
|
|
} |
|
|
|
|
super.onDetachedFromWindow(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|