diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-11-05 12:20:17 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-11-05 12:20:17 +1300 |
commit | 55ff767f6379f2f3cc14527e7a4b644d794885de (patch) | |
tree | 6f690e00004288bf84e3f563975671cb4e85a983 | |
parent | 08a01ba7816ee09d3923e984fe30a9ee14594851 (diff) | |
download | etbsa-traccar-manager-android-55ff767f6379f2f3cc14527e7a4b644d794885de.tar.gz etbsa-traccar-manager-android-55ff767f6379f2f3cc14527e7a4b644d794885de.tar.bz2 etbsa-traccar-manager-android-55ff767f6379f2f3cc14527e7a4b644d794885de.zip |
Load correct server page
-rw-r--r-- | app/src/main/java/org/traccar/manager/MainActivity.java | 3 | ||||
-rw-r--r-- | app/src/main/java/org/traccar/manager/MainFragment.java | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/app/src/main/java/org/traccar/manager/MainActivity.java b/app/src/main/java/org/traccar/manager/MainActivity.java index 39d04ec..fd4c23b 100644 --- a/app/src/main/java/org/traccar/manager/MainActivity.java +++ b/app/src/main/java/org/traccar/manager/MainActivity.java @@ -33,8 +33,7 @@ public class MainActivity extends Activity { } private void initContent() { - String url = PreferenceManager.getDefaultSharedPreferences(this).getString(PREFERENCE_URL, null); - if (url != null) { + if (PreferenceManager.getDefaultSharedPreferences(this).contains(PREFERENCE_URL)) { getFragmentManager().beginTransaction().add(android.R.id.content, new MainFragment()).commit(); } else { getFragmentManager().beginTransaction().add(android.R.id.content, new StartFragment()).commit(); diff --git a/app/src/main/java/org/traccar/manager/MainFragment.java b/app/src/main/java/org/traccar/manager/MainFragment.java index cfa4827..5b2c5c5 100644 --- a/app/src/main/java/org/traccar/manager/MainFragment.java +++ b/app/src/main/java/org/traccar/manager/MainFragment.java @@ -18,6 +18,7 @@ package org.traccar.manager; import android.content.pm.ApplicationInfo; import android.os.Build; import android.os.Bundle; +import android.preference.PreferenceManager; import android.view.View; import android.webkit.WebSettings; import android.webkit.WebView; @@ -40,7 +41,10 @@ public class MainFragment extends WebViewFragment { webSettings.setDomStorageEnabled(true); webSettings.setDatabaseEnabled(true); - getWebView().loadUrl("http://10.0.2.2:8082"); + String url = PreferenceManager.getDefaultSharedPreferences( + getActivity()).getString(MainActivity.PREFERENCE_URL, null); + + getWebView().loadUrl(url); } } |