Skip to content
Snippets Groups Projects
Commit 4992c225 authored by Xavier Gibert's avatar Xavier Gibert
Browse files

Clean TODOs

parent 77f83e4c
No related branches found
No related tags found
No related merge requests found
......@@ -214,80 +214,6 @@ public class MainActivity extends ActionBarActivity implements
setContentView(R.layout.activity_main);
//setProgressBarVisibility(true);
/* end of file server
server = new WebServer();
try {
server.start();
} catch(IOException ioe) {
Log.w("Httpd", "The server could not start.");
}
Log.w("Httpd", "Web server initialized.");
*/
// Setup a new instance
/*HttpServer server = new HttpServer();
server.addRequestHandler(new HttpRequestHandler() {
@Override
public HttpResponse handleRequest(HttpRequest request) {
String documentRoot = "www/orbit";
//String documentRootPath = null;
String uri = request.getUri();
InputStream iStream = null;
try {
uri = URLDecoder.decode(uri, "UTF-8");
} catch (UnsupportedEncodingException e1) {
uri = uri.replace("%20", " ");
}
if(uri.equals("/"))
uri = "/index.html";
try {
System.out.println("GET: "+documentRoot+uri);
iStream = getAssets().open(documentRoot+uri);
//File file = new File(iStream);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}*/
//File file = new File(documentRoot, uri);
/*if (file.exists() && !file.isDirectory()) {
try {
if (documentRootPath == null) {
documentRootPath = documentRoot.getAbsolutePath();
if (documentRootPath.endsWith("/") || documentRootPath.endsWith(".")) {
documentRootPath = documentRootPath.substring(0, documentRootPath.length() - 1);
}
}
String requestPath = file.getCanonicalPath();
if (requestPath.endsWith("/")) {
requestPath = requestPath.substring(0, requestPath.length() - 1);
}
if (!requestPath.startsWith(documentRootPath)) {
return new HttpResponse(HttpStatus.BAD_REQUEST, HttpStatus.BAD_REQUEST.toString());
}
} catch (IOException e) {
return new HttpResponse(HttpStatus.INTERNAL_SERVER_ERROR, HttpStatus.INTERNAL_SERVER_ERROR.toString());
}*/
/*try {
HttpResponse res = new HttpResponse(HttpStatus.OK, iStream);
res.setResponseLength(iStream.available());
return res;
} catch (IOException e) {
e.printStackTrace();
}
//}
return null;
}
});*/
// Bind it to port 8081
/*try {
server.bind(8080);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}*/
// Start the server thread
//server.start();
// find the retained fragment on activity restarts
FragmentManager fm = getFragmentManager();
dataFragment = (RetainedFragment) fm.findFragmentByTag("data");
......@@ -508,6 +434,9 @@ public class MainActivity extends ActionBarActivity implements
case 9:
mTitle = getString(R.string.title_section9);
break;
case 10:
mTitle = getString(R.string.title_section10);
break;
}
}
......@@ -790,64 +719,4 @@ public class MainActivity extends ActionBarActivity implements
public void setHudPanelOpen(boolean open){
hud_panel_open = open;
}
/*
private class WebServer extends NanoHTTPD {
public static final String MIME_JAVASCRIPT = "text/javascript";
public static final String MIME_CSS = "text/css";
public static final String MIME_JPEG = "image/jpeg";
public static final String MIME_PNG = "image/png";
public static final String MIME_SVG = "image/svg+xml";
public static final String MIME_JSON = "application/json";
public WebServer() {
super(8081);
}
@Override public Response serve(IHTTPSession session) {
String mime_type = NanoHTTPD.MIME_HTML;
Method method = session.getMethod();
String uri = session.getUri();
System.out.println(method + " '" + uri + "' ");
InputStream descriptor = null;
if(method.toString().equalsIgnoreCase("GET")){
String path;
if(uri.equals("/")){
path="/index.html";
}else{
path = uri;
try{
if(path.endsWith(".js")){
mime_type = MIME_JAVASCRIPT;
}else if(path.endsWith(".css")){
mime_type = MIME_CSS;
}else if(path.endsWith(".html")){
mime_type = MIME_HTML;
}else if(path.endsWith(".jpeg")){
mime_type = MIME_JPEG;
}else if(path.endsWith(".png")){
mime_type = MIME_PNG;
}else if(path.endsWith(".jpg")){
mime_type = MIME_JPEG;
}else if(path.endsWith(".svg")){
mime_type = MIME_SVG;
}else if(path.endsWith(".json")){
mime_type = MIME_JSON;
}
}catch(Exception e){
}
}
try {
// Open file from SD Card
descriptor = getAssets().open("www/attitude"+path);
} catch(IOException ioe) {
Log.w("Httpd", ioe.toString());
}
}
return new NanoHTTPD.Response( Response.Status.OK,mime_type,descriptor);
}
}*/
}
......@@ -29,7 +29,6 @@ import android.widget.Switch;
import android.widget.TextView;
import android.widget.TimePicker;
import android.widget.Toast;
import android.widget.ViewSwitcher;
import android.widget.CompoundButton.OnCheckedChangeListener;
/**
......@@ -71,7 +70,6 @@ public class MissionActivity extends Activity{
try {
utc = TimeScalesFactory.getUTC();
} catch (OrekitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
onBackPressed();
}
......
......@@ -203,10 +203,8 @@ public class Installer {
try {
mission.initial_date = new AbsoluteDate(2008,7,4,0,0,0.0,TimeScalesFactory.getUTC());
} catch (IllegalArgumentException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (OrekitException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
......@@ -240,10 +238,8 @@ public class Installer {
try {
mission.initial_date = new AbsoluteDate(2008,1,3,0,0,0.0,TimeScalesFactory.getUTC());
} catch (IllegalArgumentException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (OrekitException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment