3.2 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
SAR Android (Sistema de Atendimento ao Representante) is a legacy Java Android sales-representative app. It allows sales reps to manage clients, products, and orders offline, then sync with a central PostgreSQL server.
Language: Java (no Kotlin)
Build System: Eclipse ADT (pre-Gradle) — no build.gradle; configured via .project, .classpath, and project.properties
Min SDK: 19 | Target SDK: 35
Root package: br.com.jcsinformatica.sarandroid
Building
This is an Eclipse ADT project, not an Android Studio/Gradle project. There are no gradlew commands.
- Open in Eclipse with ADT plugin or import into Android Studio using "Import Eclipse ADT Project"
- SDK target is set in
project.properties(target=android-23) - ProGuard config exists in
proguard-project.txtbut is disabled - Lint suppressions are in
lint.xml
There are no automated tests (no test/ or androidTest/ directories, no JUnit/Espresso setup).
Architecture
Entry Flow
SplashScreen → LoginActivity → MainActivity (expandable menu) → feature Activities
Key Classes
Global— static singleton holding runtime state: currentEmpresa,Pedido,ItemPedido. CallGlobal.getEmpresa()(throwsWarningExceptionif unset).GlobalActivity— baseActivitysubclass for all post-login screens; reads company name fromGlobaland sets the title.DatabaseHelper—SQLiteOpenHelpermanaging the local SQLite schema.ConnectionManager— manages PostgreSQL JDBC connections (20s timeout); used for remote sync.
Package Structure
| Package | Role |
|---|---|
vo/ |
Plain value objects (models): Produto, Cliente, Pedido, ItemPedido, Empresa, Representante, etc. |
database/ |
SQLite DAOs (named *DB.java or *BD.java): CRUD + sync logic with MD5 change detection |
postgres/ |
PostgreSQL JDBC operations mirroring the DAO layer (*PGSQL.java) |
uimodels/ |
Custom list adapters and UI helpers |
pedido/ |
Order/quote Activities (UpdatePedidoActivity, UpdatePedItemActivity, BrowsePedido, etc.) |
produto/ |
Product Activities (BrowseProduto, UpdateProduto, FotosProduto) |
cliente/ |
Client Activities (BrowseCliente, UpdateCliente) |
comunicacao/ |
ComunicaActivity — orchestrates full data sync with the PostgreSQL server |
consulta/ |
Query/report Activities (BrowsePedidoConsulta, ConsultaVendasActivity) |
Dual-Database Sync Pattern
All persistent data lives in local SQLite and is periodically synced to/from PostgreSQL over direct JDBC. The pattern per entity:
*DB.java— reads/writes SQLite, computes MD5 checksums for change detection*PGSQL.java— mirrors inserts/updates to the PostgreSQL serverComunicaActivityacts as the sync orchestrator and provides a callback interface for progress updates
Third-Party Libraries (in libs/)
postgresql-8.2-jdbc3.jar— PostgreSQL JDBC driverjoda-time-2.5.jar— date/time calculationscommons-net-3.3.jar— FTP support