Skip to content

Sample Android app for showcasing custom implementation of OpenGL camera preview display, written in Kotlin.

License

Notifications You must be signed in to change notification settings

minsik-ai/Kamera

Repository files navigation

Kamera

Sample Android app for showcasing custom implementation of OpenGL camera preview display, written in Kotlin.

Main Implementation

Structure inspired by TextureFromCameraActivity in Grafika repository.

Design Goals

  1. Stay as close to idiomatic Kotlin as possible.

    Only place I knowingly depart from idiomatic Kotlin is the use of lateinit. lateinit is used for critical variables to catch bugs faster & fix them, rather then letting them pass with use of nullables & ? keyword.

  2. Reduce complexity using single Executor & single Class.

    Main class is intentionally flat, to avoid complexity caused by Handlers & RenderThreads. A single Executor replaces most of their functionality.

  3. Handle all state machines in a separate non-Activity class.

    Activity lifecycle & Surface lifecycle doesn't match, so there is a need to account for both of them. Android Architecture Components LifecycleObserver is used to handle all in one single class. Grafika implementation handled all this in one Activity, which is fine for a sample app, but lacks extensibility.

  4. Overcome possible thread problems using Annotations.

    @WorkerThread, @MainThread annotations are strategically placed to avoid GL operations on wrong threads.

About

Sample Android app for showcasing custom implementation of OpenGL camera preview display, written in Kotlin.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages