Muyue 1842213cac Refactor: Clean codebase, add MP features, improve notifications & robustness
This commit incorporates significant improvements and cleaning across the Best 2048 application.

**Code Cleaning & Refactoring:**
- Removed comments, logs (Log.*, System.out), and unused imports/variables/methods from all core Java files:
    - MainActivity, Game, GameStats, MultiplayerActivity, NotificationHelper,
      OnSwipeTouchListener, ApiClient, ApiService, data classes.
- Removed NotificationService.java as it's replaced by WorkManager.

**Notifications:**
- Replaced the unreliable Handler-based NotificationService with a robust WorkManager implementation (NotificationWorker.java).
- MainActivity now schedules/cancels periodic work for notifications correctly based on user preference and permissions.
- Removed the <service> declaration for NotificationService from AndroidManifest.xml.
- Requires 'androidx.work:work-runtime' dependency in build.gradle.

**Multiplayer Enhancements:**
- **Stats Integration:**
    - Added recordMultiplayerWin/Loss/Draw methods to GameStats.
    - MultiplayerActivity now correctly calculates game duration and updates GameStats upon game completion.
    - Added saveStats() call in MultiplayerActivity.onPause to persist MP stats.
- **Animations:**
    - Implemented tile appearance and merge animations in MultiplayerActivity by comparing previous and current board states received via WebSocket.
- **Robustness:**
    - Added automatic WebSocket reconnection attempts with UI feedback in MultiplayerActivity.
    - Implemented finer-grained handling of server error messages (critical vs. info).
    - Added UI feedback for opponent disconnections (inferred from final game state).
    - Disabled swipe input during inappropriate times (opponent's turn, disconnected, game over).

**Layout Corrections:**
- Fixed duplicate ID 'average_time_per_game_label' in stats_layout.xml (renamed the multiplayer one to 'average_time_per_game_multi_label').
- Removed the unused 'perfect_game_label' TextView from stats_layout.xml.
- Updated MainActivity's updateStatisticsTextViews to use the corrected ID.

**Localization:**
- Translated all user-facing strings in strings.xml from French to English.
2025-04-06 14:50:40 +02:00
..