Add community server selection system

- NEW: ServerSelectionActivity as main launcher
  - Beautiful startup menu (Offline/Online modes)
  - URL input dialog with custom port support
  - Quick select presets (Official/Local/Custom)
  - 'Remember my choice' persistence
  - Help dialog for first-time users

- NEW: ServerManager for Nimble SDK URL overrides
  - Automatically configures all EA endpoints
  - Supports custom ports (:8443, :3000, etc.)
  - Comprehensive error handling and logging

- Modified MainActivity to read Intent extras
  - Reads mode (online/offline) from ServerSelectionActivity
  - Configures custom server before game init
  - Maintains backward compatibility

- Modified AndroidManifest.xml
  - ServerSelectionActivity is now LAUNCHER
  - UnpackAssetsActivity no longer exports MAIN intent
  - Intent extras preserved through activity chain

- Added XML layouts
  - activity_server_selection.xml (main menu UI)
  - dialog_server_input.xml (URL input dialog)

- Server URL format: https://domain.com:port
- SharedPreferences: rr3_server_config.xml

Ready for Phase 2: Community server backend implementation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-19 00:50:20 -08:00
parent 6ffa31962e
commit e8a5cbcd7e
19 changed files with 942 additions and 7 deletions

View File

@@ -2238,6 +2238,49 @@
:cond_0
invoke-static {p0}, Lcom/firemint/realracing/AppProxy;->SetActivity(Landroid/app/Activity;)V
# Check if launched from ServerSelectionActivity
invoke-virtual {p0}, Lcom/firemint/realracing/MainActivity;->getIntent()Landroid/content/Intent;
move-result-object v0
if-eqz v0, :skip_server_config
const-string v1, "mode"
invoke-virtual {v0, v1}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;
move-result-object v1
if-eqz v1, :skip_server_config
const-string v2, "online"
invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v2
if-eqz v2, :skip_server_config
# Online mode - set up custom server
const-string v1, "serverUrl"
invoke-virtual {v0, v1}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
if-eqz v0, :skip_server_config
invoke-virtual {v0}, Ljava/lang/String;->isEmpty()Z
move-result v1
if-nez v1, :skip_server_config
# Set custom server URL for Nimble SDK
invoke-static {v0}, Lcom/firemint/realracing/ServerManager;->setCustomServer(Ljava/lang/String;)V
:skip_server_config
# Delayed initialization of offline managers (500ms delay to prevent crash)
# This allows Android system to fully initialize Context, SharedPreferences, etc.
iget-object v0, p0, Lcom/firemint/realracing/MainActivity;->handler:Landroid/os/Handler;