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