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:
99
res/layout/activity_server_selection.xml
Normal file
99
res/layout/activity_server_selection.xml
Normal file
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:padding="24dp"
|
||||
android:background="#000000">
|
||||
|
||||
<!-- Logo/Title Section -->
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="🏎️ REAL RACING 3 🏎️"
|
||||
android:textSize="32sp"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="8dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_subtitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Community Edition"
|
||||
android:textSize="18sp"
|
||||
android:textColor="#AAAAAA"
|
||||
android:layout_marginBottom="48dp"/>
|
||||
|
||||
<!-- Offline Mode Button -->
|
||||
<LinearLayout
|
||||
android:id="@+id/btn_offline"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="#1E1E1E"
|
||||
android:padding="20dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="🏠 OFFLINE MODE"
|
||||
android:textSize="22sp"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="8dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Play with unlimited currency\nand custom content"
|
||||
android:textSize="14sp"
|
||||
android:textColor="#AAAAAA"/>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Online Mode Button -->
|
||||
<LinearLayout
|
||||
android:id="@+id/btn_online"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="#1E1E1E"
|
||||
android:padding="20dp"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="🌐 ONLINE MODE"
|
||||
android:textSize="22sp"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="8dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Connect to community server\nfor multiplayer and events"
|
||||
android:textSize="14sp"
|
||||
android:textColor="#AAAAAA"/>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Help Link -->
|
||||
<TextView
|
||||
android:id="@+id/tv_help"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="First time? Click here for help"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#4A90E2"
|
||||
android:clickable="true"
|
||||
android:focusable="true"/>
|
||||
|
||||
</LinearLayout>
|
||||
86
res/layout/dialog_server_input.xml
Normal file
86
res/layout/dialog_server_input.xml
Normal file
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="24dp">
|
||||
|
||||
<!-- Title -->
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="🌐 Enter Server Address"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
|
||||
<!-- Server URL Input -->
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Server URL:"
|
||||
android:textSize="14sp"
|
||||
android:layout_marginBottom="8dp"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_server_url"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="https://rr3.barrer.net:8443"
|
||||
android:inputType="textUri"
|
||||
android:padding="12dp"
|
||||
android:background="#F0F0F0"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
|
||||
<!-- Quick Select Options -->
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Quick Select:"
|
||||
android:textSize="14sp"
|
||||
android:layout_marginBottom="8dp"/>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/rg_server_preset"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_official"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Official Community (rr3.barrer.net)"
|
||||
android:checked="true"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_local"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Local Server (localhost:3000)"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_custom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Custom Server"/>
|
||||
</RadioGroup>
|
||||
|
||||
<!-- Remember Choice Checkbox -->
|
||||
<CheckBox
|
||||
android:id="@+id/cb_remember"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Remember my choice"
|
||||
android:checked="true"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
|
||||
<!-- Info Text -->
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Note: Custom ports are supported (e.g., :8443)\nMake sure your server is running before connecting."
|
||||
android:textSize="12sp"
|
||||
android:textColor="#666666"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,6 +1 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<network-security-config>
|
||||
<domain-config cleartextTrafficPermitted="true">
|
||||
<domain includeSubdomains="true">127.0.0.1</domain>
|
||||
</domain-config>
|
||||
</network-security-config>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><network-security-config><base-config><trust-anchors><certificates src="system"/><certificates src="user"/></trust-anchors></base-config></network-security-config>
|
||||
Reference in New Issue
Block a user