feat: Add first-launch server URL input dialog
Implements a setup dialog on first game launch that allows users to enter their custom community server URL without rebuilding the APK. Features: - Server URL input dialog on first launch - URL validation (format check) - Connection test button - SharedPreferences storage - Priority: SharedPreferences > AndroidManifest.xml > EA defaults - Activity restart flow for applying configuration New files: - CommunityServerManager.smali (URL management) - ServerSetupActivity.smali + 4 inner classes (dialog UI) - res/layout/activity_server_setup.xml (layout) - SERVER-URL-INPUT-IMPLEMENTATION.md (docs) Modified files: - SynergyEnvironmentImpl.smali (SharedPreferences check priority) - MainActivity.smali (first-launch check + onActivityResult) - AndroidManifest.xml (declare ServerSetupActivity) Benefits: - One APK works with any server - Easy server switching - Lower barrier to entry for non-technical users
This commit is contained in:
107
res/layout/activity_server_setup.xml
Normal file
107
res/layout/activity_server_setup.xml
Normal file
@@ -0,0 +1,107 @@
|
||||
<?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:padding="24dp"
|
||||
android:background="#1a1a1a"
|
||||
android:gravity="center">
|
||||
|
||||
<!-- Title -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="🏎️ Community Server Setup"
|
||||
android:textSize="24sp"
|
||||
android:textColor="#ffffff"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center" />
|
||||
|
||||
<!-- Instructions -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Enter your community server URL:"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#cccccc"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:gravity="center" />
|
||||
|
||||
<!-- URL Input -->
|
||||
<EditText
|
||||
android:id="@+id/editTextServerUrl"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="https://rr3.example.com:5001"
|
||||
android:textColorHint="#666666"
|
||||
android:textColor="#ffffff"
|
||||
android:background="#2a2a2a"
|
||||
android:padding="16dp"
|
||||
android:inputType="textUri"
|
||||
android:textSize="14sp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:gravity="center" />
|
||||
|
||||
<!-- Examples Section -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Examples:"
|
||||
android:textSize="14sp"
|
||||
android:textColor="#aaaaaa"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="• http://192.168.1.100:5001\n• https://rr3.yourserver.com\n• https://rr3.example.com:8443"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#888888"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:fontFamily="monospace" />
|
||||
|
||||
<!-- Status Text -->
|
||||
<TextView
|
||||
android:id="@+id/textViewStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textSize="14sp"
|
||||
android:textColor="#ff6666"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:visibility="gone"
|
||||
android:gravity="center" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonTest"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Test Connection"
|
||||
android:textColor="#ffffff"
|
||||
android:background="#3a3a3a"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:padding="16dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonContinue"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Continue →"
|
||||
android:textColor="#ffffff"
|
||||
android:background="#4CAF50"
|
||||
android:layout_marginStart="8dp"
|
||||
android:padding="16dp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user