Best android open-source packages and libraries.

Movieapp mvvm clean architecture

A movie & TV show exploration app that implements MVVM design pattern by following the clean architecture principles, using TMDB API.
Updated 6 months ago

🎬 Movie App 📺

Platform API Kotlin License

A movie & TV show exploration app that implements MVVM design pattern by following the clean architecture principles, using TMDB API.

✨ Features

🔸 Project Features

  • Written in Kotlin
  • Implementing MVVM design pattern with Android Architecture Components
  • Implementing single-activity architecture
  • Following clean architecture principles*
  • Dependency injection with Hilt
  • Consuming a REST API
  • Safe API call with Retrofit & Coroutines with the help of Sealed Class
  • Caching API response with OkHttpClient
  • Observing data changes and updating the UI state with StateFlow
  • Lifecycle-aware RecyclerView & ViewPager2 adapters with util classes that implements DefaultLifecycleObserver
  • Easing the binding process and handling common operations with base classes (BaseActivity, BaseFragment, and BaseViewModel)
  • Handling common view logic with BindingAdapter
  • Infinite scrolling with the help of RecyclerView.OnScrollListener (no paging library used)
  • ViewPager2 auto sliding functionality with the help of Handler & Runnable
  • Detecting and fixing leaks with LeakCanary

🔹 App Features

  • Browse movies-TV shows through various categories on the Home screen
  • Search movies-TV shows-people on the Search screen
  • See the details of a movie-TV show-person
    • Adjusted background color according to the dominant color of the poster
    • Watch trailers directly in the app
    • View more details by expanding the Details section
    • Navigate to IMDb, Facebook, Instagram, or Twitter page in the browser or own app if installed
    • Mark the movie-TV show as favorite by tapping the heart icon
  • View favorite movies-TV shows on the Favorites screen
  • Offline support (if cached data is available)

▶ Demos

https://user-images.githubusercontent.com/88214480/177016399-54ccbf05-f625-40c9-a26c-93ca90a9908a.mp4

https://user-images.githubusercontent.com/88214480/177058155-c38b0c64-dfd8-445a-970b-ff2dec2e258a.mp4

https://user-images.githubusercontent.com/88214480/177016423-414af63c-6ded-42d8-b74a-9acfc9a757c6.mp4

https://user-images.githubusercontent.com/88214480/177016425-81fba53d-348a-414d-9249-5a0292aefbae.mp4

🔑 Prerequisite

To build the project successfully, you need to get your TMDB API key and add a new line in the local.properties file as shown below.

tmdb_api_key=Your_TMDB_API_Key

Do the same with YouTube Data API key.

youtube_api_key=Your_YouTube_Data_API_Key

🛠 Project Structure

project_structure

The project separated into three main layers:

  • Data
  • Presentation
  • Domain

🔸 Data

Data layer contains application data that are fetched from either the network source or the local database.

Consists of four packages:

  • local contains Room components to fetch data from the local database
  • mapper contains mapping functions to map DTOs(Data Transfer Objects) and database entities to domain models
  • remote contains Retrofit components to fetch data from the network source
  • repository contains implementations of repository interfaces that are defined in the domain layer

🔸 Presentation

Presentation layer is responsible for displaying application data on the screen. It contains UI elements that render the data on the screen and ViewModel classes that store and manage data in a lifecycle-conscious way.

Consists of two packages:

  • adapter contains RecyclerView & ViewPager2 adapter classes
  • ui contains Activities & Fragments with their corresponding ViewModel classes

🔸 Domain

Domain layer is the central layer of the project. This layer is a bridge between the data layer and the presentation layer-it retrieves data from the data layer and exposes it to the presentation layer. This layer is independent of other layers-any changes in other layers don't affect this layer.

Consists of three packages:

  • model contains data classes that hold the data retrieved from the data layer to be used later on in the presentation layer to expose it to UI
  • repository contains repository interfaces to abstract the domain layer from the data layer
  • usecase contains use cases(interactors) that handle the business logic, which are reused by multiple ViewModels

📚 Libraries

  • Jetpack libraries
    • Navigation - Handling navigation between destinations within the app
    • Lifecycle - Handling lifecycles with lifecycle-aware component
    • DataBinding - Binding UI components in layouts to data sources using a declarative format
    • ViewModel - Storing and managing UI-related data in a lifecycle-conscious way
    • Hilt - Injecting dependencies
    • Room - Constructing SQLite database more easily
    • DataStore - Persisting the key-value pairs or typed objects with protocol buffers
    • Palette - Extracting prominent colors from images
  • Kotlin Coroutines - Allowing asynchronous programming with Kotlin
  • Retrofit - Interacting with the REST API
  • OkHttp - Implementing interceptors
  • Gson - Converting JSON to Kotlin data class
  • Glide - Loading and caching images
  • Glide Transformations - Providing image transformations for Glide
  • PhotoView - Implementing zoom functionality to ImageView
  • ExpandableLayout - Animating the expansion and collapse of its child views
  • YouTube Android Player - Playing YouTube video in app
  • LeakCanary - Detecting leaks within the app

📱 Try the App

Check out the Releases and download & install the APK file to try the app.

📜 License

Copyright (c) 2022 Bora Bor

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Tags coroutines