Reset button is now resetting graph and throughput texts
This commit is contained in:
parent
77fe316f14
commit
97798ababa
4 changed files with 31 additions and 9 deletions
4
.idea/libraries/GraphView_3_1_2.xml
generated
4
.idea/libraries/GraphView_3_1_2.xml
generated
|
|
@ -4,6 +4,8 @@
|
|||
<root url="jar://$PROJECT_DIR$/app/libs/GraphView-3.1.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/app/libs/GraphView-master.zip!/GraphView-master/src/main/java" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
|
|
@ -44,12 +44,13 @@ public class UeBehaviourSpeechCall extends UeBehaviour{
|
|||
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
|
||||
// Start Call
|
||||
log.debug("Calling phone");
|
||||
log.debug("Starting Call");
|
||||
CallUtil.startCall(phoneNumber);
|
||||
Thread.sleep(1000);
|
||||
|
||||
// Wait for call to start
|
||||
log.debug("Waiting for an answer");
|
||||
while(tm.getCallState() != TelephonyManager.CALL_STATE_OFFHOOK){
|
||||
while(tm.getCallState() == TelephonyManager.CALL_STATE_RINGING){
|
||||
if(super.stopExecution())
|
||||
return;
|
||||
super.setProgress(0.1f);
|
||||
|
|
@ -58,10 +59,11 @@ public class UeBehaviourSpeechCall extends UeBehaviour{
|
|||
|
||||
log.debug("Starting call timer");
|
||||
int elapsedTime = 0;
|
||||
while(elapsedTime < length){
|
||||
int lengthMillisec = length*1000;
|
||||
while(elapsedTime < lengthMillisec){
|
||||
if(super.stopExecution())
|
||||
return;
|
||||
super.setProgress((float)elapsedTime/length);
|
||||
super.setProgress((float)elapsedTime/lengthMillisec);
|
||||
Thread.sleep(SLEEP_PERIOD);
|
||||
elapsedTime += SLEEP_PERIOD;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,7 +168,10 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference
|
|||
return true;
|
||||
}
|
||||
else if (id == R.id.action_reset) {
|
||||
currentExecutor.reset();
|
||||
if(currentExecutor != null)
|
||||
currentExecutor.reset();
|
||||
if(statusFragment != null)
|
||||
statusFragment.reset();
|
||||
updateExecutionState();
|
||||
}
|
||||
else if (id == R.id.action_edit) {
|
||||
|
|
|
|||
|
|
@ -62,11 +62,12 @@ public class StatusFragment extends Fragment {
|
|||
rat_type = (TextView) view.findViewById(R.id.rat_type);
|
||||
|
||||
// Init the graph
|
||||
GraphViewData[] zeroPoint = new GraphViewData[]{new GraphViewData(0, 0)};
|
||||
if(downGraph == null)
|
||||
downGraph = new GraphViewSeries("Download Throughput", new GraphViewSeriesStyle(Color.GREEN, 3), zeroPoint);
|
||||
downGraph = new GraphViewSeries("Download Throughput", new GraphViewSeriesStyle(Color.GREEN, 3),
|
||||
new GraphViewData[]{new GraphViewData(0, 0)});
|
||||
if(upGraph == null)
|
||||
upGraph = new GraphViewSeries("Upload Throughput", new GraphViewSeriesStyle(Color.RED, 3), zeroPoint);
|
||||
upGraph = new GraphViewSeries("Upload Throughput", new GraphViewSeriesStyle(Color.RED, 3),
|
||||
new GraphViewData[]{new GraphViewData(0, 0)});
|
||||
|
||||
LineGraphView graphView = new LineGraphView(this.getActivity(), "GraphViewDemo");
|
||||
graphView.addSeries(downGraph);
|
||||
|
|
@ -130,6 +131,20 @@ public class StatusFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
public void reset(){
|
||||
if(downGraph != null)
|
||||
downGraph.resetData(new GraphViewData[]{new GraphViewData(0, 0)});
|
||||
if(upGraph != null)
|
||||
upGraph.resetData(new GraphViewData[]{new GraphViewData(0, 0)});
|
||||
x = 0;
|
||||
|
||||
down_speed.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
down_speed.setText(ThroughputCalculator.getBitThroughputString(0));
|
||||
up_speed.setText(ThroughputCalculator.getBitThroughputString(0));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue