CameraListeners now must be non null

pull/360/head
Mattia Iavarone 6 years ago
parent 4cfd2e0584
commit d7a593e070
  1. 12
      cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java
  2. 1
      docs/_posts/2018-12-20-preview-size.md

@ -1189,10 +1189,8 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
* *
* @param cameraListener a listener for events. * @param cameraListener a listener for events.
*/ */
public void addCameraListener(@Nullable CameraListener cameraListener) { public void addCameraListener(@NonNull CameraListener cameraListener) {
if (cameraListener != null) { mListeners.add(cameraListener);
mListeners.add(cameraListener);
}
} }
@ -1201,10 +1199,8 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
* *
* @param cameraListener a listener for events. * @param cameraListener a listener for events.
*/ */
public void removeCameraListener(@Nullable CameraListener cameraListener) { public void removeCameraListener(@NonNull CameraListener cameraListener) {
if (cameraListener != null) { mListeners.remove(cameraListener);
mListeners.remove(cameraListener);
}
} }

@ -86,3 +86,4 @@ After the preview size is determined, if it has changed since list time, the `Ca
another call to `onMeasure` so the `WRAP_CONTENT` magic can take place. another call to `onMeasure` so the `WRAP_CONTENT` magic can take place.
To understand how SizeSelectors work and the available utilities, please read the [Capture Size](capture-size.html) document. To understand how SizeSelectors work and the available utilities, please read the [Capture Size](capture-size.html) document.

Loading…
Cancel
Save