Merge branch 'hotfix/issue-76-XML-preview'

pull/1/head
Matt Fenlon 8 years ago
commit 058dec6b63
  1. 8
      camerakit/src/main/java/com/flurgle/camerakit/CameraView.java

@ -110,6 +110,7 @@ public class CameraView extends FrameLayout {
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) {
@ -117,6 +118,7 @@ public class CameraView extends FrameLayout {
mPreviewImpl.setDisplayOrientation(displayOrientation); mPreviewImpl.setDisplayOrientation(displayOrientation);
} }
}; };
}
final FocusMarkerLayout focusMarkerLayout = new FocusMarkerLayout(getContext()); final FocusMarkerLayout focusMarkerLayout = new FocusMarkerLayout(getContext());
addView(focusMarkerLayout); addView(focusMarkerLayout);
@ -137,12 +139,16 @@ public class CameraView extends FrameLayout {
@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() {

Loading…
Cancel
Save