diff --git a/app/src/main/java/org/kiwix/kiwixmobile/webserver/WebServerHelper.java b/app/src/main/java/org/kiwix/kiwixmobile/webserver/WebServerHelper.java index cd044d1f3..9dae6ce33 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/webserver/WebServerHelper.java +++ b/app/src/main/java/org/kiwix/kiwixmobile/webserver/WebServerHelper.java @@ -2,6 +2,8 @@ package org.kiwix.kiwixmobile.webserver; import android.content.Context; import android.content.DialogInterface; +import android.os.Build; +import android.os.Handler; import android.text.InputFilter; import android.text.InputType; import android.util.Log; @@ -17,6 +19,8 @@ import java.net.SocketException; import java.util.Enumeration; import org.kiwix.kiwixmobile.R; +import static org.kiwix.kiwixmobile.utils.StyleUtils.dialogStyle; + public class WebServerHelper { private Context context; private TextView textViewIpAccess; @@ -63,7 +67,7 @@ public class WebServerHelper { public void onClick(DialogInterface dialog, int whichButton) { if (!isStarted && startAndroidWebServer()) { isStarted = true; - editTextPort.setEnabled(false); + serverStartedDialog(); } } }); @@ -145,4 +149,18 @@ public class WebServerHelper { Log.v("DANG", "Returning : " + "http://" + ip); return "http://" + ip; } + + public void serverStartedDialog() { + + AlertDialog.Builder builder = new AlertDialog.Builder(context, dialogStyle()); + WebServerHelper webServerHelper = new WebServerHelper(context); + builder.setPositiveButton(android.R.string.ok, (dialog, id) -> { + + }); + builder.setTitle(context.getString(R.string.server_started_title)); + builder.setMessage( + context.getString(R.string.server_started_message) + "\n " + getIpAddress() + ":" + port); + AlertDialog dialog = builder.create(); + dialog.show(); + } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 38945bcc8..dd7894bf8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -35,6 +35,8 @@ You\'re about to turn on your wifi hotspot. This feature can work without data usage. Do you want to disable your data? http://000.000.000.000 + Server started + Enter this ip address into your browser to access the server Error: The selected ZIM file could not be found. Error: The selected file is not a valid ZIM file. Error: Loading article (Url: %1$s) failed.