Modern Movie App
Overview
This Android app interacts with The Movie Database (TMDB) API. Every line of code has been generated
or suggested by AI using a large language model.
Alpha = TMDB
Beta = OpenAI
Current state
The codebase evolves as the AI generates more and more code.
Setup
- Get a TMDB API key from themoviedb.org.
- Add to
gradle.properties
:
TMDB_API_KEY="your_api_key_here"
- Sync project with Gradle files.
Tech Stack
-
Language: Kotlin
-
UI Framework: Jetpack Compose
-
Architecture: MVVM (Model-View-ViewModel)
-
Networking: Ktor Client for Android
-
JSON Parsing: Gson
-
Image Loading: Coil
-
Asynchronous Programming: Kotlin Coroutines
-
Navigation: Jetpack Navigation Compose
-
Dependency Injection: Manual (no DI framework used yet)
-
UI Components: Material Design 3
-
Build System: Gradle with Kotlin DSL
-
Minimum SDK: 21 (Android 5.0 Lollipop)
-
Target SDK: 34 (Android 14)
Key Features
- Browse movies by different categories (popular, top-rated, etc.)
- Search for movies
- View detailed movie information
- Mark movies as favorites
- Create custom movie lists (authenticated users only)
- Switch between grid and list views
- Apply filters (genre, release year, minimum rating)
- Toggle between light and dark themes
Architecture
The app follows the MVVM (Model-View-ViewModel) architecture:
- Model: Represented by the
Movie
and MovieResponse
data classes
- View: Compose UI components in various screen files
- ViewModel:
MovieViewModel
manages the app's state and business logic
Data Flow
- The
MovieViewModel
fetches data from the MovieRepository
- The repository makes API calls using the
ApiService
- Data is then exposed to the UI components via StateFlows in the ViewModel
- UI components observe these flows and recompose when the data changes
Authentication Flow
- User initiates authentication from the ListCreationScreen
- App obtains a request token from the TMDB API
- User approves the request token via a web browser
- App exchanges the approved token for a session ID
- Session ID is stored for future authenticated requests