Giter Site home page Giter Site logo

aliasadi / android-clean-architecture Goto Github PK

View Code? Open in Web Editor NEW
289.0 5.0 40.0 35.76 MB

🎞 A demo movie android app showcasing Clean Architecture, written in Kotlin and featuring Jetpack Compose for modern, declarative UIs. (Offline-first App)

Home Page: https://aliasadi.github.io/Android-Clean-Architecture/

License: Apache License 2.0

Kotlin 100.00%
clean-architecture clean-code android-architecture android architecture-components unit-test kotlin android-application android-clean-architecture android-clean-architecture-sample

android-clean-architecture's Introduction

Android Clean Architecture Codacy Badge

A demo movie android app showcasing Clean Architecture, written in Kotlin and featuring Jetpack Compose for modern, declarative UIs. πŸ’―πŸŽž

image

Features

  1. Offline-first: The app can be accessed even without an internet connection.
  2. Pagination: Efficiently loads large amounts of data to improve the user experience.
  3. Search functionality: Allows users to quickly find specific information within the app.
  4. Auto Sync: Uses both NetworkConnectivityStream and WorkManager to ensure data is always up-to-date.
  5. Favorites: Users can add movies to a favorites list.

Previous Versions

  • To explore the app's earlier XML-based UI, check out the xml_based_app branch.

  • For a basic version of the app without pagination, check out the xml_based_basic_app branch.

The Motivation behind the app

This repository was created with the intention of sharing knowledge, stepping outside of my comfort zone, and using it to implement new challenges and ideas.

Movies Mock Server API

API: Movies Mock Server

This API is the primary data source for the app, providing a mock database of movie information. It is designed to mimic real-world data operations including fetching, updating, and managing movie data.

API Repository: Movies Mock Server Repository

This repository hosts the source code and documentation for the Movies Mock Server API

πŸ’‘ Architectural Insights

Architecture by its nature is dynamic and ever-evolving, there are always several solutions to every problem, and what works best will depend on the specific requirements and constraints of your project.

image

Screenshots

image

Clean Architecture

The core principles of the clean approach can be summarized as followed:

1. The application code is separated into layers.

These layers define the separation of concerns inside the code base.

2. The layers follow a strict dependency rule.

Each layer can only interact with the layers below it.

3. As we move toward the bottom layer β€” the code becomes generic.

The bottom layers dictate policies and rules, and the upper layers dictate implementation details such as the database, networking manager, and UI.

Architecture Layers

The application consists of three layers:

The domain layer, the data layer, and the presentation layer.

Looking at project’s high-level structure, you’ll see that each layer is represented by a module in the project.

image

I like it because it helps me avoid accidentals β€œleaks” between the layers.

Structure

Built With πŸ› 

  • Kotlin - First class and official programming language for Android development.

  • Coroutines - For asynchronous and more..

  • Flow - A cold asynchronous data stream that sequentially emits values and completes normally or with an exception.

  • StateFlow - A live data replacement.

  • Jetpack Compose - Modern toolkit for building native UIs.

  • Android Architecture Components - Collection of libraries that help you design robust, testable, and maintainable apps.

    • Paging3 - Load and display small chunks of data at a time.
    • ViewModel - Stores UI-related data that isn't destroyed on UI changes.
    • SavedStateHandle - A handle to saved state passed down to androidx.lifecycle.ViewModel.
    • Navigation Components - Navigate fragments easier.
    • Room - Persistence library provides an abstraction layer over SQLite to allow for more robust database access while harnessing the full power of SQLite.
    • WorkManager - Schedule deferrable, asynchronous tasks
  • Dependency Injection

    • Hilt - Easier way to incorporate Dagger DI into Android application.
  • Retrofit - A type-safe HTTP client for Android and Java.

  • Mockito - For Mocking and Unit Testing

πŸ’Ž Code Style

The code style in this project was ensured using Detekt.

Check command:

./gradlew detekt

License

   Copyright (C) 2020 Ali Asadi
   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.

Contributing

Just make pull request. You are in!

android-clean-architecture's People

Contributors

aliasadi avatar codacy-badger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

android-clean-architecture's Issues

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.