Nouveau jeu: - Ajout du jeu Papelito (Undercover) avec flow complet - Configuration des joueurs, temps de discussion, votes - Système d'élimination et gestion des égalités - Interface Material Design avec cartes et dialogues Corrections de bugs critiques: - Fix crash Papelito au lancement (MaterialSwitch vs Switch) - Fix crash lors des votes nuls (égalité entre joueurs) - Fix crash fin de partie lors du retour (navigation vers hub) - Fix visibilité texte questions (couleur dynamique) - Fix compteur tours défis invisible (blanc sur blanc) - Fix icone question manquante pendant défis Améliorations UX Boidelo Classic: - Harmonisation des couleurs dynamiques (toolbar, bouton) - Bouton de réglages maintenant visible (MaterialButton) - Conteneur IA se rétracte quand désactivé - Meilleure gestion des couleurs selon catégorie - Fix délai entre manches pour affichage message fin Améliorations techniques: - Mise à jour CLAUDE.md avec architecture Papelito - Amélioration tests unitaires (GameEngine, PlayerStats, QuestionCategory) - Standardisation des clés Intent entre activités - Nettoyage code mort (méthodes non utilisées) Tests: - 302 tests unitaires passants - Couverture GameEngine, PlayerStats, QuestionCategory - Tests Papelito (game logic, player management) - Tests Game89 (challenges, players) 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
6.1 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Build Commands
Build the Project
# On Windows (using gradlew.bat)
.\gradlew.bat build
# On Linux/Mac (using gradlew)
./gradlew build
Build and Install Debug APK
# On Windows
.\gradlew.bat assembleDebug
# Install to connected device
adb install -r app\build\outputs\apk\debug\app-debug.apk
Run Tests
# Unit tests only
.\gradlew.bat test
# Android instrumented tests (requires connected device/emulator)
.\gradlew.bat connectedAndroidTest
# Run specific test class
.\gradlew.bat test --tests com.example.boidelov3.game.GameEngineTest
Clean Build
.\gradlew.bat clean
Project Architecture
High-Level Structure
Boidelo is an Android drinking game app built with Java and Gradle. The architecture has evolved from a single-game app to a multi-game platform with a central hub.
Package Structure:
com.example.boidelov3- Root packagecom.example.boidelov3.hub- Game selection hub (main entry point)com.example.boidelov3.games.boideloclassic- Original Boidelo gamecom.example.boidelov3.games.game89- 89++ card gamecom.example.boidelov3.games.papelito- Undercover party gamecom.example.boidelov3.data- Data models and repositoriescom.example.boidelov3.game- GameEngine (pure Java game logic)com.example.boidelov3.utils- Utilities (sound, error handling, security)
Entry Points
- GameSelectionActivity (
hub/GameSelectionActivity.java) - Main hub, displays available games via RecyclerView - MainActivity (
MainActivity.java) - Legacy entry for Boidelo Classic, being phased out
Game Flow Pattern
Each game follows this flow:
- Setup Activity - Player configuration (e.g.,
BoideloClassicSetupActivity,Game89SetupActivity) - Parameters Activity - Game settings (e.g.,
BoideloClassicParamsActivity) - Game Activity - Main gameplay (e.g.,
BoideloClassicGameActivity,Game89GameActivity) - End Game Activity - Results and statistics
Core Architecture Components
Data Layer:
QuestionRepository- Loads questions from JSON assets, manages SharedPreferencesResult<T, E>- Type-safe error handling wrapper (pattern:Result.success(value)orResult.error(error))PlayerStats- Tracks drinks consumed/distributed per playerQuestion- Rich model with variants, manches (rounds), distribution flagsQuestionCategory- Categorization with styling (colors, icons)
Business Logic:
GameEngine- Pure Java game logic, isolated from Android framework for testabilityOpenAIService- AI-powered question generation via ChatGPT APIChatGPTTask- Async task for AI question generation
UI Patterns:
- Material Design 3 components
- RecyclerView for game selection
- Dynamic player input (add/remove fields)
- Haptic feedback and sound effects
Question Processing Pipeline
Questions go through several transformations before display:
- Load from
assets/questions.json(150+ questions) - Replace player placeholders (
<J1>,<J2>,<J3>) - Process variants (
<variante>) - Handle manches (round challenges with countdown)
- Add drink count and verb conjugation
- Apply category-based styling
Persistence
- SharedPreferences - Player names, settings, asked questions tracking, statistics
- JSON Assets - Pre-loaded question database
- BuildConfig - API keys (stored in
local.properties, not version-controlled)
Security Configuration
- API keys stored in
local.properties(excluded from git) SecureConfigutility for secure access- Database credentials in BuildConfig are intentionally empty (use backend API)
Testing Infrastructure
- Unit tests in
app/src/test/java/com/example/boidelov3/ GameEngineTest- 15 tests for game logicResultTest- Error handling wrapper testsQuestionCategoryTest- Category validation testsPlayerStatsTest- Player statistics tracking tests- Game-specific tests in subpackages (e.g.,
games/papelito/,games/game89/) - JUnit 4 framework
- Mockito 5.7.0 for mocking
Test Patterns:
- Each game has comprehensive test coverage (15+ tests per game)
- Tests cover: setup/teardown, edge cases, state transitions, player management, win conditions
- Defensive copy testing for collections
Important Files
app/build.gradle- Dependencies, build config, BuildConfig fieldslocal.properties- Local SDK path and API keys (not in git)assets/questions.json- Question database
Resource Management Conventions
Layout Naming: activity_<game>_<screen>.xml
activity_<game>_setup.xml- Player configurationactivity_<game>_game.xml- Main game screenactivity_<game>_result.xml- Results screendialog_<game>_<purpose>.xml- Custom dialogs
String Resources: Internationalized strings in res/values/strings.xml, organized by game with clear prefixes (e.g., papelito_, boidelo_, game89_)
Drawables: Game icons follow ic_<gamename>.xml pattern in res/drawable/
Game Registration (GameInfo System)
Games are registered in GameSelectionActivity.setupGamesList() via the GameInfo class. Each entry includes:
- Game name (enum value)
- Display name (string resource)
- Description (string resource)
- Icon resource
- Availability flag
Games are launched via Intent using GameType enum values.
Adding a New Game
- Create package under
com.example.boidelov3.games.<gamename> - Implement setup, parameters, and game activities
- Create
GameInfoentry inGameSelectionActivity.setupGamesList() - Add game icon/drawable resources
- Follow existing patterns for player management and game flow
Dependencies
- AndroidX AppCompat 1.7.0
- Material Design 1.12.0
- ConstraintLayout 2.2.0
- OkHttp 4.12.0
- Gson 2.11.0
- pgjdbc-ng 0.8.3 (PostgreSQL - currently unused)
- JUnit 4.13.2
- Mockito 5.7.0
- AndroidX Test JUnit 1.2.1
- Espresso 3.6.1
Build Configuration
minSdk: 24 (Android 7.0+)targetSdk: 35compileSdk: 35- Java 8 compatibility
- Namespace:
com.example.boidelov3