aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/org/traccar/manager/MainFragment.kt8
-rw-r--r--app/src/main/java/org/traccar/manager/StartFragment.kt1
2 files changed, 7 insertions, 2 deletions
diff --git a/app/src/main/java/org/traccar/manager/MainFragment.kt b/app/src/main/java/org/traccar/manager/MainFragment.kt
index 2675d0c..3f09e56 100644
--- a/app/src/main/java/org/traccar/manager/MainFragment.kt
+++ b/app/src/main/java/org/traccar/manager/MainFragment.kt
@@ -77,7 +77,13 @@ class MainFragment : WebViewFragment() {
webSettings.mediaPlaybackRequiresUserGesture = false
val url = PreferenceManager.getDefaultSharedPreferences(activity)
.getString(MainActivity.PREFERENCE_URL, null)
- url?.let { webView.loadUrl(it) }
+ if (url != null) {
+ webView.loadUrl(url)
+ } else {
+ activity.fragmentManager
+ .beginTransaction().replace(android.R.id.content, StartFragment())
+ .commitAllowingStateLoss()
+ }
}
private val broadcastReceiver: BroadcastReceiver = object : BroadcastReceiver() {
diff --git a/app/src/main/java/org/traccar/manager/StartFragment.kt b/app/src/main/java/org/traccar/manager/StartFragment.kt
index ee379a2..536b22c 100644
--- a/app/src/main/java/org/traccar/manager/StartFragment.kt
+++ b/app/src/main/java/org/traccar/manager/StartFragment.kt
@@ -31,7 +31,6 @@ import android.widget.EditText
import androidx.preference.PreferenceManager
import org.json.JSONException
import org.json.JSONObject
-import org.traccar.manager.StartFragment
import java.io.BufferedReader
import java.io.IOException
import java.io.InputStreamReader