Added fullscreen graph for landscape mode.

[artf472308]
This commit is contained in:
Ziver Koc 2015-01-15 17:44:31 +01:00
parent 55f983c773
commit 05417b10d0
10 changed files with 79 additions and 23 deletions

View file

@ -40,13 +40,14 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference
public static final String BEHAVIOUR_SAVE_FILE = "behaviour_list.json";
/** Fragments **/
/* Fragments */
private StatusFragment statusFragment;
private BehaviourListFragment behaviourListFragment;
private MenuItem action_execute;
private MenuItem action_mark;
private boolean backButtonPressed = false;
/* Static Data */
private static UeControlExecutor currentExecutor;
private static CSVWriter csvLogger;
private static int uid;
@ -68,14 +69,6 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference
// Setup Debugging
setupDebugLogging();
// Setup Main GUI
setContentView(R.layout.activity_main);
statusFragment = (StatusFragment)
getFragmentManager().findFragmentById(R.id.status_fragment);
behaviourListFragment = new BehaviourListFragment();
getFragmentManager().beginTransaction()
.replace(R.id.container, behaviourListFragment).commit();
// Setup Executor
if(currentExecutor == null) {
log.info("Creating new instance of executor");
@ -101,8 +94,16 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference
log.info("Using existing executor");
}
currentExecutor.setThroughputListener(statusFragment.getThroughputListener());
// Setup Main GUI
setContentView(R.layout.activity_main);
statusFragment = (StatusFragment)
getFragmentManager().findFragmentById(R.id.status_fragment);
behaviourListFragment = (BehaviourListFragment)
getFragmentManager().findFragmentById(R.id.behaviour_list_fragment);
currentExecutor.setThroughputListener(statusFragment.getThroughputListener());
updateExecutionState();
}
@ -225,7 +226,8 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference
try {
if(tag.equals("import")) {
currentExecutor.read(file.getAbsolutePath());
behaviourListFragment.onResume();
if(behaviourListFragment != null)
behaviourListFragment.onResume();
}
else if(tag.equals("export")) {
currentExecutor.save(file.getAbsolutePath());

View file

@ -61,8 +61,10 @@ public class BehaviourListFragment extends Fragment {
@Override
public void onResume() {
adapter.generateIds();
adapter.notifyDataSetChanged();
if(adapter != null) {
adapter.generateIds();
adapter.notifyDataSetChanged();
}
super.onResume();
}

View file

@ -65,12 +65,14 @@ public class StatusFragment extends Fragment {
LineGraphView graphView = new LineGraphView(this.getActivity(), "GraphView");
graphView.addSeries(downGraph);
graphView.addSeries(upGraph);
//graphView.setDrawDataPoints(true);
graphView.setViewPort(0, 120);
graphView.setScrollable(true);
graphView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
graphView.getGraphViewStyle().setGridStyle(GraphViewStyle.GridStyle.BOTH);
graphView.setShowVerticalLabels(false);
//graphView.setDrawDataPoints(true);
graphView.setViewPort(0, 120);
graphView.setScrollable(true);
graphView.setDisableTouch(true);
graphView.scrollToEnd();
LinearLayout layout = (LinearLayout) view.findViewById(R.id.graph);
layout.addView(graphView);