diff --git a/cameraview/build.gradle b/cameraview/build.gradle index 7df79691..d7e67bd8 100644 --- a/cameraview/build.gradle +++ b/cameraview/build.gradle @@ -27,8 +27,5 @@ android { dependencies { compile 'com.android.support:exifinterface:25.3.1' compile 'com.android.support:support-annotations:25.3.1' - compile 'android.arch.lifecycle:runtime:1.0.0-alpha1' - compile 'android.arch.lifecycle:extensions:1.0.0-alpha1' - annotationProcessor 'android.arch.lifecycle:compiler:1.0.0-alpha1' } diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java index 089b95c9..249d0aa2 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java @@ -3,10 +3,6 @@ package com.otaliastudios.cameraview; import android.Manifest; import android.annotation.TargetApi; import android.app.Activity; -import android.arch.lifecycle.Lifecycle; -import android.arch.lifecycle.LifecycleObserver; -import android.arch.lifecycle.LifecycleOwner; -import android.arch.lifecycle.OnLifecycleEvent; import android.content.Context; import android.content.ContextWrapper; import android.content.pm.PackageInfo; @@ -50,25 +46,12 @@ import static android.view.View.MeasureSpec.UNSPECIFIED; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; /** - * The CameraView implements the LifecycleObserver interface for ease of use. To take advantage of - * this, simply call the following from any LifecycleOwner: - *
- * {@code - * protected void onCreate(@Nullable Bundle savedInstanceState) { - * super.onCreate(savedInstanceState); - * setContentView(R.layout.my_view); - * ... - * getLifecycle().addObserver(mCameraView); - * } - * } - *- * * TODO: docs for gestures * TODO: README for gestures * TODO: deprecate setFocus, CONTINUOUS should be the default * */ -public class CameraView extends FrameLayout implements LifecycleObserver { +public class CameraView extends FrameLayout { private final static String TAG = CameraView.class.getSimpleName(); @@ -97,7 +80,6 @@ public class CameraView extends FrameLayout implements LifecycleObserver { private CameraController mCameraController; private Preview mPreviewImpl; - private Lifecycle mLifecycle; private GridLinesLayout mGridLinesLayout; private PinchGestureLayout mPinchGestureLayout; private TapGestureLayout mTapGestureLayout; @@ -175,7 +157,6 @@ public class CameraView extends FrameLayout implements LifecycleObserver { } }; } - mLifecycle = null; } @Override @@ -442,39 +423,6 @@ public class CameraView extends FrameLayout implements LifecycleObserver { } - @Override - public void setEnabled(boolean enabled) { - super.setEnabled(enabled); - if (mLifecycle != null && mLifecycle.getCurrentState().isAtLeast(Lifecycle.State.RESUMED)) { - // Potentially update the UI - if (enabled) { - start(); - } else { - stop(); - } - } - } - - @OnLifecycleEvent(Lifecycle.Event.ON_RESUME) - public void onResume(LifecycleOwner owner) { - mLifecycle = owner.getLifecycle(); - start(); - } - - - @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE) - public void onPause(LifecycleOwner owner) { - mLifecycle = owner.getLifecycle(); - stop(); - } - - @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY) - public void onDestroy(LifecycleOwner owner) { - mLifecycle = owner.getLifecycle(); - destroy(); - } - - /** * Starts the camera preview, if not started already. * This should be called onResume(), or when you are ready with permissions.