/room-demo-repo

A room database-oriented notes taking app with best practices to integrate android jetpack components using Kotlin with MVVM, live-data, data-binding, Rxandroid and dagger2.

Primary LanguageJavaApache License 2.0Apache-2.0

Room-Demo-Repo

A multi-module repository which is a successor of RoomDemo. This repository contains three individual modules, developed using latest trends.

To start development from scratch, It is strongly recommended to follow:

Making a Notes App Using Room Database: Pavneet Singh.

Introduction

The room-demo-kotlin-mvvm-dagger module is the most updated module and will be updated in near future.

It is written in kotlin and based on the MVVM architecture for clean code architecture with Dagger 2, to implement unit testing.

It simplifies the code using andorid jetpack with ViewModel, Data-Binding, LiveData, Coroutines, Room and Lifecyclee though if you are a fan of RxAdnroid then can follow the room-demo-rxandroid-livedata module.

Follow room-demo-kotlin-mvvm-dagger for clean architecture implementation, recommended by Google in Guide to app architecture

app guide

Dependencies' Description

Jetpack_logo kotlin_logo

This repository is divided into three independent modules which can be labeled as per complexity, based on underlying architecture and libs as:

  • MVVM - Google recommended architecture to achieve smooth UI and background task management.
  • Android KTX - Write concise code as kotlin help to reduce code length by 20 - 40%.
  • Architecture - MVVM architecture with recommended practices and libs to implement UI, persistence and networking etc.
  • Data Binding - To automatically handle UI and data handling(binding, updates etc) in XML via observer pattern.
  • Lifecycles - Hassle-free UI updates to avoid memory leaks, crashes and smooth task execution flow.
  • LiveData - Observer pattern based object to deliver data on UI(main) thread.
  • Room - SQLite database with ORM.
  • ViewModel - A logical entity to handle actions and background tasks with data persistence via viewmodelProviders and factory.
  • Kotlin Coroutines: For background thread management and execution.
  • Dagger 2 For dependency injector.
  • UI - Google material design lib with CardView and RecyclerView.
  • Java 8 - Write concise code with java-8 lambda and methods reference support.
  • RxAndroid - To handle background task management and data transformation.
  • Lifecycles - Hassle-free UI updates to avoid memory leaks, crashes and smooth task execution flow.
  • LiveData - Observer pattern based object to deliver data on UI(main) thread.
  • Room - SQLite database with ORM.
  • UI - Google material design lib with CardView and RecyclerView.
  • Java 8 - Write concise code with Java-8 lambda and methods reference support.
  • AsyncTask Deprecated - To handle background task management and data transformation.
  • Room - SQLite database with ORM.
  • UI - Google material design lib with CardView and RecyclerView.

Note: This uses allowMainThreadQueries() for demonstration and ease, which either should be replaced with AsyncTask or by RxJava or Coroutines(view other modules).

Tools:

Contribution

PRs are welcome though for major changes, raise an issue otherwise

  1. Fork the repo
  2. Create a new branch e.g. feature/feature-name, issue/issue-name
  3. Commit your changes
  4. Raise a PR

License

View Apache License
Copyright 2020 Pavneet Singh.

Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements.  See the NOTICE file distributed with this work for
additional information regarding copyright ownership.  The ASF licenses this
file to you 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.