Refactor, Modernize & Enhance Android Camera Samples with new features by madebymozart · Pull Request #636 · android/camera-samples · GitHub
Skip to content

Refactor, Modernize & Enhance Android Camera Samples with new features - #636

Merged
madebymozart merged 42 commits into
mainfrom
madebymozart/camera-samples-overhaul
Jul 14, 2026
Merged

madebymozart merged 42 commits into
mainfrom
madebymozart/camera-samples-overhaul

Conversation

@madebymozart

@madebymozart madebymozart commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Overview

The legacy camera-samples repo was a loose collection of ~12 independent Gradle projects
(CameraXBasic, Camera2Basic, CameraXAdvanced, …), each with its own build, largely View-based
UI, and copy-pasted boilerplate. This PR replaces all of them with a single, modern, Compose-first
Camera Samples Catalog app
— one cohesive application that showcases Camera2 and CameraX
through small, self-contained samples that share a common architecture and design system.

909 files changed · +24.4k / −32.7k

Screenshots

Home catalog — all samples     Home catalog — the ML category

Highlights

  • One app, one build. A single Gradle project replaces the dozen standalone sample projects; a
    filterable catalog on the home screen routes to each sample.
  • Modular architecture. Shared code lives in :core-theme, :core-camera, and :core-ui, with
    one thin library module per sample under :samples/{api}-{feature}.
  • Layered & unidirectional. Every sample follows the same UiState → ViewModel → Controller → Screen pattern (documented in android_architecture.md) — a
    sealed interface Ui state, a @HiltViewModel exposing one StateFlow, a @Stable controller
    that owns the camera lifecycle, and a Screen that renders with when(state).
  • "Console" design system. A violet accent, Space Grotesk + Space Mono typography, a dense
    2-column catalog, a viewfinder HUD (accent focus reticle, rule-of-thirds, torch glow), and
    console-styled in-app settings menus.
  • createSample generator. ./gradlew createSample -PsampleName=… -PscreenName=… scaffolds a
    working, preview-only module and wires it into the build + catalog automatically.
  • Modern toolchain. compileSdk 37 (Android 17), JDK 17, Jetpack Compose + Material 3, Hilt,
    Navigation-Compose. Formatting is enforced with Spotless (ktlint + Apache license headers).
  • Modernized CI. The old per-project job matrix is replaced by a single root build that runs
    spotlessCheck + assembleDebug.

Samples

28 samples across six categories (the home screen filters by these; within a category, CameraX is
listed first, then Camera2):

  • Images — Take a Photo (CameraX · Camera2) · Ultra HDR (CameraX) · RAW/DNG (Camera2)
  • Video — Take a Video (CameraX · Camera2) · Slow Motion (Camera2) · Pause/Resume (CameraX) ·
    HDR Video (CameraX · Camera2) · Video Stabilization (CameraX) · Flip While Recording (CameraX)
  • ML — QR Scanner (CameraX · Camera2) · Image Labeling (CameraX) · Green Screen (CameraX)
  • Graphics — Viewfinder Effects (Camera2) · Luminosity (CameraX) · Concurrent Camera (CameraX) ·
    Effects (CameraX — featured)
  • Extensions — Extensions (CameraX · Camera2)
  • Controls — Zoom & Torch (CameraX · Camera2) · Exposure (CameraX) · Manual Controls (Camera2) ·
    Low-Light Boost (CameraX) · Feature Combination (CameraX)

Samples that depend on optional hardware (extensions, high-speed/HDR recording, manual sensor) detect
support at runtime and show a friendly "not supported on this device" state instead of crashing.

Module layout

app/                       catalog UI + Navigation-Compose NavHost
core-theme/                design system: color scheme, typography, AISampleCatalogTheme
core-camera/               Camera2/CameraX plumbing: controllers, previews, permissions, MediaStore
core-ui/                   shared Compose chrome: scaffold, controls, viewfinder HUD, capture review
samples/{api}-{feature}/   one library module per sample

Breaking changes

Removes the legacy standalone projects — Camera2Basic, Camera2Extensions, Camera2Video,
Camera2SlowMotion, CameraXBasic, CameraXAdvanced, CameraXExtensions, CameraXVideo,
CameraX-MLKit, HdrViewfinder, CameraUtils, and Presentations. Their functionality is
re-implemented and consolidated in the new catalog app.

Testing

  • ./gradlew assembleDebug and ./gradlew spotlessCheck pass from the project root.
  • Installed and smoke-tested on a Pixel 10 Pro (Android 17) and the Pixel 9 Pro XL emulator.

…iewfinder` for camera preview and remove unused MLKit dependencies.
…0x1920 and set viewfinder scale type to `FIT_CENTER`.
…introduce `createSample.gradle.kts` for sample generation, and remove `GeminiDataSource.kt`.
…age structure and update build configurations and the `camera2-takeaphoto` sample's package.
…ave recorded videos to the public Movies directory.
@madebymozart
madebymozart requested a review from donovanfm June 24, 2026 00:39
@madebymozart madebymozart self-assigned this Jun 24, 2026
@madebymozart madebymozart added the enhancement New feature or request label Jun 24, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request performs a major cleanup of the repository by deleting several camera-related sample applications, including Camera2Basic, Camera2Extensions, Camera2SlowMotion, Camera2Video, CameraX-MLKit, and CameraX-TFLite, along with their associated source code, resources, and utility modules. Additionally, it updates the .editorconfig file with ktlint naming rules for Composable functions and modifies the CODEOWNERS file to assign new owners. There are no review comments to assess, and I have no additional feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@madebymozart
madebymozart marked this pull request as ready for review June 24, 2026 14:04
@donovanfm

Copy link
Copy Markdown
Contributor

@donovanfm donovanfm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment on the PR for the requested changes.

@donovanfm
donovanfm self-requested a review July 10, 2026 17:59

@donovanfm donovanfm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks for the updates!

@madebymozart
madebymozart merged commit 71fcdcb into main Jul 14, 2026
7 checks passed
@madebymozart
madebymozart deleted the madebymozart/camera-samples-overhaul branch July 14, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants