From 67b468e082ac8a257ad8e87f15459bea715c3fc4 Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Thu, 7 Aug 2014 16:34:57 +0200 Subject: [PATCH] Fixed landscape mode in status screen --- .../ericsson/uecontrol/gui/MainActivity.java | 6 ++++-- .../gui/fragments/StatusFragment.java | 20 +++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/ericsson/uecontrol/gui/MainActivity.java b/app/src/main/java/com/ericsson/uecontrol/gui/MainActivity.java index 6244795..486cff6 100755 --- a/app/src/main/java/com/ericsson/uecontrol/gui/MainActivity.java +++ b/app/src/main/java/com/ericsson/uecontrol/gui/MainActivity.java @@ -70,7 +70,6 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference if(currentExecutor == null) { log.info("Creating new instance of executor"); currentExecutor = new UeControlExecutor(); - currentExecutor.setThroughputListener(statusFragment.getThroughputListener()); File input = new File(this.getFilesDir(), BEHAVIOUR_SAVE_FILE); if (input.exists()) { try { @@ -87,8 +86,11 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference currentExecutor.addBehaviour(new UeBehaviourSleep(4000)); } } - else + else { log.info("Using existing executor"); + } + + currentExecutor.setThroughputListener(statusFragment.getThroughputListener()); updateExecutionState(); } diff --git a/app/src/main/java/com/ericsson/uecontrol/gui/fragments/StatusFragment.java b/app/src/main/java/com/ericsson/uecontrol/gui/fragments/StatusFragment.java index 553d720..4ae8851 100755 --- a/app/src/main/java/com/ericsson/uecontrol/gui/fragments/StatusFragment.java +++ b/app/src/main/java/com/ericsson/uecontrol/gui/fragments/StatusFragment.java @@ -40,10 +40,11 @@ public class StatusFragment extends Fragment { private ImageView up_img; private TextView up_speed; 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; @Override @@ -62,8 +63,10 @@ public class StatusFragment extends Fragment { // Init the graph GraphViewData[] zeroPoint = new GraphViewData[]{new GraphViewData(0, 0)}; - downGraph = new GraphViewSeries("Download Throughput", new GraphViewSeriesStyle(Color.GREEN, 3), zeroPoint); - upGraph = new GraphViewSeries("Upload Throughput" , new GraphViewSeriesStyle(Color.RED , 3), zeroPoint); + if(downGraph == null) + 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"); graphView.addSeries(downGraph); @@ -102,6 +105,9 @@ public class StatusFragment extends Fragment { }); } }; + public UeControlExecutor.ThroughputListener getThroughputListener(){ + return throughputListener; + } private void startActivityTimer(){ // Set active images @@ -124,8 +130,6 @@ public class StatusFragment extends Fragment { } } - public UeControlExecutor.ThroughputListener getThroughputListener(){ - return throughputListener; - } + } \ No newline at end of file