This Android app leverages Jetpack Compose and CameraX library to provide camera functionality for capturing photos and recording videos.
- Switch between front and back cameras.
- Capture photos with rotation correction.
- Record videos with audio.
- Display captured photos in a staggered grid layout.
- Ensure necessary permissions (camera and audio recording) are granted.
- Use the camera switch icon to toggle between front and back cameras.
- Click the "Take Photo" icon to capture a photo with rotation correction.
- Click the "Record Video" icon to start/stop recording videos with audio.
- Captured photos are displayed in a staggered grid layout below the camera preview.
- MainActivity: Controls the app flow and sets up the camera preview and UI.
- MainViewModel: Manages the state of captured photos using a ViewModel.
- CameraPreview: Displays the camera preview using a Compose composable.
- PhotoBottomSheetContent: Displays the captured photos in a staggered grid layout using a Compose composable.
- Jetpack Compose: Used for building the UI declaratively.
- CameraX: Provides camera functionality abstraction.
androidx.camera.core
: Core library using the camera2 implementation.androidx.camera.camera2
: CameraX Camera2 library.androidx.camera.lifecycle
: CameraX Lifecycle library.androidx.camera.video
: CameraX VideoCapture library.androidx.camera.view
: CameraX View class.androidx.camera.mlkit.vision
: CameraX ML Kit Vision Integration.
- AndroidX Material Icons Extended: Provides extended Material icons support.
- AndroidX Lifecycle ViewModel Compose: ViewModel integration for Jetpack Compose.
Ensure the following permissions are added to your app's manifest file:
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>