/MoviesMix

MoviesMix is an Android application that allows users to explore the latest movies, get detailed information, watch trailers, and download posters. the app follows the MVVM architecture and utilizes popular libraries such as Retrofit, Room, Dagger-Hilt, ExoPlayer, and Coil.

Primary LanguageKotlinMIT LicenseMIT

MoviesMix πŸŽ₯πŸΏπŸ“±

This is an Android app built using Kotlin that showcases various features and libraries. The app allows users to explore the latest movies, get detailed information about them and watch their trailers. Users can also like their favourite movies and download their posters and wallpapers. The application also supports dark and light themes and multiple languages.

Features ✨

  • Explore the Upcoming, Popular and Trends Movies βœ…
  • Get detailed description of the movies. βœ…
  • Get Related movies. βœ…
  • Like your favourite movies. βœ…
  • Get movies trailer within the application. βœ…
  • Download movie poster and wallpapers. βœ…
  • Download cast profile images. βœ…
  • Search for movies. βœ…
  • Support dark/light themes. βœ…
  • Support multiple languages. βœ…
  • Cache movies data to show when mobile go offline. βœ…
  • API Level 26+ βœ…

Built With πŸ› 

  • Kotlin: First class and official programming language for Android development.
  • KTX: Kotlin extensions for Android, providing concise and idiomatic APIs.
  • Coroutines: Asynchronous programming library for simplifying background operations.
  • Flow: Reactive stream library for asynchronous and data-driven programming.
  • Retrofit/OkHttp3: Networking libraries for making HTTP requests.
  • Room: Persistence library for local database storage.
  • Dagger-Hilt: Dependency injection library for Android.
  • Navigation Component: Android Jetpack's library for navigating between screens.
  • ViewModel-ktx: Part of the Android Architecture Components for managing UI-related data.
  • WorkManager-KTX: Library for performing background work in a flexible and efficient way.
  • Splash Screen: Library for creating splash screens on Android.
  • Media3 ExoPlayer: Media playback library for Android.
  • Sandwich: A lightweight and easy-to-use wrapper for Retrofit API calls.
  • Coil: Image loading library for Android apps.
  • Lottie: Animation library for Android.
  • VeilLayout: Library for showing shimmering loading placeholders.
  • PhotoView: Zoomable image view library for Android.
  • SmoothBottomBar: Customizable and animated bottom navigation bar library.
  • ShapeOfView: Library for creating various shapes for views in Android.
  • SparkButton: Customizable and animated button library.
  • SpringView: Pull-to-refresh and load-more library for Android.
  • Security-Crypto: Library for encryption and decryption on Android.
  • Kotlin YouTubeExtractor: Library for extracting YouTube video links.
  • KenBurnsView: Customizable Ken Burns effect view library for Android.
  • MotionLayout: Library for creating and managing motion and widget animation in Android.
  • ViewBinding: Feature that allows you to more easily write code that interacts with views.
  • Material Design Components: Library for implementing Material Design UI components.

Screenshots πŸ“·

Package Structure πŸ“¦

