A professional Android camera application developed as part of the ** Android assignment**.
The application utilizes Kotlin, Jetpack Compose, CameraView, OpenCV, MVVM, Clean Architecture, and Hilt to provide a high-performance camera experience featuring real-time Black & White filtering, precision manual cropping, and advanced image adjustments.
- Real-time camera feed using the CameraView library.
- Robust lifecycle management integrated with Jetpack Compose.
- Seamless camera permission handling.
- Support for both Front and Back cameras.
- Dual-mode preview: Color and Black & White.
- Native grayscale filter applied via CameraView's filter API.
- Instant toggle between Color and B&W modes.
- Filters are applied in real-time to the live feed before capture.
- High-precision cropping powered by OpenCV 4.10.0.
- Manual area selection via intuitive drag gestures.
- Coordinate Mapping: Accurately translates screen touch coordinates to high-resolution bitmap pixels.
- Safety validation: Automatically rejects invalid or extremely small selections.
- Fine-tune captured images with native OpenCV processing:
- Brightness Adjustment: Enhance visibility in low-light shots.
- Contrast Adjustment: Make your Black & White photos pop.
- Real-time slider-based controls for instant feedback.
- Direct integration with Android MediaStore.
- Optimized for Scoped Storage (Android 10+): Uses
RELATIVE_PATHto save in the publicPicturesfolder. - Background processing: All storage operations run on the IO Dispatcher to ensure zero UI lag.
- Input Validation:
Material3 AlertDialogguides the user if a crop selection is too small. - Fail-safe Logic: Hardware-level error catching for camera and storage exceptions.
- Feedback Loop: Integrated
Loadingstates with Circular Progress Indicators. - Professional Alerts: Global
SnackbarHostfor non-intrusive error reporting.
| Technology | Usage |
|---|---|
| Kotlin | Core programming language |
| Jetpack Compose | Modern Declarative UI |
| CameraView | Robust camera engine and preview |
| OpenCV | Professional-grade image processing and cropping |
| Hilt | Dependency Injection for modularity |
| Coroutines & Flow | Asynchronous operations and State management |
| Navigation | Jetpack Compose Navigation |
| MediaStore | Industry-standard gallery storage |
The application follows Clean Architecture with MVVM, ensuring a strict separation of concerns.
Presentation Layer (UI & ViewModels)
↓
Domain Layer (Business Logic & Use Cases)
↓
Data Layer (Processors & Repository Implementations)
com.example.cameraapplication
│
├── common/ # Shared utilities (ResultState, BitmapUtils)
├── data/
│ ├── processor/ # OpenCV native implementation
│ └── repository/ # Storage and hardware implementations
├── domain/
│ ├── repository/ # Interface contracts
│ └── usecase/ # Pure business logic (Crop, Save, Adjust)
└── presentation/
├── Navigation/ # Type-safe NavGraph
└── screen/
└── camerascreen/
├── CameraViewModel # Single source of truth
└── components/ # Modularized UI components
- Professional Shutter: DSLA-style concentric ring button design.
- Live Animations: Infinite pulsing effects on active filter toggles.
- Focus Dimming: Shadow overlays during cropping to highlight the selection.
- Glassmorphism: Semi-transparent frosted-glass control panels.
The application requires the following permissions to function correctly, which are declared in the AndroidManifest.xml:
- Camera: Required to access and display the live camera feed.
- Record Audio: Required by the CameraView library's internal safety checks (Audio is explicitly disabled in code, but declaration is required for hardware initialization).
- Read/Write External Storage: Required to save and retrieve processed images from the device gallery (Scoped storage rules applied for Android 10+).
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />The application has been thoroughly tested for:
- Permission Flow: Graceful handling of camera and storage access.
- Hardware Stability: Explicit resource release to prevent "Camera Server Died" errors.
- Edge Cases: Validating tiny crop areas, storage-full scenarios, and rapid screen transitions.
- Responsiveness: Tested across various screen sizes and orientations.
- Android Studio Ladybug | 2024.2.1 or newer.
- Minimum SDK 24 (Android 7.0).
- Target SDK 37 (Android 15).
- Physical Device recommended for optimal camera and OpenCV performance.
- Clone the repository.
- Open in Android Studio.
- Perform a Gradle Sync to download dependencies (OpenCV 4.10.0 and CameraView 2.7.2 are pulled automatically via Maven).
- Run on your device.
This project was developed as part of an Android Development Assignment.