Commit a37dcbbb authored by Xavier's avatar Xavier

Clean before release v0.3.0

parent 8c0d1a54
......@@ -41,18 +41,6 @@ public class Installer {
}
return false;
}
/*
public static File getOrekitStorageDir() {
// Get the directory for the user's public pictures directory.
File file = new File(Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_DOWNLOADS), "OrekitData");
if (!file.mkdirs()) {
Log.e("Storage", "Directory not created");
}
return file;
}
*/
public static File getOrekitDataRoot(Activity activity){
return new File(activity.getExternalFilesDir(null)+File.separator+orekitDataPath);
......@@ -82,7 +70,6 @@ public class Installer {
}
}else{
Log.d("INSTALLER", "Cannot install Orekit data files, external storage not accessible");
//Toast.makeText(activity.getApplicationContext(), R.string.err_external_storage_not_accessible, Toast.LENGTH_LONG).show();
activity.showErrorDialog(activity.getString(R.string.error_installing_orekit_default_data_external_storage_not_accessible), true);
}
}else{
......@@ -170,7 +157,6 @@ public class Installer {
try {
values.put(MissionEntry.COLUMN_NAME_CLASS, SerializationUtil.serialize(mission));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
......@@ -197,7 +183,6 @@ public class Installer {
try {
values.put(MissionEntry.COLUMN_NAME_CLASS, SerializationUtil.serialize(mission));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
......
......@@ -14,41 +14,17 @@ public class OrekitInit {
final DataProvidersManager providers_manager = DataProvidersManager.getInstance();
providers_manager.clearProviders();
// try {
if (providers_manager.getProviders().size() == 0) {
/*
File orekit_data = new File(Donnee.getDonneeAdresse());
if (orekit_data.isDirectory()) {
DataProvider provider = new DirectoryCrawler(orekit_data);
providers_manager.addProvider(provider);
Log.d(TAG, "dataset: external provider found : "+orekit_data.getAbsolutePath());
}
else {
DataProvider classpath_provider = new ZipJarCrawler(orekit_data);
providers_manager.addProvider(classpath_provider);
Log.d(TAG, "dataset: embedded provider found");
}*/
DataProvider provider;
try {
provider = new DirectoryCrawler(root);
providers_manager.addProvider(provider);
} catch (OrekitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//Log.d(TAG, "dataset: provider found");
if (providers_manager.getProviders().size() == 0) {
DataProvider provider;
try {
provider = new DirectoryCrawler(root);
providers_manager.addProvider(provider);
} catch (OrekitException e) {
e.printStackTrace();
}
/*} catch (OrekitException e) {
e.printStackTrace();
}*/
}
}
}
......@@ -16,7 +16,6 @@ public class AboutActivity extends Activity {
super.onCreate(savedInstanceState);
setContentView(R.layout.about);
//setProgressBarVisibility(true);
TextView tx_package = (TextView) findViewById(R.id.TextViewVersionPackage);
TextView tx_license = (TextView) findViewById(R.id.TextViewProjectLicense);
......@@ -37,7 +36,6 @@ public class AboutActivity extends Activity {
tx_start_date.setText(Parameters.About.project_start_date);
tx_license.setText(Parameters.About.project_license);
//SimpleDateFormat sdf = new SimpleDateFormat("MMM dd,yyyy HH:mm");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
Date resultdate = new Date(getPackageManager().getPackageInfo(getPackageName(), 0).lastUpdateTime);
......@@ -54,7 +52,6 @@ public class AboutActivity extends Activity {
tx_version_loader.setText(Parameters.About.version_loader);
} catch (NameNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
......@@ -62,7 +59,6 @@ public class AboutActivity extends Activity {
@Override
public void onDestroy() {
super.onDestroy();
// store the data in the fragment
}
......
......@@ -9,7 +9,6 @@ import org.xwalk.core.XWalkView;
import com.commonsware.cwac.loaderex.SQLiteCursorLoader;
import database.MissionReaderDbHelper;
import dialogs.DeleteMissionDialogFragment;
import dialogs.ErrorDialogFragment;
import dialogs.ResetAppDialogFragment;
import dialogs.ResetDbDialogFragment;
......@@ -26,18 +25,12 @@ import fragments.SimulatorFragment;
import fragments.TestFragment;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.app.AlarmManager;
import android.app.DialogFragment;
import android.app.FragmentManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.support.v4.widget.DrawerLayout;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
......@@ -71,6 +64,7 @@ public class MainActivity extends ActionBarActivity implements
public XWalkView mXwalkView;
public MissionReaderDbHelper db_help;
public SQLiteCursorLoader loader = null;
public SQLiteDatabase db;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -82,6 +76,7 @@ public class MainActivity extends ActionBarActivity implements
OrekitInit.init(Installer.getOrekitDataRoot(this));
db_help = Installer.installApkDatabase(this);
db = db_help.getWritableDatabase();
requestWindowFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.activity_main);
......
......@@ -6,8 +6,6 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import mission.Mission;
import org.orekit.propagation.SpacecraftState;
/**
* A simple class with generic serialize and deserialize method implementations
......
......@@ -51,7 +51,6 @@ public class DeleteMissionDialogFragment extends DialogFragment {
}
private void deleteMission(int mission_id) {
// TODO Auto-generated method stub
MainActivity act = ((MainActivity)getActivity());
//XGGDEBUG:solve, this query is not well formed
act.loader.delete(MissionEntry.TABLE_NAME, MissionEntry._ID+"="+mission_id, null);
......
......@@ -2,7 +2,6 @@ package dialogs;
import cs.si.satatt.MainActivity;
import cs.si.satatt.R;
import database.MissionReaderContract.MissionEntry;
import android.app.AlarmManager;
import android.app.AlertDialog;
import android.app.Dialog;
......
......@@ -49,7 +49,7 @@ public class ResetDbDialogFragment extends DialogFragment {
}
private void resetDb() {
//Delete database
((MainActivity)getActivity()).db_help.getWritableDatabase().delete(MissionEntry.TABLE_NAME, "1", null);
((MainActivity)getActivity()).db.delete(MissionEntry.TABLE_NAME, "1", null);
//((MainActivity)getActivity()).loader.execSQL("delete * from "+ MissionEntry.TABLE_NAME, null);
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getActivity().getBaseContext());
preferences.edit().putBoolean(getString(R.string.pref_key_database_installed), false).commit();
......
......@@ -125,7 +125,6 @@ public final class HudFragment extends Fragment {
browserLayout.addView(browser);
//browser.loadUrl(Parameters.Web.STARTING_PAGE);
browser.load(Parameters.Web.STARTING_PAGE,null);
views_menu = (Button) rootView.findViewById(R.id.buttonMissionNew);
......@@ -169,21 +168,6 @@ public final class HudFragment extends Fragment {
fps.setAlpha((float)1.0);
}
//private boolean first = true;
/* public void onItemSelected(AdapterView<?> parent, View view,
int pos, long id) {
// An item was selected. You can retrieve the selected item using
String sel_view = (String) parent.getItemAtPosition(pos);
if(!first)
//browser.loadUrl("javascript:changeView('"+sel_view+"')");
browser.load("javascript:changeView('"+sel_view+"')", null);
first=false;
}
public void onNothingSelected(AdapterView<?> parent) {
// Another interface callback
}*/
private void showPopup(View v) {
PopupMenu popup = new PopupMenu(getActivity(), v);
......
......@@ -12,9 +12,7 @@ import android.support.v4.widget.DrawerLayout;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.Menu;
......@@ -28,7 +26,6 @@ import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
/**
* Fragment used for managing interactions for and presentation of a navigation drawer.
......@@ -108,17 +105,6 @@ public class NavigationDrawerFragment extends Fragment {
mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//XGGDEBUG
//First update the previously selected item if one has been set
/*if(selectedListItem!=null){
TextView previousTitle = (TextView) selectedListItem.findViewById(R.id.nav_item_text);
previousTitle.setBackgroundResource(R.drawable.navigation_section);
}
//Then update the new one
TextView title = (TextView) view.findViewById(R.id.nav_item_text);
title.setBackgroundResource(R.drawable.navigation_selector);
selectedListItem = view;
*/
selectItem(position);
}
});
......@@ -295,17 +281,7 @@ public class NavigationDrawerFragment extends Fragment {
public void select(int position){
selectItem(position);
//setCorrectBackgrounds();
}
/*private void setCorrectBackgrounds(){
for(int i=0; i<mDrawerListView.getChildCount(); i++){
if(mCurrentSelectedPosition==i)
((TextView)mDrawerListView.getChildAt(i)).setBackgroundResource(R.drawable.navigation_selector);
else
((TextView)mDrawerListView.getChildAt(i)).setBackgroundResource(R.drawable.navigation_section);
}
}*/
private void selectItem(int position) {
mCurrentSelectedPosition = position;
......
package fragments;
import java.util.ArrayList;
import java.util.List;
import mission.Mission;
import simulator.Simulator;
import simulator.SimulatorStatus;
......@@ -19,12 +16,9 @@ import android.app.LoaderManager.LoaderCallbacks;
import android.os.Bundle;
import android.app.Fragment;
import android.content.Context;
import android.content.CursorLoader;
import android.content.Loader;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.widget.CursorAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
......@@ -35,7 +29,6 @@ import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.Switch;
......@@ -89,13 +82,9 @@ public final class SimulatorFragment extends Fragment implements LoaderCallbacks
View rootView = inflater.inflate(R.layout.sim, container,
false);
//sharedPref = PreferenceManager.getDefaultSharedPreferences(container.getContext());
sharedPref = this.getActivity().getSharedPreferences("cs.si.satatt", Context.MODE_PRIVATE);
//simulator = (Simulator) getArguments().getSerializable(ARG_SIM_OBJ);
simulator = ((MainActivity)getActivity()).getSimulator();
//simulator.setHudView(null);
//Load missions in list
missionsList = (ListView) rootView.findViewById(R.id.listView1);
......@@ -124,17 +113,14 @@ public final class SimulatorFragment extends Fragment implements LoaderCallbacks
missionsList.setAdapter(adapter);
registerForContextMenu(missionsList);
//getLoaderManager().initLoader(0, null, this);
getLoaderManager().initLoader(R.id.listView1, null, this);
//
//Switch local/remote
switch_remote = (Switch) rootView.findViewById(R.id.switch1);
sim_container = (ViewSwitcher) rootView.findViewById(R.id.sim_content);
loadCorrectSimulatorScreen(rootView);
switch_remote.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// Do Something
sharedPref.edit().putBoolean(buttonView.getContext().getString(R.string.pref_key_sim_global_remote), isChecked).commit();
loadCorrectSimulatorScreen(buttonView);
}
......@@ -148,7 +134,6 @@ public final class SimulatorFragment extends Fragment implements LoaderCallbacks
simulator.setSwitchSelector(switch_remote);
button_connect.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform action on click
if(simulator.getSimulatorStatus().equals(SimulatorStatus.Connected)){
simulator.disconnect();
selectFirstMissionInList();
......@@ -171,8 +156,7 @@ public final class SimulatorFragment extends Fragment implements LoaderCallbacks
MissionEntry.COLUMN_NAME_CLASS
};
//XGGDEBUG: put db in activity to not load it always.
Cursor c = ((MainActivity)getActivity()).db_help.getWritableDatabase()
Cursor c = ((MainActivity)getActivity()).db
.query(
MissionEntry.TABLE_NAME, // The table to query
projection, // The columns to return
......@@ -208,7 +192,6 @@ public final class SimulatorFragment extends Fragment implements LoaderCallbacks
button_delete.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
if(activeMissionId==-1){
Toast.makeText(getActivity().getApplicationContext(), getString(R.string.sim_local_select_first_a_mission), Toast.LENGTH_LONG).show();
}else if (activeMissionId==0 ||activeMissionId==1 ||activeMissionId==2 ){
......@@ -244,45 +227,8 @@ public final class SimulatorFragment extends Fragment implements LoaderCallbacks
}
}
}
/*private void loadMissionList() {
SQLiteDatabase db = ((MainActivity)getActivity()).db;
// Define a projection that specifies which columns from the database
// you will actually use after this query.
String[] projection = {
MissionEntry._ID,
MissionEntry.COLUMN_NAME_NAME,
MissionEntry.COLUMN_NAME_DESCRIPTION,
};
// How you want the results sorted in the resulting Cursor
String sortOrder =
MissionEntry.COLUMN_NAME_NAME + " ASC";
Cursor c = db.query(
MissionEntry.TABLE_NAME, // The table to query
projection, // The columns to return
"", // The columns for the WHERE clause
null, // The values for the WHERE clause
"", // don't group the rows
"", // don't filter by row groups
sortOrder // The sort order
);
c.moveToFirst();
ListAdapter adapter=new SimpleCursorAdapter(this.getActivity().getApplicationContext(),
R.layout.mission_list_item, c,
new String[] {"_id", "name", "description"},
new int[] {R.id.textViewMissionId, R.id.textViewMission, R.id.textViewMissionDescription}, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER );
missionsList.setAdapter(adapter);
}*/
private void loadCorrectSimulatorScreen(View view) {
// TODO Auto-generated method stub
boolean remote = sharedPref.getBoolean(view.getContext().getString(R.string.pref_key_sim_global_remote), false);
switch_remote.setChecked(remote);
if(remote){
......@@ -291,7 +237,6 @@ public final class SimulatorFragment extends Fragment implements LoaderCallbacks
}else{
// Local
sim_container.setDisplayedChild(0);
//((MainActivity)getActivity()).loader.reset();
missionsList.post(new Runnable() {
@Override
public void run() {
......@@ -343,12 +288,6 @@ public final class SimulatorFragment extends Fragment implements LoaderCallbacks
if (cursor != null && cursor.getCount() > 0) {
cursor.moveToFirst();
//int idIndex = cursor.getColumnIndex(MissionEntry._ID);
//int nameIndex = cursor.getColumnIndex(MissionEntry.COLUMN_NAME_NAME);
//this.itemId = cursor.getLong(idIndex);
//String name = cursor.getString(nameIndex);
//((EditText)findViewById(R.id.textViewMission)).setText(name);
//((EditText)findViewById(R.id.person)).setText(borrower);
missionsList.post(new Runnable() {
@Override
......
......@@ -66,7 +66,6 @@ public final class TestFragment extends Fragment {
public void onClick(View v) {
// button 1 was clicked!
browser.load(Parameters.Web.TEST_PAGE_2,null);
//browser.loadUrl(Parameters.Web.TEST_PAGE_2);
}
});
Button button3 = ((Button) rootView.findViewById(R.id.buttonTest3));
......@@ -74,14 +73,10 @@ public final class TestFragment extends Fragment {
@Override
public void onClick(View v) {
// button 1 was clicked!
//browser.loadUrl(Parameters.Web.TEST_PAGE_3);
browser.load(Parameters.Web.TEST_PAGE_3,null);
}
});
//XWalkView browser = (XWalkView) rootView.findViewById(R.id.xbrowser);
browser = new XWalkView(this.getActivity().getApplicationContext(), this.getActivity());
XWalkSettings browserSettings = browser.getSettings();
......@@ -97,43 +92,13 @@ public final class TestFragment extends Fragment {
browser.clearCache(true);
/*browser.setXWalkWebChromeClient(new org.xwalk.core.client.XWalkDefaultWebChromeClient(rootView.getContext(), browser) {
public void onProgressChanged(XWalkView view, int progress) {
// Activities and WebViews measure progress with different scales.
// The progress meter will automatically disappear when we reach 100%
try{
getActivity().setProgress(progress * 100);
}catch(NullPointerException nulle){
}
}
});
browser.setXWalkClient(new org.xwalk.core.client.XWalkDefaultClient(rootView.getContext(), browser) {
public void onReceivedError(XWalkView view, int errorCode, String description, String failingUrl) {
Toast.makeText(getActivity(), "Oh no! " + description, Toast.LENGTH_LONG).show();
}
});*/
/*
browser.addJavascriptInterface(new webclient.UAJscriptHandler(null), "unlockingandroid");
browser.addJavascriptInterface(new UANOOP() {}, "unlockingandroid");
browser.addJavascriptInterface(null, "unlockingandroid");
*/
//browser.addJavascriptInterface(new WebAppInterface(getActivity(), sim), "Android");
LinearLayout browserLayout=(LinearLayout)rootView.findViewById(R.id.simLayout);
browserLayout.addView(browser);
//browser.loadUrl(Parameters.Web.TEST_PAGE_1);
browser.load(Parameters.Web.TEST_PAGE_1,"");
/*TextView textView = (TextView) rootView
.findViewById(R.id.section_label);
textView.setText(Integer.toString(getArguments().getInt(
ARG_SECTION_NUMBER)));*/
return rootView;
}
/*private class UANOOP {
}*/
@Override
public void onAttach(Activity activity) {
......
......@@ -7,6 +7,11 @@ import mission.Orbit;
import org.orekit.time.AbsoluteDate;
public class Mission implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1987145766082906026L;
public String name = "CustomMission";
public String description = "Mission description";
//public String initial_stage = "First Stage";
......
......@@ -8,6 +8,11 @@ import java.io.Serializable;
*
*/
public class Orbit implements Serializable{
/**
*
*/
private static final long serialVersionUID = -5454548599446807545L;
public double mu = 3.986004415e+14;
/**
* Semi major axis in meters
......
......@@ -32,7 +32,6 @@ public class ModelSimulation {
private boolean isBrowserLoaded;
public ModelSimulation(MainActivity acv){
//OrekitInit.init(Installer.getOrekitDataRoot(acv));
isBrowserLoaded = false;
activity=acv;
config = new ModelConfiguration(activity.getApplicationContext());
......@@ -49,7 +48,6 @@ public class ModelSimulation {
utc = TimeScalesFactory.getUTC();
}
} catch (OrekitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
activity.showErrorDialog(activity.getString(R.string.error_initializing_orekit), false);
}
......@@ -86,8 +84,6 @@ public class ModelSimulation {
public void pushSimulationModel(){
if(browser!=null && state!=null && isBrowserLoaded){
//browser.loadUrl("javascript:updateModelState('"+gson.toJson(state)+"')");
//Log.d("QUATERNION", state.value_attitude.w+","+state.value_attitude.x+","+state.value_attitude.y+","+state.value_attitude.z);
browser.load("javascript:updateModelState('"+gson.toJson(state)+"')",null);
}
}
......@@ -101,7 +97,6 @@ public class ModelSimulation {
private TimeScale utc;
private Frame sunFrame;
public void updateSimulation(SpacecraftState scs, int sim_progress){
//Log.d("Sim",System.currentTimeMillis()+": "+"pre update 1");
ModelState new_state = new ModelState();
ModelInfo new_info = new ModelInfo();
......@@ -132,7 +127,6 @@ public class ModelSimulation {
new_state.value_sun[1] = sun.getY()/1000;
new_state.value_sun[2] = sun.getZ()/1000;
} catch (OrekitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
activity.showErrorDialog(activity.getString(R.string.error_computing_orekit), false);
}
......@@ -172,7 +166,6 @@ public class ModelSimulation {
updateState(new_state);
updateInfo(new_info);
//Log.d("Sim",System.currentTimeMillis()+": "+"post update 1");
}
public synchronized void updateHUD(){
if(panel_time != null)
......@@ -217,7 +210,6 @@ public class ModelSimulation {
TextView panel_yaw;
private void initViews() {
// TODO Auto-generated method stub
if(view != null){
panel_time = (TextView)view.findViewById(R.id.textViewPanelTime);
panel_progress = (ProgressBar)view.findViewById(R.id.progressBarPanelProgress);
......@@ -230,6 +222,5 @@ public class ModelSimulation {
panel_yaw = (TextView)view.findViewById(R.id.textViewPanelYaw);
}
}
}
......@@ -82,11 +82,9 @@ public class Simulator {
public SimulatorStatus connect(){
if(simulatorStatus.equals(SimulatorStatus.Disconnected)){
//Log.d("Sim",System.currentTimeMillis()+": "+"simulator connecting thread");
simulationStatus = SimulationStatus.Pause;
playCondition = new ConditionVariable(false);
connectThread();
//Log.d("Sim",System.currentTimeMillis()+": "+"simulator has connected thread");
}
return simulatorStatus;
}
......@@ -145,7 +143,6 @@ public class Simulator {
}
private void connectThread() {
//Log.d("Sim",System.currentTimeMillis()+": "+"simulator connecting thread interior");
if(buttonConnect!=null){
activity.runOnUiThread( new Runnable() {
public void run() {
......@@ -171,11 +168,8 @@ public class Simulator {
setProgress(30 * 100);
simulation = new ModelSimulation((MainActivity)activity);
setProgress(40 * 100);
//Log.d("Sim",System.currentTimeMillis()+": "+"simulator pre preinitialize");
simulation.preInitialize();
//Log.d("Sim",System.currentTimeMillis()+": "+"simulator post preinitialize");
thread = (SocketsThread) new SocketsThread(this,host,port).execute(simulation);
//Log.d("Sim",System.currentTimeMillis()+": "+"end executing thread ");
}catch(NumberFormatException nfe){
setSimulatorStatus(SimulatorStatus.Disconnected);
}
......@@ -194,18 +188,12 @@ public class Simulator {
boolean remote = sharedPref.getBoolean(context.getString(R.string.pref_key_sim_global_remote), false);
if(remote){
// Remote
//thread.setDisconnected();
//thread.cancel(true);
thread.closeSocket();
//cancel=true;
}else{
// Local
//sthread.setDisconnected();
cancel=true;
playCondition.open();
//sthread.cancel(false);
}
}
private void resumeThread() {
......@@ -216,7 +204,6 @@ public class Simulator {
}
}
private void pauseThread() {
// TODO Auto-generated method stub
boolean remote = sharedPref.getBoolean(context.getString(R.string.pref_key_sim_global_remote), false);
if(remote){
}else{
......@@ -262,7 +249,6 @@ public class Simulator {
private String message = "";
public void showMessage(String string) {
message = string;
// TODO Auto-generated method stub
activity.runOnUiThread( new Runnable() {
public void run() {
Toast.makeText(context, message,
......@@ -271,7 +257,6 @@ public class Simulator {
});
}
public void goToHud() {
// TODO Auto-generated method stub
((MainActivity)activity).showSection(1);
}
......
......@@ -33,15 +33,12 @@ public class SimulatorThread extends AsyncTask<ModelSimulation, Void, Boolean>{
protected Boolean doInBackground(ModelSimulation... params) {
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
if(simulator.getSimulatorStatus().equals(SimulatorStatus.Disconnected)){
//Log.d("Sim",System.currentTimeMillis()+": "+"simulator connecting socket");
try {
setSimulationParameters();
setConnected();
simulator.goToHud();
simulator.showMessage(simulator.getContext().getString(R.string.sim_local_simulator_connected));
//Log.d("Sim",System.currentTimeMillis()+": "+"socket openend");
} catch (OrekitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
simulator.showMessage(simulator.getContext().getString(R.string.sim_orekit_init_error)+": "+e.getMessage());
setDisconnected();
......@@ -61,7 +58,6 @@ public class SimulatorThread extends AsyncTask<ModelSimulation, Void, Boolean>{
break;
}
//TODO Propagate
long dur = (System.nanoTime()-time_tmp_data);
if(dur<(Parameters.Simulator.min_hud_model_refreshing_interval_ns-Parameters.Simulator.model_refreshing_interval_safe_guard_ns)){
try {
......@@ -70,15 +66,12 @@ public class SimulatorThread extends AsyncTask<ModelSimulation, Void, Boolean>{
Thread.sleep(sleep_dur);
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else{
//Log.d("SimLocal", "Simulation step longer than available time: "+dur);
try {
Thread.sleep(Parameters.Simulator.model_refreshing_interval_safe_guard_ns/1000000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
......@@ -103,7 +96,6 @@ public class SimulatorThread extends AsyncTask<ModelSimulation, Void, Boolean>{
Thread.yield();
}
} catch (OrekitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
simulator.showMessage(simulator.getContext().getString(R.string.sim_orekit_prop_error)+": "+e.getMessage());
}
......@@ -223,7 +215,6 @@ public class SimulatorThread extends AsyncTask<ModelSimulation, Void, Boolean>{
return currentState;
}else{
return null;
//TODO stop simulator
}
}
......
......@@ -12,9 +12,6 @@ import android.widget.Toast;
//import org.chromium.content.browser.JavascriptInterface;
import org.xwalk.core.JavascriptInterface;
//XGGDEBUG:TEST-WAITING use ( org.xwalk.core.JavascriptInterface ) when the code is merged in: https://github.com/crosswalk-project/crosswalk/pull/1876/files
//import android.webkit.JavascriptInterface; Used for WebView not XWalkView
public class WebAppInterface {
Activity activity;
private ModelSimulation sim;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment