Unpause when only one paused call

This commit is contained in:
Guillaume Beraudo 2011-11-30 12:20:40 +01:00
parent d87ac447d5
commit 4022cbe222
2 changed files with 15 additions and 3 deletions

View file

@ -273,6 +273,10 @@ public class IncallActivity extends AbstractCalleesActivity implements
lc().pauseCall(call);
} else {
((Checkable) v).setChecked(true);
List<LinphoneCall> pausedCalls = LinphoneUtils.getCallsInState(lc(), Arrays.asList(State.Paused));
if (pausedCalls.size() == 1) {
lc().resumeCall(pausedCalls.get(0));
}
}
break;
case R.id.conf_simple_video:

View file

@ -26,8 +26,11 @@ import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneCall;
@ -177,16 +180,21 @@ public final class LinphoneUtils {
return false;
}
public static final List<LinphoneCall> getRunningOrPausedCalls(LinphoneCore lc) {
public static final List<LinphoneCall> getCallsInState(LinphoneCore lc, Collection<State> states) {
List<LinphoneCall> foundCalls = new ArrayList<LinphoneCall>();
for (LinphoneCall call : getLinphoneCalls(lc)) {
State state = call.getState();
if (state == State.Paused || state == State.PausedByRemote || state == State.StreamsRunning) {
if (states.contains(call.getState())) {
foundCalls.add(call);
}
}
return foundCalls;
}
public static final List<LinphoneCall> getRunningOrPausedCalls(LinphoneCore lc) {
return getCallsInState(lc, Arrays.asList(
State.Paused,
State.PausedByRemote,
State.StreamsRunning));
}
public static final int countConferenceCalls(LinphoneCore lc) {
int count = lc.getConferenceSize();