Skip to content

Instantly share code, notes, and snippets.

@tcw165
Last active September 13, 2017 10:30
Show Gist options
  • Save tcw165/435c76f5f78ebfc9313c496931ee486d to your computer and use it in GitHub Desktop.
Save tcw165/435c76f5f78ebfc9313c496931ee486d to your computer and use it in GitHub Desktop.
// Activity or Fragment ::onResume
mDisposables = new CompositeDisposable();
mDisposables.add(
grantPermission()
// Step 1, use TextureViewObservable to wait for the surface ready.
.compose(waitForTextureSurfaceReady())
// Step 2, use Camera2Observable to wait for the device opened.
.compose(openCameraToGetCameraDevice())
// Step 3, use Camera2CaptureSessionObservable and Camera2ImageReaderObservable
// to wait for the session configured.
.compose(createCaptureSession())
// Step 4, create a repeated capture request.
.compose(setCaptureRequestAndObserveAvailableImage())
// Then do whatever you want here.
.subscribe());
// Activity or Fragment ::onPause
mDisposables.clear();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment