# chandru2002-2/bill-master-android-billing-application architecture

> Architecture diagram of the GitHub repository chandru2002-2/bill-master-android-billing-application, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chandru2002-2/bill-master-android-billing-application
- Repository: https://github.com/chandru2002-2/bill-master-android-billing-application

## Overview

1. **Overall structure**
   - This is a single-module Android app (`app/`) written in **Java** with a classic **Activity-based** UI architecture.
   - There is no separate backend repository here; cloud integration is handled from the client via **Firebase Auth** and **Firestore**.

2. **App entry and authentication boundary**
   - `loginActivity.java` plus `activity_login.xml` form the likely entry gate for the app.
   - Authentication is an architectural boundary: users must sign in before reaching billing workflows, with Firebase Authentication providing identity/session handling.

3. **Core billing workflow**
   - The main transaction flow is centered around `BillEntry.java` and `activity_bill_entry.xml`.
   - This screen is where bill items are assembled from multiple input paths: **quick add**, **barcode scanning**, and **manual entry**.
   - `Product.java` and `BillEntry.java` represent the primary billing data model and line-item logic.

4. **Item entry sub-flows**
   - `ManualEntry.java` and `activity_manual_entry.xml` handle explicit item/product entry when scanning or quick add is not used.
   - The presence of item row layouts like `item_bill_entry.xml` suggests repeated line items are rendered as a list with add/remove/quantity controls.

5. **Customer context capture**
   - `CustomerDetailsActivity.java` and `activity_customer_details.xml` capture buyer information before invoice completion.
   - This is a separate step in the billing pipeline, implying customer metadata is associated with the bill before review/export.

6. **Bill review and finalization**
   - `BillReviewActivity.java` and `activity_bill_review.xml` are the confirmation/finalization stage.
   - This is where totals are reviewed and payment mode is chosen.
   - The readme indicates supported payment paths: **Cash, Card, NFC, and UPI QR**, so payment handling is part of the checkout boundary rather than a separate service.

7. **Historical bills / reporting**
   - `PreviousBillsActivity.java` and `activity_previous_bills.xml` provide access to saved invoices and sales history.
   - The repo positions this as a lightweight analytics/history layer with filtering by customer name and date, likely reading from local storage and/or Firestore-backed records.

8. **Settings and operational configuration**
   - `SettingsActivity.java` with `activity_settings.xml` appears to be the control surface for app-level behavior.
   - The README’s “customizable quick add” feature implies settings also manage frequently sold products and local shortcuts used by the billing screen.

9. **Persistence and sync model**
   - The architecture is explicitly **hybrid/offline-first**: local storage supports fast offline operation, while **Firestore** provides cloud backup/sync.
   - That means the app’s critical data flow is: user input → local state/storage for immediate use → optional sync to Firebase for continuity and backup.

10. **Invoice generation and sharing**
   - The app generates PDFs using **iText7** and shares them externally, including via **WhatsApp**.
   - `androidx.core.content.FileProvider` is part of the sharing boundary, enabling secure file handoff without exposing raw file paths.

11. **Scan/capture and device integrations**
   - Barcode/QR-related features are supported by **ZXing**, and the manifest likely declares **camera** permissions for scanning.
   - NFC and QR payment support imply the app uses device hardware/input integrations as part of checkout, not just as passive UI elements.

12. **UI composition**
   - The UI is split into screen-specific XML layouts plus reusable row/dialog layouts:
     - screens: `activity_*.xml`
     - list items: `item_*.xml`
     - dialogs: `dialog_nfc_tap.xml`, `dialog_qr_code.xml`
   - This indicates a modular UI composition where each workflow step has its own screen and auxiliary modal UI.

13. **Visual system and assets**
   - The app uses Material-style resources and custom drawables for buttons, backgrounds, rounded inputs, quantity badges, and icons.
   - `values/themes.xml`, `colors.xml`, and the drawable set define the app’s branded billing UI rather than relying on default Android widgets.

14. **Project and delivery boundaries**
   - The repo is built with **Gradle Kotlin DSL**, and CI is present in `.github/workflows/android.yml`, so Android builds are automated.
   - Test coverage is scaffolded with both local unit tests and instrumented Android tests, though the visible architecture is primarily production-screen driven.

15. **How to diagram the system**
   - A useful architecture diagram would show:
     - **Auth gate** → `loginActivity`
     - **Billing workspace** → `BillEntry` / `ManualEntry`
     - **Customer capture** → `CustomerDetailsActivity`
     - **Review & payment** → `BillReviewActivity`
     - **History/settings** → `PreviousBillsActivity` / `SettingsActivity`
     - **Persistence layer** → local storage + Firestore sync
     - **External services** → Firebase Auth, Firestore, ZXing camera scanning, iText PDF generation, WhatsApp sharing, FileProvider/NFC/QR device integrations

Main entry points: [`app/src/main/java/com/example/sportsbill/BillEntry.java`](https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/BillEntry.java) (Bill entry), [`app/src/main/java/com/example/sportsbill/BillReviewActivity.java`](https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/BillReviewActivity.java) (Bill review), [`app/src/main/java/com/example/sportsbill/loginActivity.java`](https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/loginActivity.java) (Login), [`app/src/main/java/com/example/sportsbill/PreviousBillsActivity.java`](https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/PreviousBillsActivity.java) (Previous bills)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_ui["App screens"]
  node_n_login["Login<br/>activity<br/>[loginActivity.java]"]
  node_n_bill_entry["Bill entry<br/>activity<br/>[BillEntry.java]"]
  node_n_manual_entry["Manual entry<br/>activity<br/>[ManualEntry.java]"]
  node_n_customer["Customer details<br/>activity"]
  node_n_review["Bill review<br/>activity"]
  node_n_prev_bills["Previous bills<br/>activity"]
  node_n_settings["Settings<br/>activity"]
end

subgraph group_grp_data["Data layer"]
  node_n_product["Product<br/>model<br/>[Product.java]"]
  node_n_local[("Local store<br/>storage")]
end

subgraph group_grp_ext["External services"]
  node_n_firestore[("Firestore<br/>cloud sync")]
  node_n_firebase_auth[("Firebase Auth<br/>identity")]
  node_n_zxing{{"ZXing scan<br/>scanner"}}
  node_n_pdf["PDF export<br/>reporting"]
  node_n_share["File share<br/>file provider<br/>[filepaths.xml]"]
  node_n_whatsapp["WhatsApp<br/>share target"]
  node_n_nfc{{"NFC pay<br/>device integration<br/>[dialog_nfc_tap.xml]"}}
  node_n_qr{{"QR pay<br/>device integration<br/>[dialog_qr_code.xml]"}}
end

subgraph group_grp_build["Delivery"]
  node_n_build["Gradle build<br/>[build.gradle.kts]"]
  node_n_ci["CI workflow<br/>pipeline<br/>[android.yml]"]
end

node_n_login -->|"sign in"| node_n_firebase_auth
node_n_login -->|"enter app"| node_n_bill_entry
node_n_bill_entry -->|"manual add"| node_n_manual_entry
node_n_bill_entry -->|"scan item"| node_n_zxing
node_n_bill_entry -->|"build items"| node_n_product
node_n_bill_entry -->|"save draft"| node_n_local
node_n_bill_entry -->|"customer step"| node_n_customer
node_n_manual_entry -->|"create item"| node_n_product
node_n_customer -->|"continue"| node_n_review
node_n_review -->|"export invoice"| node_n_pdf
node_n_pdf -->|"hand off"| node_n_share
node_n_share -->|"share out"| node_n_whatsapp
node_n_review -->|"pay by NFC"| node_n_nfc
node_n_review -->|"pay by QR"| node_n_qr
node_n_review -->|"finalize bill"| node_n_local
node_n_local -->|"sync backup"| node_n_firestore
node_n_prev_bills -->|"read history"| node_n_local
node_n_prev_bills -->|"query cloud"| node_n_firestore
node_n_settings -->|"manage quick add"| node_n_local
node_n_build -->|"automation"| node_n_ci