com.memad.moviesmix                                # Root Package
app                                                # Main Application Package
β”œβ”€β”€ data/                                          # For data handling.
β”‚   β”œβ”€β”€ local/                                     # Local Persistence Database. Room (SQLite) database
|   β”‚   β”œβ”€β”€ MoviesDao.kt                           # Data Access Object for Room
|   |   |── Converters.kt                          # Type converters for Room
|   β”‚   β”œβ”€β”€ FavouritesEntity.kt                    # Entity class for Room
|   β”‚   β”œβ”€β”€ MoviesDB.kt                            # Database class that extends RoomDatabase
|   β”‚   └── MovieEntity.kt                         # Entity class for Room         
β”‚   β”œβ”€β”€ remote/                                    # Remote Data Handlers
|   β”‚   β”œβ”€β”€ MoviesClient.kt                        # Retrofit API for remote end point.
|   β”‚   └── StartClient.kt                         # Retrofit API for remote end point.
|   di/                                            # Dependency Injection
|   |── annotations/                               # Custom annotations for DI
|   |      β”œβ”€β”€ FavouritesRepoAnn.kt                # Custom annotation for Favourite repository
|   |      β”œβ”€β”€ PopularRepo.kt                      # Custom annotation for Popular repository
|   |      β”œβ”€β”€ TrendingRepo.kt                     # Custom annotation for Trending repository
|   |      β”œβ”€β”€ SessionKey.kt                       # Custom annotation for Session Key
|   |      └── UpcomingRepo.kt                     # Custom annotation for Upcoming repository
β”‚   β”œβ”€β”€ ApiModule.kt                               # Provides Network dependencies.
β”‚   β”œβ”€β”€ DatabaseModule.kt                          # Provides Database dependencies.
β”‚   β”œβ”€β”€ ReposModule.kt                             # Provides Repositories dependencies.
β”‚   └── UtilsModule.kt                             # Provides some other dependencies.
β”œβ”€β”€ models/                                        # Model classes
|   |── AuthResponse.kt                            # Model class for Auth Response
|   |── Cast.kt                                    # Model class for Cast
|   |── CastResponse.kt                            # Model class for Cast Response
|   |── Movie.kt                                   # Model class for Movie
|   |── MovieResponse.kt                           # Model class for Movie Response
|   └── VideoResponse.kt                           # Model class for Video Trailer Response
β”œβ”€β”€ repos/                                         # Repositories
|  |── DescriptionRepo.kt                          # Repository class for Movies Description
|  |── FavouritesRepo.kt                           # Base repository class for Favourites
|  |── FavoritesRepoImplentation.kt                # Implementation of Favourites repository
|  |── MainRepo.kt                                 # Base repository class for all type of movies(Popular, Trending, Upcoming)
|  |── mainRepoImpl.kt                             # Implementation of Main repository
|  └── SearchRepo.kt                               # Repository class for Search
β”œβ”€β”€ ui/                                            # Activity/View layer
β”‚   β”œβ”€β”€ main/                                      # Main Screen Activity & ViewModel (contains all components of the app)
|   |   β”œβ”€β”€ description/                           # Description Screen Fragment & ViewModel & Adapters (contains all components of the movie description)
|   |   |   β”œβ”€β”€ RecommendAdapter.kt                # Adapter for Recommended RecyclerView
|   |   |   β”œβ”€β”€ CastAdapter.kt                     # Adapter for Cast RecyclerView
|   |   |   β”œβ”€β”€ MovieDescriptionFragment.kt        # Fragment for Description Screen
|   |   |   └── DescriptionViewModel.kt            # ViewModel for Description Screen
|   |   β”œβ”€β”€ favourites/                            # Favourites Screen Fragment & ViewModel & Adapter (contains all components of the Favourites)
|   |   |   β”œβ”€β”€ FavouritesAdapter.kt               # Adapter for Favourites RecyclerView
|   |   |   β”œβ”€β”€ FavouritesFragment.kt              # Fragment for Favourites Screen
|   |   |   └── FavouritesViewModel.kt             # ViewModel for Favourites Screen
|   |   β”œβ”€β”€ popular/                               # Popular Screen Fragment & ViewModel & Adapter (contains all components of the Popular)
|   |   |   β”œβ”€β”€ PopularAdapter.kt                  # Adapter for Popular RecyclerView
|   |   |   β”œβ”€β”€ PopularFragment.kt                 # Fragment for Popular Screen
|   |   |   └── PopularViewModel.kt                # ViewModel for Popular Screen
|   |   β”œβ”€β”€ search/                                # Search Screen Fragment & ViewModel & Adapter (contains all components of the Search)
|   |   |   β”œβ”€β”€ SearchAdapter.kt                   # Adapter for Search RecyclerView
|   |   |   β”œβ”€β”€ SearchFragment.kt                  # Fragment for Search Screen
|   |   |   └── SearchViewModel.kt                 # ViewModel for Search Screen
|   |   β”œβ”€β”€ settings/                              # Settings Screen Fragment
|   |   |   └── SettingsFragment.kt                # Fragment for Settings Screen
|   |   β”œβ”€β”€ trending/                              # Trending Screen Fragment & ViewModel & Adapter (contains all components of the Trending)
|   |   |   β”œβ”€β”€ TrendingAdapter.kt                 # Adapter for Trending RecyclerView
|   |   |   β”œβ”€β”€ TrendingFragment.kt                # Fragment for Trending Screen
|   |   |   └── TrendingViewModel.kt               # ViewModel for Trending Screen
|   |   β”œβ”€β”€ upcoming/                              # Upcoming Screen Fragment & ViewModel & Adapter (contains all components of the Upcoming)
|   |   |   β”œβ”€β”€ UpcomingAdapter.kt                 # Adapter for Upcoming RecyclerView
|   |   |   β”œβ”€β”€ UpcomingFragment.kt                # Fragment for Upcoming Screen
|   |   |   └── UpcomingViewModel.kt               # ViewModel for Upcoming Screen
|   |   β”œβ”€β”€ viewer/                                # Viewer Screen for shioing movie trailer / images
|   |   |   β”œβ”€β”€ ViewerFragment.kt                  # Fragment for Viewer Screen
|   |   |   └── worker/                            # Worker for downloading images
|   |   |       β”œβ”€β”€ DownloadCompletedReceiver.kt   # Broadcast Receiver for downloading images
|   |   |       |── DownloadFile.kt                # Class for downloading images
|   |   |       └── DownloadImageWorker.kt         # WorkManager for downloading images
|   |   β”œβ”€β”€ MainActivity.kt                        # Main Activity
β”‚   └── start/                                     # Start Screen Activity & ViewModel  (contains all components of crating session and onboarding)
|       β”œβ”€β”€ StartActivity.kt                       # Start Activity
|       β”œβ”€β”€ start/                                 # Start Screen Fragment & ViewModel (contains all components of the Start)
|       |   β”œβ”€β”€ StartFragment.kt                   # Fragment for Start Screen
|       |   └── StartViewModel.kt                  # ViewModel for Start Screen
|       └── onboarding/                            # Onboarding Screen Fragment & Adapter (contains all components of the Onboarding)
|           β”œβ”€β”€ OnboardingAdapter.kt               # Adapter for Onboarding RecyclerView
|           └── OnboardingFragment.kt              # Fragment for Onboarding Screen
β”œβ”€β”€ utils/                                         # Utility Classes / Kotlin extensions
β”‚   β”œβ”€β”€ AccessNative.kt                            # Native code for Accessing API key in the cpp file
β”‚   β”œβ”€β”€ CenterZoomLayoutManager.kt                 # Custom LayoutManager for RecyclerView
β”‚   β”œβ”€β”€ Constants.kt                               # Constants used throughout the app
|   β”œβ”€β”€ DoubleClickListener.kt                     # Double click listener for views
β”‚   β”œβ”€β”€ Extensions.kt                              # Some Kotlin extension functions to help
β”‚   β”œβ”€β”€ GenresUtils.kt                             # Helper class for getting genres (as string) of movies
β”‚   β”œβ”€β”€ LocaleExt.kt                               # Extension function for getting/setting current locale
β”‚   β”œβ”€β”€ Mapper.kt                                  # Mapper class for mapping data from MoviesResponse to MovieEntity
β”‚   β”œβ”€β”€ NetworkUtils.kt                            # Network Status as Reactive helper class
β”‚   β”œβ”€β”€ PermissionHelper.kt                        # Helper class for checking and requesting permissions
β”‚   β”œβ”€β”€ Resource.kt                                # A generic class that holds a value with its loading status.
β”‚   β”œβ”€β”€ SwipeToDelete.kt                           # Helper class for swipe to delete in RecyclerView
β”‚   └── SharedPreferencesHelper.kt                 # Helper class for storing data in SharedPreferences
└── App.kt                                         # Application class

Architecture: MVVM πŸ”¨

API Key Storage: NDK πŸ”‘

To securely store the API key used in the app, we utilize the Native Development Kit (NDK) to store the key in native code. This helps prevent the key from being easily extracted from the app's compiled code.

If you need to use an API key in the app, follow these steps:

  1. Obtain your API key from TMDB.
  2. Navigate to the jni directory in the project.
  3. create a new file called api_key.cpp and add the following code:
#include <jni.h>
JNIEXPORT jstring;
jstring
Java_com_memad_moviesmix_utils_AccessNative_getApiKey(JNIEnv *env, jobject thiz) {
    return (*env)->  NewStringUTF(env, "YOUR_API_KEY_HERE");
}
  1. Replace YOUR_API_KEY_HERE with your API key.
  2. Build the project to generate the native library file that contains the API key.

License πŸ“ƒ

This project is licensed under the [MIT License] License - see the LICENSE file for details.