Skip to content

nyadav1992/IoweYou

Repository files navigation

IoweYou Application with MVVM Architecture and ROOM Database with LiveData and ViewModel

Backstory: Reason for the APP A group of 4 friends - Anuradha, Raju, Baburao Apte and Ghanshyam used to hang out together quite often. Every time they went out for either a meal or some coffee, someone or the other always got away with not paying their share. It was becoming increasingly difficult to track expenses. Anuradha, being the smart and the responsible one amongst the four, decided to build a mobile application that will track all the expenses they make together as a group. She remembered that every time Raju got out of paying for his share, he used to say "Thanks buddy, I owe you" and hence decided to name the application - IOU(I Owe You)



The app has following packages:

  1. adapters: To render the recyclerview data on view
  2. models: Here all the ENTITIES(Data) class are declared which stores the data information
  3. dao: Data Access Objects - In this package DAO are defines which holds the methods for data operations
  4. database: Room Database Class.
  5. repository: These class used to access data from DB and Provide to ViewModels
  6. viewmodels: These are intermeadioter between UI and Repositiry. It takes Data from Repo and provide to UI.
  7. ui: All the User intrection classes placed here.
  8. utils: this packege is used for declare application level utility class like Prefrense and Appconstants

The Users(Group) DB is pre initialize by createFromAsset method in Room database builder:

Defaults accounts are-:

  1. [email protected]:
  2. [email protected]:
  3. [email protected]:
  4. [email protected]:

Defaults password for all account is-: 123

The app flow:

  1. Splash: After launching app 1st screen will be a splash screen with "IOU" name and has a 1000 milisecong delay. It has condition (if user loggedin -> MainActivity else -> LoginActivity)
  2. Login: From here User can Login by providing credientials.
  3. MainActivity: Here i render Expense list and using 2 fragments for profile and add expense
  4. Profile Fragment: It shows logged-in user information with LogOut button
  5. Add Expense Fragment: From here user can add new expense in the list

The app logic:

  1. There is one table of users which work like a Group for the current requirement
  2. After providing loging crediantials user will redirect to Main Activity here user can see all the expenses create by group.
  3. By clicking UserName user can see profile and have an option to Logout from app
  4. By Add Expense button user can create Expense which will devide equally in the current group members and save to the Expense Table
  5. While Rendring expenses to Adapter logic for converting UserName into You written in adapter class.
  6. Same after edit data passed to the detail page so there is no logic required to show data.

Note:

  1. I am using ListAdapter with DiffUtil in RecyclerViewAdapter (It improves performance by calculates the difference between two lists and outputs a list of update operations that converts the first list into the second one)
  2. The MVVM Architecture workes great with Dagger2 (Dependency Injection). Will work on that part in future updates.
  3. I have Write some extra DB operations like INSERT, DELETE and UPDATE which are not in use now but it can be used when needed.
  4. I thought Side Navigation Drawer is not required to show user profile so i use Simple Fragment for this with behaviour like Drawer 😉

Library reference resources:

  1. Room: https://developer.android.com/topic/libraries/architecture/room.html
  2. ViewModel: https://developer.android.com/jetpack/androidx/releases/lifecycle
  3. Gson: https://github.com/google/gson

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages