Github Trending Repositories [mvvmclean]
An Android app consuming GitHub Trending API to display the current trending Github repositories. It has been built using kotlin with clean architecture principles, Repository Pattern and MVVM pattern as well as Architecture Components.
Min API Level Supported : 19
Prerequisite
Before running the project check your gradle version matches the required.
package-name: com.mvvmclean.trendingrepos
compileSdkVersion = 29
targetSdkVersion = 29
minSdkVersion = 19
buildToolsVersion = "29.0.2"
Development Environment
Android Studio 3.5
Build #AI-191.8026.42.35.5791312, built on August 9, 2019
JRE: 1.8.0_202-release-1483-b49-5587405 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS Mojave 10.14
Table of Contents
Architecture
The Application is split into a three layer architecture inorder to provide clean separation of concerns - making the code easier to navigate and maintain.
- Data - Layer that holds APIs, Database, Cache
- Domain - Layer that holds Use Cases, and Model Objects. Business logic happens here.
- Application - Layer that holds presentation, Android components, Viewmodels, Dagger components/modules handles Dependency Injection, etc. MVVM exists at this layer.
The three layered architectural approach is majorly guided by clean architecture which provides a clear separation of concerns with its Abstraction Principle.
Features
- Trending Repository Listing
- Repository sorting by stars and name
- Take user to corresponding repository on long press
- Pull to refresh repository
- Offline Storage ( Scheduled repo remote controller syncing, App will sync with backend server in every 2hrs )
Testing
app/test/ - Unit tests
- test -> Right click on package name(com.mvvmclean.trendingrepos) -> Run Test In 'com.mvvmclean.trendingrepos'app/androidTest/ - Instrumentation tests
- androidTest -> Right click on package name(com.mvvmclean.trendingrepos) -> Run Test In 'com.mvvmclean.trendingrepos'
Libraries
Following are the Libraries used:
- Material Design - Google material design UIs.
- Dagger2 - Dependency Injection lib with large community support.
- Retrofit - Network Http Client
- Jetpack
- Viewmodel - Channel between use cases and UI
- Data Binding - For binding of UI components in layouts to data sources, and coroutines support.
- Moshi - Data, Model & Entity JSON Parser that understands Kotlin non-nullable and default parameters
- okhttp-logging-interceptor - logs HTTP request and response data.
- Mockito - Mocking framework used in unit tests.
- kotlinx.coroutines - Library Support for coroutines, provides
runBlocking
coroutine builder used in tests - MockWebServer - web server for testing HTTP clients.
- Leak Canary - Leak Detection Library
- Espresso - Test framework to write UI Tests
- recyclerview-animators - Recycler View Animations
- Room Persistence Library - Robust database access while harnessing the full power of SQLite
- Robolectric - Android Unit Tests framework.
- Truth - Provides fluent assertions for Java and Android
Extras
Gradle Dependencies
- dependencies.gradle - Centralized versioning of gradle dependencies in a global file
- Version.properties - App version details
Resource Values
- Fonts
- Dimension & String Values
- Themes & Styles
- Network Config
Screenshots
- Architecure
- App Screens
Demo
License
Copyright 2020 Anoop M Maddasseri
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.