Resolve java warnings in WebServerHelper.java

This commit is contained in:
Adeel Zafar 2019-08-02 03:26:02 +05:00
parent 3cf2cf7f31
commit f1438b17bd

View File

@ -32,7 +32,6 @@ public class WebServerHelper {
public static boolean isStarted; public static boolean isStarted;
private int port; private int port;
private static WebServer webServer; private static WebServer webServer;
private final int DEFAULT_PORT = 8080;
private CoordinatorLayout coordinatorLayout; private CoordinatorLayout coordinatorLayout;
public WebServerHelper(Context context) { public WebServerHelper(Context context) {
@ -119,6 +118,7 @@ public class WebServerHelper {
private int getPortFromEditText() { private int getPortFromEditText() {
String valueEditText = editTextPort.getText().toString(); String valueEditText = editTextPort.getText().toString();
int DEFAULT_PORT = 8080;
return (valueEditText.length() > 0) ? Integer.parseInt(valueEditText) : DEFAULT_PORT; return (valueEditText.length() > 0) ? Integer.parseInt(valueEditText) : DEFAULT_PORT;
} }
@ -159,14 +159,14 @@ public class WebServerHelper {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
ip += "Something Wrong! " + e.toString() + "\n"; ip += "Something Wrong! " + e.toString() + "\n";
}; }
Log.v("DANG", "Returning : " + "http://" + ip); Log.v("DANG", "Returning : " + "http://" + ip);
return "http://" + ip; return "http://" + ip;
} }
//Once server is started successfully, this dialog is shown. //Once server is started successfully, this dialog is shown.
public void serverStartedDialog() { void serverStartedDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(context, dialogStyle()); AlertDialog.Builder builder = new AlertDialog.Builder(context, dialogStyle());
builder.setPositiveButton(android.R.string.ok, (dialog, id) -> { builder.setPositiveButton(android.R.string.ok, (dialog, id) -> {