From e4b958414424432526a8069f6b6c701eb7f47ddc Mon Sep 17 00:00:00 2001 From: Alexandre Lision <alexandre.lision@savoirfairelinux.com> Date: Tue, 12 Nov 2013 10:36:51 -0500 Subject: [PATCH] added basic timeout before exiting call --- src/org/sflphone/client/CallActivity.java | 16 ++++++++++++---- src/org/sflphone/fragments/CallFragment.java | 9 +++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/org/sflphone/client/CallActivity.java b/src/org/sflphone/client/CallActivity.java index fd70dc37d..62abc3ed3 100644 --- a/src/org/sflphone/client/CallActivity.java +++ b/src/org/sflphone/client/CallActivity.java @@ -35,6 +35,8 @@ package org.sflphone.client; import java.util.ArrayList; import java.util.HashMap; +import java.util.Timer; +import java.util.TimerTask; import org.sflphone.R; import org.sflphone.fragments.CallFragment; @@ -353,10 +355,16 @@ public class CallActivity extends Activity implements CallInterface, IMFragment. public void terminateCall() { mHandler.removeCallbacks(mUpdateTimeTask); mCurrentCallFragment.getBubbleView().stopThread(); - // getFragmentManager().beginTransaction().remove(mCurrentCallFragment).commit(); - // mCurrentCallFragment = null; - finish(); - + TimerTask quit = new TimerTask() { + + @Override + public void run() { + finish(); + } + }; + + new Timer().schedule(quit, 2000); + } @Override diff --git a/src/org/sflphone/fragments/CallFragment.java b/src/org/sflphone/fragments/CallFragment.java index 5c982378e..f3f8fb214 100644 --- a/src/org/sflphone/fragments/CallFragment.java +++ b/src/org/sflphone/fragments/CallFragment.java @@ -388,7 +388,7 @@ public class CallFragment extends Fragment implements Callback { } public void changeCallState(String callID, String newState) { - Log.w(TAG, "Call :" + callID + " " + newState); + Log.i(TAG, "Call :" + callID + " " + newState); if (newState.contentEquals("FAILURE")) { try { mCallbacks.getService().hangUp(callID); @@ -396,6 +396,9 @@ public class CallFragment extends Fragment implements Callback { e.printStackTrace(); } } + if(conf == null){ + return; + } for (int i = 0; i < conf.getParticipants().size(); ++i) { if (callID.equals(conf.getParticipants().get(i).getCallId())) { if (newState.contentEquals("HUNGUP")) { @@ -417,6 +420,7 @@ public class CallFragment extends Fragment implements Callback { } if (conf.getParticipants().size() == 0) { + callStatusTxt.setText(newState); mCallbacks.terminateCall(); } } @@ -492,7 +496,8 @@ public class CallFragment extends Fragment implements Callback { public void updateTime() { long duration = System.currentTimeMillis() / 1000 - this.conf.getParticipants().get(0).getTimestamp_start(); - callStatusTxt.setText(String.format("%d:%02d:%02d", duration / 3600, duration % 3600 / 60, duration % 60)); + if(conf.isOnGoing()) + callStatusTxt.setText(String.format("%d:%02d:%02d", duration / 3600, duration % 3600 / 60, duration % 60)); } public Conference getConference() { -- GitLab