/FightPandemics-android

Android app for the FightPandemics platform

Primary LanguageKotlinMIT LicenseMIT

FightPandemics Android

License Platform API Build Status

Android app for the FightPandemics

Getting Started

  • The app is written entirely in Kotlin and uses the Gradle build system
  • To build the app, use the gradlew build command or use Import Project in Android Studio.
  • A Stable Version of 4.0 or newer is required and can be downloaded Here
  • Open FightPandemics-android in Android Studio
  • Happy coding!

Contributing

See the CONTRIBUTING file for guidelines on contributing.

Introduction

The application uses Clean Architecture based on MVVM and Repository patterns. Implemented Architecture principles follow Google recommended Guide to app architecture architecture

We kept logic away from Activities and Fragments and moved it to ViewModels. We observed data using LiveData and used the Data Binding Library to bind UI components in layouts to the app's data sources.

Android Jetpack is used as an Architecture but not limited to ViewModel, LiveData, Lifecycles, Navigation, Room and Data Binding. See a complete list in "Libraries used" section.

The application does network HTTP requests via Retrofit, OkHttp and GSON. Loaded data is saved to SQL based database Room, which serves as single source of truth and support offline mode. Paging library is used for data pagination online and offline.

Kotlin Coroutines manage background threads with simplified code and reducing needs for callbacks. Combination of Coroutines and Kotlin build in functions (transformation, collections) are preferred over RxJava 2.

Dagger 2 is used for dependency injection.

Glide is used for image loading and Timber for logging.

Libraries Used

Android Jetpack is a set of components, tools and guidance to make great Android apps. They bring together the existing Support Library and Architecture Components and arranges them into four categories:

Android Jetpack

  • Foundation - Components for core system capabilities, Kotlin extensions and support for multidex and automated testing.
    • AppCompat - Degrade gracefully on older versions of Android.
    • Android KTX - Write more concise, idiomatic Kotlin code.
    • Test - An Android testing framework for unit and runtime UI tests.
  • Architecture - A collection of libraries that help you design robust, testable, and maintainable apps. Start with classes for managing your UI component lifecycle and handling data persistence.
    • Data Binding - Declaratively bind observable data to UI elements.
    • Lifecycles - Create a UI that automatically responds to lifecycle events.
    • LiveData - Build data objects that notify views when the underlying database changes.
    • Navigation - Handle everything needed for in-app navigation.
    • Room - SQLite database with in-app objects and compile-time checks.
    • ViewModel - Store UI-related data that isn't destroyed on app rotations. Easily schedule asynchronous tasks for optimal execution.
    • WorkManager - Manage your Android background jobs.
    • Paging - Load and display small chunks of data at a time.
  • UI - Details on why and how to use UI Components in your apps - together or separate.
  • Third party
    • Kotlin Coroutines for managing background threads with simplified code and reducing needs for callbacks.
    • Dagger 2 A fast dependency injector.
    • Retrofit 2 A configurable REST client.
    • OkHttp 3 A type-safe HTTP client.
    • GSON A Json - Object converter using reflection.
    • Glide Image loading.
    • Timber A logger.

Reference to get you started

  1. https://proandroiddev.com/gradle-dependency-management-with-kotlin-94eed4df9a28
  2. https://proandroiddev.com/intro-to-app-modularization-42411e4c421e
  3. https://www.droidcon.com/media-detail?video=380845032
  4. https://proandroiddev.com/kotlin-clean-architecture-1ad42fcd97fa
  5. https://www.raywenderlich.com/3595916-clean-architecture-tutorial-for-android-getting-started
  6. http://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html
  7. https://developer.android.com/guide/navigation/navigation-dynamic
  8. https://proandroiddev.com/navigation-with-dynamic-feature-modules-48ee7645488
  9. https://medium.com/androiddevelopers/patterns-for-accessing-code-from-dynamic-feature-modules-7e5dca6f9123
  10. https://hackernoon.com/android-components-architecture-in-a-modular-word-d0k32i6

Credits

Special thanks to all contributors 💜

License

FightPandemics is available under the MIT license. See the LICENSE file for more info.