Fixed landscape mode in status screen

This commit is contained in:
Ziver Koc 2014-08-07 16:34:57 +02:00
parent ffe6425906
commit 67b468e082
2 changed files with 16 additions and 10 deletions

View file

@ -70,7 +70,6 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference
if(currentExecutor == null) { if(currentExecutor == null) {
log.info("Creating new instance of executor"); log.info("Creating new instance of executor");
currentExecutor = new UeControlExecutor(); currentExecutor = new UeControlExecutor();
currentExecutor.setThroughputListener(statusFragment.getThroughputListener());
File input = new File(this.getFilesDir(), BEHAVIOUR_SAVE_FILE); File input = new File(this.getFilesDir(), BEHAVIOUR_SAVE_FILE);
if (input.exists()) { if (input.exists()) {
try { try {
@ -87,8 +86,11 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference
currentExecutor.addBehaviour(new UeBehaviourSleep(4000)); currentExecutor.addBehaviour(new UeBehaviourSleep(4000));
} }
} }
else else {
log.info("Using existing executor"); log.info("Using existing executor");
}
currentExecutor.setThroughputListener(statusFragment.getThroughputListener());
updateExecutionState(); updateExecutionState();
} }

View file

@ -40,10 +40,11 @@ public class StatusFragment extends Fragment {
private ImageView up_img; private ImageView up_img;
private TextView up_speed; private TextView up_speed;
private TextView rat_type; private TextView rat_type;
private GraphViewSeries downGraph;
private GraphViewSeries upGraph;
private int x = 0; private static GraphViewSeries downGraph;
private static GraphViewSeries upGraph;
private static int x = 0;
private Handler handler; private Handler handler;
@Override @Override
@ -62,8 +63,10 @@ public class StatusFragment extends Fragment {
// Init the graph // Init the graph
GraphViewData[] zeroPoint = new GraphViewData[]{new GraphViewData(0, 0)}; GraphViewData[] zeroPoint = new GraphViewData[]{new GraphViewData(0, 0)};
downGraph = new GraphViewSeries("Download Throughput", new GraphViewSeriesStyle(Color.GREEN, 3), zeroPoint); if(downGraph == null)
upGraph = new GraphViewSeries("Upload Throughput" , new GraphViewSeriesStyle(Color.RED , 3), zeroPoint); downGraph = new GraphViewSeries("Download Throughput", new GraphViewSeriesStyle(Color.GREEN, 3), zeroPoint);
if(upGraph == null)
upGraph = new GraphViewSeries("Upload Throughput", new GraphViewSeriesStyle(Color.RED, 3), zeroPoint);
LineGraphView graphView = new LineGraphView(this.getActivity(), "GraphViewDemo"); LineGraphView graphView = new LineGraphView(this.getActivity(), "GraphViewDemo");
graphView.addSeries(downGraph); graphView.addSeries(downGraph);
@ -102,6 +105,9 @@ public class StatusFragment extends Fragment {
}); });
} }
}; };
public UeControlExecutor.ThroughputListener getThroughputListener(){
return throughputListener;
}
private void startActivityTimer(){ private void startActivityTimer(){
// Set active images // Set active images
@ -124,8 +130,6 @@ public class StatusFragment extends Fragment {
} }
} }
public UeControlExecutor.ThroughputListener getThroughputListener(){
return throughputListener;
}
} }