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.
39 lines
1.9 KiB
TOML
39 lines
1.9 KiB
TOML
[versions]
|
|
activityVersion = "26"
|
|
agp = "8.9.1"
|
|
androidxActivity = "1.9.0"
|
|
gson = "2.10.1"
|
|
junit = "4.13.2"
|
|
junitVersion = "1.1.5"
|
|
espressoCore = "3.5.1"
|
|
appcompat = "1.6.1"
|
|
loggingInterceptor = "4.9.3"
|
|
material = "1.10.0"
|
|
activity = "1.8.0"
|
|
constraintlayout = "2.1.4"
|
|
gridlayout = "1.0.0"
|
|
retrofit = "2.9.0"
|
|
workRuntime = "2.10.0"
|
|
|
|
[libraries]
|
|
activity-v190 = { module = "androidx.activity:activity", version.ref = "androidxActivity" }
|
|
activity-v26 = { module = "androidx.activity:activity", version.ref = "activityVersion" }
|
|
converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" }
|
|
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
|
|
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
|
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
|
|
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
|
|
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
|
|
logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "loggingInterceptor" }
|
|
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
|
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
|
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
|
gridlayout = { group = "androidx.gridlayout", name = "gridlayout", version.ref = "gridlayout" }
|
|
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "loggingInterceptor" }
|
|
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
|
|
work-runtime = { module = "androidx.work:work-runtime", version.ref = "workRuntime" }
|
|
|
|
[plugins]
|
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
|
|