Skip to content

mojahid2021/TMDB

Repository files navigation

TMDB Android App

An Android application for browsing movies and TV shows using The Movie Database (TMDB) API.

This repository contains a native Android app (Java) that demonstrates fetching lists of movies/TV shows, showing details, and basic navigation.

Key Features

  • Browse trending, popular, movies, TV shows and upcoming movies
  • View movie details
  • Discover movies (discover endpoint)
  • Recyclers and adapters for lists and grids

Quick status

  • Language: Java (Android)
  • Build system: Gradle
  • Minimum setup: Android Studio + JDK

Prerequisites

  • Android Studio (recommended latest stable)
  • JDK 11 or newer (project uses Java Android toolchain)
  • Internet connection for API calls

TMDB API Key (Important)

The app uses the TMDB REST API and requires an API key.

Currently the project exposes a default place for the API key in app/src/main/java/com/horizonhunters/tmdb/Connstant.java (not recommended for published repos).

Recommended approaches:

  1. Local only (preferred): store your key in local.properties and change Connstant or Gradle to load it from there.
    • Add to local.properties (top-level project folder): TMDB_API_KEY=your_api_key_here
    • Then modify Connstant.java or the Gradle build to read from BuildConfig or resources so the key is not checked into source control.
  2. Quick (existing code): replace the value in Connstant.API_KEY with your key (only for local development).

Do not commit your API key to a public repository.

Setup

  1. Clone the repository
    git clone <your-repo-url>
    cd TMDB
  2. Open the project in Android Studio (recommended) or import the Gradle project.
  3. Provide a TMDB API key using one of the methods above.
  4. Sync Gradle and build.

Build & Run (command line)

  • Assemble debug APK:
./gradlew assembleDebug
  • Install to a connected device/emulator:
./gradlew installDebug
  • Run unit tests:
./gradlew test
  • Run instrumented (connected) tests (device required):
./gradlew connectedAndroidTest

Project structure (high level)

  • app/src/main/java/com/horizonhunters/tmdb/
    • Connstant.java — base URL and API key holder (change this for your API key)
    • MainActivity.java — app entry and fragment navigation
    • Activity/ — Activities such as MovieDetailsActivity, TV series details, etc.
    • home/ — Home screen and subpackages (Trending, Popular, Movies, TvSeries, Upcoming)
    • movieDiscover/ — DiscoverMovieFragment, DiscoverMovieAdapter, and model classes for the discover flow
    • CustomProgressDialog.java — simple loading dialog used across fragments
  • app/src/main/res/layout/ — fragment and item layouts (e.g. fragment_movie_discover.xml, item_discover_poster.xml)

Notable files

  • app/src/main/java/com/horizonhunters/tmdb/home/HomeFragment.java — Home screen that fetches multiple lists and includes an auto-scrolling carousel for trending (active in HomeFragment only).
  • app/src/main/java/com/horizonhunters/tmdb/movieDiscover/DiscoverMovieFragment.java — Discover movies fragment. NOTE: recently refactored to match HomeFragment fetch style: a single fetch using CustomProgressDialog, clearing the list then calling notifyDataSetChanged(). Auto-scrolling / pagination logic was removed per recent change.
  • app/src/main/java/com/horizonhunters/tmdb/movieDiscover/DiscoverMovieAdapter.java — Adapter used by the discover fragment to show poster grid items.

Recent change (why and what)

Per a requested change, DiscoverMovieFragment was updated to:

  • Remove auto-scrolling and pagination behavior
  • Use the same fetch pattern as HomeFragment: show CustomProgressDialog while fetching, clear the list on each fetch, parse results, notifyDataSetChanged() on success This makes the discover screen simpler and consistent with the rest of the app UI code.

If you want pagination or infinite scrolling later, you can reintroduce a scroll listener and progressive loading, or switch to Android Paging 3 library for robust paging.

Known lint/warnings

  • Some adapters or classes may have non-critical lint warnings (for example, notifyDataSetChanged() usage or fields that can be final). These are warnings and don't stop the build but can be improved.

Static Analysis

  • Detekt is configured for Kotlin projects; this is a Java project — adjust or skip if not applicable.
  • You can still run Gradle lint and other checks provided by Android Studio.

Contributing

  1. Fork and create a feature branch
  2. Make changes and run local tests
  3. Open a pull request with a clear description

Troubleshooting

  • Network errors: ensure your device/emulator can access the internet and your API key is valid.
  • If you see JSON parsing errors, check the logs (Logcat) for the request URL and the raw JSON response.

License

This project uses the MIT license. Replace with the correct license if different.


If you want, I can:

  • Add a short section with exact code snippets to read the API key from local.properties via Gradle/BuildConfig and update Connstant to read from BuildConfig (recommended). I can implement that change and a small migration guide.
  • Run a full Gradle build in this environment and report results.

Which follow-up would you like?

About

An Android application for browsing movies and TV shows using The Movie Database (TMDB) API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages