All Projects → nuhkoca → Kotlin Modular Tdd Coroutines Mvvm

nuhkoca / Kotlin Modular Tdd Coroutines Mvvm

Licence: mit
A sample Kotlin app which was built with modular structure, Kotlin DSL, Kotlin Coroutines, TDD and MVVM patterns.

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Kotlin Modular Tdd Coroutines Mvvm

Clean Mvvm Archcomponents
👽 Android app consuming Star Wars API.Built with clean architecture ,MVVM pattern, Koin , Coroutines + Flows ,Architecture Components, Data Binding , Firebase , Unit/UI Tests ,Motion Layout
Stars: ✭ 285 (+11.33%)
Mutual labels:  coroutines, clean-architecture, mvvm-architecture, tdd, retrofit2
Movieapp Clean Architecture
Learning Project (Movie App) For Applying Android Architecture Components And Clean Architecture Using MVVM With Kotlin
Stars: ✭ 123 (-51.95%)
Mutual labels:  coroutines, dagger2, clean-architecture, mvvm-architecture, databinding
Android Kotlin Mvi Cleanarchitecture
Android + Kotlin + Modularization + Gradle Depedency managment + Gradle written in Kotlin DSL + Custom Gradle Plugin + MVVM + MVI + Clean Architecture + Repository Pattern + Coroutines + Flows + Koin + Retrofit2 + ROOM + Kotlin-Android-Extension + KtLints
Stars: ✭ 187 (-26.95%)
Mutual labels:  coroutines, clean-architecture, mvvm-architecture, modularization, retrofit2
Modular App Core
Core implementations for a modular Android App
Stars: ✭ 127 (-50.39%)
Mutual labels:  coroutines, dagger2, clean-architecture, modularization, retrofit2
BESTV
Android TV App powered by TMDb. It is a easy way to find the best TV content, the top movies, series... all of that in your TV.
Stars: ✭ 49 (-80.86%)
Mutual labels:  clean-architecture, dagger2, glide, retrofit2, modularization
catchflicks
🎬 Kitchen sink project for learning android concepts 🎬
Stars: ✭ 12 (-95.31%)
Mutual labels:  dagger2, glide, retrofit2, mvvm-architecture, databinding
Coolweather
Weather App that uses Android best practices. Android Jetpack, clean architecture. Written in Kotlin
Stars: ✭ 154 (-39.84%)
Mutual labels:  coroutines, clean-architecture, retrofit2, glide, databinding
Wanandroid
🏄 基于Architecture Components dependencies (Lifecycles,LiveData,ViewModel,Room)构建的WanAndroid开源项目。 你值得拥有的MVVM快速开发框架:https://github.com/jenly1314/MVVMFrame
Stars: ✭ 410 (+60.16%)
Mutual labels:  dagger2, architecture, retrofit2, glide, databinding
NYTimesMostPopularArticles
A simple app to hit the NY Times Most Popular Articles API and show a list of articles, that shows details when items on the list are tapped (a typical master/detail app), also user able to browse/ add articles to favorite list that implements MVVM architecture using Dagger2, Retrofit, Coroutines, LiveData, RoomDatabase, Database Debugging, Data…
Stars: ✭ 38 (-85.16%)
Mutual labels:  coroutines, glide, retrofit2, mvvm-architecture, databinding
roove
Dating app based on firebase services and facebook login. MVVM-Kotlin-RxJava-Dagger-Databinding
Stars: ✭ 55 (-78.52%)
Mutual labels:  clean-architecture, dagger2, glide, databinding
ResDelivery-Hilt-Coroutines-Mvvm-Single-Activity
This is a Sample Single Activity App (Multi Fragments) that uses Dagger-Hilt, Coroutines Flows, Paging 3 & Mvvm Clean Architecture
Stars: ✭ 28 (-89.06%)
Mutual labels:  coroutines, glide, retrofit2, mvvm-architecture
bitcoin-market-android
Bitcoin Market app shows you the current Bitcoin market price and price chart of different time intervals 💰
Stars: ✭ 284 (+10.94%)
Mutual labels:  architecture, coroutines, clean-architecture, retrofit2
ChatApp
Chat app based on Firebase tools.
Stars: ✭ 88 (-65.62%)
Mutual labels:  coroutines, dagger2, mvvm-architecture, databinding
DailyBugle
📰Modern MVVM Android application following single activity architecture which fetches news from 🕷️ news API. this repository contains some best practices ⚡ of android development
Stars: ✭ 17 (-93.36%)
Mutual labels:  dagger2, glide, retrofit2, mvvm-architecture
WanAndroidJetpack
🔥 WanAndroid 客户端,Kotlin + MVVM + Jetpack + Retrofit + Glide。基于 MVVM 架构,用 Jetpack 实现,网络采用 Kotlin 的协程和 Retrofit 配合使用!精美的 UI,便捷突出的功能实现,欢迎下载体验!
Stars: ✭ 124 (-51.56%)
Mutual labels:  coroutines, glide, mvvm-architecture, databinding
Compose-BreakingBad
🧪 ☠︎ Jetpack Compose - Breaking Bad ☢︎
Stars: ✭ 26 (-89.84%)
Mutual labels:  coroutines, clean-architecture, glide, retrofit2
MVI-Clean-Architecture
MVI + Clean Architecture + Best Practices | Example of Clean Architecture of Android app using MVI design pattern with Jetpack and popular libraries
Stars: ✭ 50 (-80.47%)
Mutual labels:  coroutines, clean-architecture, mvvm-architecture, modularization
BakingApp
🍛🍴 This app allows a user to select a recipe and see video-guided steps for how to complete it, showcasing MVVM, Retrofit, ExoPlayer with lifecycle components, Master/Detail Flow, Widgets.
Stars: ✭ 18 (-92.97%)
Mutual labels:  glide, retrofit2, mvvm-architecture, databinding
Marvelheroes
❤️ A sample Marvel heroes application based on MVVM (ViewModel, Coroutines, LiveData, Room, Repository, Koin) architecture.
Stars: ✭ 826 (+222.66%)
Mutual labels:  coroutines, mvvm-architecture, retrofit2, databinding
MVVM-Demo
This demo for MVVM Design pattern for android
Stars: ✭ 20 (-92.19%)
Mutual labels:  glide, retrofit2, mvvm-architecture, databinding

A sample modern Kotlin application - Documentation still under maintenance

ktlint Codacy Badge codebeat badge CodeFactor Kotlin Version API License

This project is a sample that presents modern, the recent approach to Android application development using Kotlin and latest technology stack.

The goal of the project is to demonstrate best practices, provide a set of guidelines, and present modern Android application architecture that is modular, scalable, maintainable and testable. This application may look simple, but it has all of these small details that will set the rock-solid foundation of the larger app suitable for bigger teams and long application lifecycle management.

💥 Powered by TvMaze.

License

Table of Contents

Development

Environment setup

First off, you require the latest Android Studio 3.5 (or newer) to be able to build the app.

Moreover, to sign your app for release you should generate an upload key and keystore following the official documentation. Append the information used to generate it into local.properties project root file following the structure:

#Signing Config
signing.key.alias = <insert>
signing.key.password = <insert>
signing.store.file = <insert>
signing.store.password = <insert>

Code style

To maintain the style and quality of the code, are used the bellow static analysis tools. All of them use properly configuration and you find them in the project root directory .{toolName}.

Tools Config file Check command Fix command
detekt /config/detekt ./gradlew detekt ./gradlew detektFormat or ./gradlew detektAll
ktlint - ./gradlew ktlint ./gradlew ktlintFormat
spotless /spotless ./gradlew spotlessCheck ./gradlew spotlessApply
lint each module ./gradlew lint -

All these tools are integrated in pre-commit git hook, in order ensure that all static analysis and tests passes before you can commit your changes. To skip them for specific commit add this option at your git command:

git commit --no-verify

The pre-commit git hooks have exactly the same checks as CircleCI and are defined in this script. This step ensures that all commits comply with the established rules. However the continuous integration will ultimately be validated that the changes are correct.

Design

App support different screen sizes and the content has been adapted to fit for mobile devices and tablets. To do that, it has been created a flexible layout using one or more of the following concepts:

In terms of design has been followed recommendations Android Material Design comprehensive guide for visual, motion, and interaction design across platforms and devices. Granting the project in this way a great user experience (UX) and user interface (UI). For more info about UX best practices visit link.

Moreover, has been implemented support for dark theme with the following benefits:

  • Can reduce power usage by a significant amount (depending on the device’s screen technology).
  • Improves visibility for users with low vision and those who are sensitive to bright light.
  • Makes it easier for anyone to use a device in a low-light environment.

Architecture

The architecture of the application is based, apply and strictly complies with each of the following 5 points:

Modules

Modules are collection of source files and build settings that allow you to divide a project into discrete units of functionality. In this case apart from dividing by functionality/responsibility, existing the following dependence between them:

The above graph shows the app modularisation:

  • :app module depends on :base, :data, :domain and :test-shared
  • :data module depends on :base and :test-shared.
  • :domain module depends on :base, :data and :test-shared
  • :base doesn’t have any dependency.

App module

The :app module is an com.android.application, which is needed to create the app bundle. It is also responsible for initiating the dependency graph, play core and another project global libraries, differentiating especially between different app environments.

Base module

The :base module is an com.android.library only contains code and resources which are shared between other modules. Reusing this way resources, layouts, views, and components in the different modules, without the need to duplicate code.

Data module

The :data module is an com.android.library for serving network requests or accessing to the database. Providing the data source for the many features that require it.

Domain module

The :domain module is an com.android.library lays a bridge between data and view layers. It performs any business logic getting data from data module and serves to view.

Test shared module

The :test-shared module is an com.android.library, basically contains test utilities that can be used by the different modules.

Architecture components

Ideally, ViewModels shouldn’t know anything about Android. This improves testability, leak safety and modularity. ViewModels have different scopes than activities or fragments. While a ViewModel is alive and running, an activity can be in any of its lifecycle states. Activities and fragments can be destroyed and created again while the ViewModel is unaware.

Passing a reference of the View (activity or fragment) to the ViewModel is a serious risk. Lets assume the ViewModel requests data from the network and the data comes back some time later. At that moment, the View reference might be destroyed or might be an old activity that is no longer visible, generating a memory leak and, possibly, a crash.

The communication between the different layers follow the above diagram using the reactive paradigm, observing changes on components without need of callbacks avoiding leaks and edge cases related with them.

Documentation

The documentation is generated following KDoc language (the equivalent of Java's JavaDoc) via documentation engine for Kotlin Dokka.

To consult it check this link or open the project /docs directory.

Tech-stack

This project takes advantage of many popular libraries, plugins and tools of the Android ecosystem. Most of the libraries are in the stable version, unless there is a good reason to use non-stable dependency.

Mainly on:

  • Kotlin - Kotlin is a cross-platform, statically typed, general-purpose programming language with type inference.
  • Kotlin DSL - Basically, a DSL is a language that focuses on just one particular part of an application. A general-purpose language, such as Kotlin or Java, on the other hand, can be used in multiple parts of one application.

Patterns

  • Repository Pattern - The Repository Pattern is one of the most popular patterns to create an enterprise level application. It restricts us to work directly with the data in the application and creates new layers for database operations, business logic, and the application's UI.
  • Observer Pattern - The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods.
  • UseCase Pattern - This pattern means to convert and pass user actions to inner layers of the application.
  • Delegation Pattern - In software engineering, the delegation pattern is an object-oriented design pattern that allows object composition to achieve the same code reuse as inheritance.
  • TDD - Test-driven development (TDD) is a software development process that relies on the repetition of a very short development cycle: requirements are turned into very specific test cases, then the software is improved so that the tests pass.

Dependencies

  • Jetpack:
    • Android KTX - provide concise, idiomatic Kotlin to Jetpack and Android platform APIs.
    • AndroidX - major improvement to the original Android Support Library, which is no longer maintained.
    • Data Binding - allows you to bind UI components in your layouts to data sources in your app using a declarative format rather than programmatically.
    • Lifecycle - perform actions in response to a change in the lifecycle status of another component, such as activities and fragments.
    • LiveData - lifecycle-aware, meaning it respects the lifecycle of other app components, such as activities, fragments, or services.
    • ViewModel - designed to store and manage UI-related data in a lifecycle conscious way. The ViewModel class allows data to survive configuration changes such as screen rotations.
  • Coroutines - managing background threads with simplified code and reducing needs for callbacks.
  • Dagger2 - dependency injector for replacement all FactoryFactory classes.
  • Retrofit2 - type-safe HTTP client.
  • Glide - image loading library for Android.
  • Gson - makes it easy to parse JSON into Kotlin objects.
  • Timber - a logger with a small, extensible API which provides utility on top of Android's normal Log class.
  • and more...

Test dependencies

  • Espresso - to write concise, beautiful, and reliable Android UI tests
  • JUnit - a simple framework to write repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks.
  • Mockito - most popular Mocking framework for unit tests written in Java.
  • Mockk - provides DSL to mock behavior. Built from zero to fit Kotlin language.
  • AndroidX - the androidx test library provides an extensive framework for testing Android apps.
  • and more...

Plugins

  • Ktlint - an anti-bikeshedding Kotlin linter with built-in formatter.
  • Detekt - a static code analysis tool for the Kotlin programming language.
  • Spotless - a code formatter can do more than just find formatting errors.
  • Versions - make easy to determine which dependencies have updates.
  • Jacoco - code coverage library
  • and more...

Resources

Projects

This is project is a sample, to inspire you and should handle most of the common cases, but obviously not all. If you need to take a look at additional resources to find solutions for your project, visit these interesting projects:

Articles

A collection of very interesting articles related last android community tendencies and recommendations for start to take in consideration for your current/next project:

Libraries

The open-source community create and maintains tons of awesome libraries making your job more easy, giving the opportunity to use them in your developments. Here are a very important collection of them:

Best practices

Avoid reinventing the wheel by following these guidelines:

Codelabs

Google Developers Codelabs provide a guided, tutorial, hands-on coding experience. Most codelabs will step you through the process of building a small application, or adding a new feature to an existing application. They cover a wide range of android concepts to learn and practice:

Contributions

All contributions are welcome! Please feel free to post questions, recommendations, ideas, bugs by create new issue following the template or if you want create directly new pull request.

Roadmap:

  • [ ] - A detail screen to be added
  • [ ] - Cards to have more detail
  • [x] - Some screenshots to be added
  • [x] - Write common DSL scripts

License

Copyright 2019 nuhkoca.com

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].