Git Product home page Git Product logo

moly's Introduction

Movie Library (Moly)

Moly is a sample Android project using The Movie DB API based on MVVM architecture. It showcases the latest Android tech stacks with well-designed architecture and best practices.

Features

  • 100% Kotlin
  • MVVM architecture
  • Android Architecture Components and Jetpack.
  • Kotlin Coroutines + Flow
  • Single activity pattern
  • Version Catalog TOML

Tech Stacks

  • Retrofit + OkHttp - RESTful API and networking client.
  • Hilt - Dependency injection.
  • Android Architecture Components - A collections of libraries that help you design rebust, testable and maintainable apps.
    • ViewModel - UI related data holder, lifecycle aware.
    • LiveData - Observable data holder that notify views when underlying data changes.
    • Lifecycle - Handling lifecycles with lifecycle-aware component
    • ViewBinding - Instance of a binding class contains direct references to all views that have an ID in the corresponding layout.
    • Navigation component - Fragment routing handler.
    • Material Components for Android - Modular and customizable Material Design UI components for Android.
  • Coroutine Concurrency design pattern for asynchronous programming.
  • Flow Stream of value that returns from suspend function.
  • Coil - Image loading.
  • Timber - Extensible API for logging.
  • Logger - Simple, pretty and powerful logger for android.
  • Gson - Converting JSON to Kotlin data class.
  • Glide - Loading and caching images.
  • Glide Transformations - Providing image transformations for Glide.
  • YouTube Android Player - Playing YouTube video in app.
  • ExpandableTextView - TextView library that performs multiline ellipsize.
  • Klock - Date & Time library for Multiplatform Kotlin 1.3.
  • Desugar - Simplified for use on older runtimes.
  • TOML - Version catalog is a list of dependencies, represented as dependency coordinates, that a user can pick from when declaring dependencies in a build script.

Architectures

We follow Google recommended Guide to app architecture to structure our architecture based on MVVM, reactive UI using LiveData / Hilt observables and view binding.

  • View: Activity/Fragment with UI-specific logics only.
  • ViewModel: It keeps the logic away from View layer, provides data streams for UI and handle user interactions.
  • Model: Repository pattern, data layers that provide interface to manipulate data from both the local and remote data sources. The local data sources will serve as single source of truth.

Package Structures

dev.byto.moly           # Root Package
├── data                # For data modeling layer
│   ├── mapper          # Contains mapping functions to map DTOs(Data Transfer Objects)
│   ├── remote          # contains *Retrofit* components to fetch data from the network source
|   │   ├── api         # API Service
|   │   └── dto         # DTOs(Data Transfer Objects)
│   └── repository      # contains **implementations** of repository interfaces that are defined in the domain layera
|
├── di                  # Dependency injection modules
|
├── domain              # Domain layer is the central layer of the project
│   ├── 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
│
├── ui                  # contains Activities & Fragments with their corresponding ViewModel classes
│   ├── adapter         # contains RecyclerView  adapter classes
│   ├── base            # Base ViewModel
│   └── screen          # Location screen Fragment and ViewModel
|   |   └── detail      # Detail screen Fragment and ViewModel
|   |   |   └── dialog  # Dialog open Youtube
|   |   ├── home        # Home screen Fragment and ViewModel
|   |   ├── list        # List screen Fragment and ViewModel
|   |   └── MainActivity# Single activity
|   └── UiState         # UI State response
| 
├── utils               # Utility Classes / Kotlin extensions
└── MainApp             # Application

The project separated into three main layers:

  • Data
  • UI
  • Domain

API Key 🔑

You will need to provide developer key to fetch the data from TMDB API.

  • Generate a new key (v3 auth) from here. Copy the key and go back to Android project.
  • Define a constant API_KEY with the double quotes, it looks like
private const val API_KEY = "\"5423as******************655\""
  • Add the key to build config in ./app/src/main/java/dev/byto/moly/di/NetworkModule.kt:
  • Perform gradle sync.

LICENSE

Copyright 2023 Toby Zulkarnain

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

moly's People

Contributors

tobyzulka avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.