diff --git a/OsmAnd/assets/server/go.html b/OsmAnd/assets/server/index.html
similarity index 100%
rename from OsmAnd/assets/server/go.html
rename to OsmAnd/assets/server/index.html
diff --git a/OsmAnd/res/layout/server_fragment.xml b/OsmAnd/res/layout/server_fragment.xml
index 57e04ac2f1..8b94edbfa5 100644
--- a/OsmAnd/res/layout/server_fragment.xml
+++ b/OsmAnd/res/layout/server_fragment.xml
@@ -13,19 +13,19 @@
android:textAlignment="center"
android:autoLink="web"
android:textColor="@color/color_white"
- android:text="@string/click_button_to_start_server"
+ android:text="@string/start_web_server"
android:gravity="center_horizontal"/>
+ android:text="@string/shared_string_start"/>
+ android:text="@string/shared_string_stop"/>
\ No newline at end of file
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 0ef0445fe2..cd5d44459f 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -11,10 +11,10 @@
Thx - Hardy
-->
- Start
- Stop
- Click button to start server
- Click second button to deactivate server
+ Stop
+ Start
+ Start web server
+ Stop web server
Web server
Redo
Please add at least two points.
diff --git a/OsmAnd/src/net/osmand/plus/server/OsmAndHttpServer.java b/OsmAnd/src/net/osmand/plus/server/OsmAndHttpServer.java
index a53beee68f..bc0a22b996 100644
--- a/OsmAnd/src/net/osmand/plus/server/OsmAndHttpServer.java
+++ b/OsmAnd/src/net/osmand/plus/server/OsmAndHttpServer.java
@@ -25,8 +25,9 @@ public class OsmAndHttpServer extends NanoHTTPD{
private OsmandApplication application;
private MapActivity mapActivity;
- public OsmAndHttpServer() throws IOException {
+ public OsmAndHttpServer(OsmandApplication application) throws IOException {
super(HOSTNAME, PORT);
+ this.application = application;
start(NanoHTTPD.SOCKET_READ_TIMEOUT, false);
registerEndpoints();
}
@@ -46,7 +47,7 @@ public class OsmAndHttpServer extends NanoHTTPD{
public Response serve(IHTTPSession session) {
String uri = session.getUri();
if (uri.equals("/")) {
- return getStatic("/go.html");
+ return getStatic("/index.html");
}
if (isApiUrl(uri)) {
return routeApi(session);
diff --git a/OsmAnd/src/net/osmand/plus/server/ServerFragment.java b/OsmAnd/src/net/osmand/plus/server/ServerFragment.java
index 9c1f877c85..9544f9a78c 100644
--- a/OsmAnd/src/net/osmand/plus/server/ServerFragment.java
+++ b/OsmAnd/src/net/osmand/plus/server/ServerFragment.java
@@ -41,7 +41,7 @@ public class ServerFragment extends BaseOsmAndFragment {
@Override
public void onClick(View view) {
if (!initialized) {
- updateTextView(getString(R.string.click_button_to_stop_server));
+ updateTextView(getString(R.string.stop_web_server));
initServer();
}
}
@@ -49,7 +49,7 @@ public class ServerFragment extends BaseOsmAndFragment {
view.findViewById(R.id.server_stop_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- updateTextView(getString(R.string.click_button_to_start_server));
+ updateTextView(getString(R.string.start_web_server));
deInitServer();
}
});
@@ -86,8 +86,7 @@ public class ServerFragment extends BaseOsmAndFragment {
TrafficStats.setThreadStatsTag(THREAD_ID);
OsmAndHttpServer.HOSTNAME = getDeviceAddress();
try {
- server = new OsmAndHttpServer();
- server.setApplication((OsmandApplication) getMyApplication());
+ server = new OsmAndHttpServer(getMyApplication());
server.setActivity(this.getActivity());
initialized = true;
updateTextView("Server started at: http://" + getDeviceAddress() + ":" + OsmAndHttpServer.PORT);