How gentlenestle/autotrade works
Project Type and Purpose
• AutoTrade is an Android‐only mobile application (“app” module) for browsing and managing a car showroom catalogue. There is no dedicated backend/repository code in this repo; all logic, data access, and UI live on the device.
Architectural Overview
• This is a layered, client‐only Android app following a loose MVC/MVP pattern:
• Presentation Layer: Activities & Fragments (UI controllers)
• Adapter Layer: RecyclerView Adapters for lists/grids (PhotoAdapter, FullscreenAdapter)
• Business Logic / Services Layer: utility classes handling network checks (CheckNetwork), file I/O (FileWork), phone calls (Call), sorting algorithms (HeapSort), data transformations (MyArrays).
• Data Layer: local storage (JSON or file resources managed by FileWork) and in‐memory models (Car.java).
• Android OS & External Services: Contacts, Phone, Network, File System.
Main Components
• Android OS (host environment)
• AutoTrade App module
· UI Components:
– MainActivity (entry point)
– ContactsActivity, DetailsActivity, FavouritesActivity, FiltrActivity, FullscreenActivity, PhotoFragment, FullscreenFragment
· Adapter Components: PhotoAdapter, FullscreenAdapter
· Domain Model: Car.java
· Services/Utilities: Call.java, CheckNetwork.java, FileWork.java, HeapSort.java, MyArrays.java
· Local Data Store: (app/resources, output.json if shipped, internal storage files)
• External Systems:
· Network (REST or file‐download if applicable)
· Phone Dialer (via Call class)
Relationships & Data Flows
• UI → invokes Adapter to bind Model → displays Car objects in RecyclerViews
• UI → uses FileWork to read/write JSON or data files → populates model list
• UI → calls HeapSort/MyArrays for sorting/filtering → updated lists
• UI → invokes CheckNetwork before any online operations
• UI → triggers Call to hand off to Android dialer Intent
• UI Intents navigate between Activities (MainActivity → DetailsActivity, FavouritesActivity, etc.)
• Optionally: FileWork ↔ Android File System; any network calls ↔ remote server
Architectural Patterns & Principles
• Single Activity per screen model, with Fragments for reusable UI (fullscreen image viewer, photo gallery)
• Separation of Concerns:
– UI logic in Activities/Fragments
– Data transformations/sorting in dedicated utility classes
– File & network I/O abstracted into service classes
• Dependency Flow: Presentation → Domain → Data → OS/External Services