aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/org/traccar/manager/MainFragment.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/org/traccar/manager/MainFragment.kt')
-rw-r--r--app/src/main/java/org/traccar/manager/MainFragment.kt8
1 files changed, 7 insertions, 1 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() {