small changes
This commit is contained in:
parent
cdde9f3960
commit
b4d4e79b6a
5 changed files with 13 additions and 13 deletions
|
@ -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"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/server_start_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/global_start"/>
|
||||
android:text="@string/shared_string_start"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/server_stop_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/global_stop"/>
|
||||
android:text="@string/shared_string_stop"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -11,10 +11,10 @@
|
|||
Thx - Hardy
|
||||
|
||||
-->
|
||||
<string name="global_start">Start</string>
|
||||
<string name="global_stop">Stop</string>
|
||||
<string name="click_button_to_start_server">Click button to start server</string>
|
||||
<string name="click_button_to_stop_server">Click second button to deactivate server</string>
|
||||
<string name="shared_string_stop">Stop</string>
|
||||
<string name="shared_string_start">Start</string>
|
||||
<string name="start_web_server">Start web server</string>
|
||||
<string name="stop_web_server">Stop web server</string>
|
||||
<string name="web_server">Web server</string>
|
||||
<string name="shared_string_redo">Redo</string>
|
||||
<string name="one_point_error">Please add at least two points.</string>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue