forked from thijooree/android
74 lines
2.7 KiB
Markdown
74 lines
2.7 KiB
Markdown
# Accounts
|
|
|
|
The accounts screen is typically the default home destination. It shows all active bank accounts and cards grouped by bank and profile.
|
|
|
|
---
|
|
|
|
## Fragment — `AccountsFragment`
|
|
|
|
Hosts a `RecyclerView` driven by `AccountsAdapter`. Observes `HomeViewModel.accounts` (a `LiveData<List<BankAccount>>`). The list is filtered to only include accounts whose profile visibility flag is enabled.
|
|
|
|
Two image loaders are passed into the adapter (`AccountsFragment.kt:44-78`):
|
|
|
|
- `profileImageLoader` — MIB profile images fetched on-demand via `MibLoginFlow.fetchProfileImage()` (P41), keyed by hash and cached in memory for the fragment lifetime
|
|
- `localProfileImageLoader` — BML and Fahipay avatars loaded via `ProfileImageStore` using `bml_{profileId}` / `fahipay_{loginId}` keys
|
|
|
|
A **pull-to-refresh** gesture triggers `HomeActivity.autoRefresh()`, which re-fetches all bank dashboards in parallel.
|
|
|
|
---
|
|
|
|
## List Structure — `AccountsAdapter`
|
|
|
|
The adapter renders a mixed list of section headers and account rows.
|
|
|
|
### Section Headers
|
|
|
|
Accounts are grouped by bank + CIF type (for MIB) or bank name (for BML/Fahipay). Each group starts with a header row showing:
|
|
- Bank name and logo
|
|
- For MIB: `cifType` (e.g., `"Individual"`, `"Sole Propr"`) — never hardcoded, always from API
|
|
- Profile image (circular avatar, if set)
|
|
|
|
### Account / Card Rows
|
|
|
|
Each row is bound from an `AccountListDisplay` object produced by `AccountListParser.from(account)`. See [Account Parser Architecture](19-parsers.md) for mapping details.
|
|
|
|
| Field | Row element |
|
|
|---|---|
|
|
| `name` | Account or card name |
|
|
| `number` | Masked account/card number |
|
|
| `typeLabel` | Product type chip (e.g., `"Savings"`, `"Visa Platinum"`) |
|
|
| `balance` | Balance string (hidden as `••••` when hide-amounts is active) |
|
|
| `isCard` | Switches between account layout and card layout |
|
|
| `cardBrandIcon` | Visa / Mastercard / Amex logo drawable |
|
|
| `statusLabel` | Shown as an amber chip if non-null (e.g., `"Inactive"`) |
|
|
|
|
### Quick-Transfer Shortcut
|
|
|
|
Each account row has a **Send** button. Tapping it opens `TransferFragment` with the source account pre-selected.
|
|
|
|
---
|
|
|
|
## Account Tap — History
|
|
|
|
Tapping any account row navigates to `AccountHistoryFragment` for that account.
|
|
|
|
---
|
|
|
|
## Hide Amounts
|
|
|
|
When the toolbar eye icon is toggled (or `HomeViewModel.hideAmounts` is `true`), all balance strings in the adapter are replaced with `"••••"` without re-fetching data.
|
|
|
|
---
|
|
|
|
## Empty State
|
|
|
|
If no accounts are loaded (either no credentials or all profiles hidden), the screen shows an empty-state illustration with a prompt to add an account.
|
|
|
|
---
|
|
|
|
|
|
|
|
---
|
|
|
|
[← Login](03-login.md) **Next →** [Account History](05-account-history.md)
|