click node_n_login "https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/loginActivity.java"
click node_n_bill_entry "https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/BillEntry.java"
click node_n_manual_entry "https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/ManualEntry.java"
click node_n_customer "https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/CustomerDetailsActivity.java"
click node_n_review "https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/BillReviewActivity.java"
click node_n_prev_bills "https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/PreviousBillsActivity.java"
click node_n_settings "https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/SettingsActivity.java"
click node_n_product "https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/Product.java"
click node_n_share "https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/res/xml/filepaths.xml"
click node_n_nfc "https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/res/layout/dialog_nfc_tap.xml"
click node_n_qr "https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/res/layout/dialog_qr_code.xml"
click node_n_build "https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/build.gradle.kts"
click node_n_ci "https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/.github/workflows/android.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_n_login,node_n_bill_entry,node_n_manual_entry,node_n_customer,node_n_review,node_n_prev_bills,node_n_settings toneBlue
class node_n_product,node_n_local toneAmber
class node_n_firestore,node_n_firebase_auth,node_n_zxing,node_n_pdf,node_n_share,node_n_whatsapp,node_n_nfc,node_n_qr toneMint
class node_n_build,node_n_ci toneRose
```

## Components

### App screens

Activity-based billing workflows and supporting layouts.

- [Login](https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/loginActivity.java): activity · Authentication gate before billing workflows. · `app/src/main/java/com/example/sportsbill/loginActivity.java`
- [Bill entry](https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/BillEntry.java): activity · Primary transaction workspace for assembling bill items. · `app/src/main/java/com/example/sportsbill/BillEntry.java`
- [Manual entry](https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/ManualEntry.java): activity · Explicit product/item entry flow used from billing. · `app/src/main/java/com/example/sportsbill/ManualEntry.java`
- [Customer details](https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/CustomerDetailsActivity.java): activity · Captures buyer context before review and finalization. · `app/src/main/java/com/example/sportsbill/CustomerDetailsActivity.java`
- [Bill review](https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/BillReviewActivity.java): activity · Totals, payment mode selection, and checkout confirmation. · `app/src/main/java/com/example/sportsbill/BillReviewActivity.java`
- [Previous bills](https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/PreviousBillsActivity.java): activity · History view for saved invoices and sales records. · `app/src/main/java/com/example/sportsbill/PreviousBillsActivity.java`
- [Settings](https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/SettingsActivity.java): activity · App-level configuration and quick-add management. · `app/src/main/java/com/example/sportsbill/SettingsActivity.java`

### Data layer

Core models plus local/cloud persistence and sync boundaries.

- [Product](https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/java/com/example/sportsbill/Product.java): model · Billing line-item and product data model. · `app/src/main/java/com/example/sportsbill/Product.java`
- **Local store**: storage · Offline-first persistence for fast bill creation and retrieval.

### External services

Third-party APIs and device integrations used by the app.

- **Firestore**: cloud sync · Cloud backup and shared record sync for billing data.
- **Firebase Auth**: identity · User authentication and session handling.
- **ZXing scan**: scanner · Barcode/QR capture used to add items quickly.
- **PDF export**: reporting · Invoice generation with iText7.
- [File share](https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/res/xml/filepaths.xml): file provider · Secure document handoff for sharing exported bills. · `app/src/main/res/xml/filepaths.xml`
- **WhatsApp**: share target · External sharing channel for generated invoices.
- [NFC pay](https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/res/layout/dialog_nfc_tap.xml): device integration · Tap-based payment path and related device interaction. · `app/src/main/res/layout/dialog_nfc_tap.xml`
- [QR pay](https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/src/main/res/layout/dialog_qr_code.xml): device integration · QR code payment path and dialog UI. · `app/src/main/res/layout/dialog_qr_code.xml`

### Delivery

Build, CI, and test scaffolding.

- [Gradle build](https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/app/build.gradle.kts): build · Android build configuration and dependency management. · `app/build.gradle.kts`
- [CI workflow](https://github.com/chandru2002-2/bill-master-android-billing-application/blob/main/.github/workflows/android.yml): pipeline · Automated Android build workflow. · `.github/workflows/android.yml`

## Connections

- Login → Firebase Auth: sign in · Authenticates users before they access billing flows.
- Login → Bill entry: enter app · Successful login leads into the billing workspace.
- Bill entry → Manual entry: manual add · Hands off to explicit item entry when needed.
- Bill entry → ZXing scan: scan item · Uses barcode/QR scanning to populate bill items.
- Bill entry → Product: build items · Creates and updates bill line items.
- Bill entry → Local store: save draft · Persists in-progress bills for offline-first use.
- Bill entry → Customer details: customer step · Moves from item assembly into customer context capture.
- Manual entry → Product: create item · Produces product/line-item data for the bill.
- Customer details → Bill review: continue · Transfers bill and customer metadata into review.
- Bill review → PDF export: export invoice · Generates a shareable invoice document.
- PDF export → File share: hand off · Provides the file through FileProvider for safe sharing.
- File share → WhatsApp: share out · Supports external delivery of the invoice through messaging.
- Bill review → NFC pay: pay by NFC · Checkout can proceed via NFC-based payment path.
- Bill review → QR pay: pay by QR · Checkout can proceed via QR-based payment path.
- Bill review → Local store: finalize bill · Stores finalized bill state locally for history and retrieval.
- Local store → Firestore: sync backup · Uploads persisted billing data to cloud storage when available.
- Previous bills → Local store: read history · Loads stored invoices and prior sales records.
- Previous bills → Firestore: query cloud · Can surface synced bill history from Firestore-backed data.
- Settings → Local store: manage quick add · Edits local shortcuts and app behavior for faster billing.
- Gradle build → CI workflow: automation · Project build is exercised by the CI workflow.
