Show merge button in conference more often.

This commit is contained in:
Guillaume Beraudo 2011-09-30 15:08:31 +02:00
parent 16d02ef317
commit 0db97c80ef

View file

@ -133,8 +133,7 @@ public class ConferenceActivity extends ListActivity implements
public void onResumeWhenManagerReady() { public void onResumeWhenManagerReady() {
registerLinphoneListener(true); registerLinphoneListener(true);
updateConfState(); updateConfState();
boolean showSimpleActions = lc().getConferenceSize() == 0 && lc().getCallsNb() == 2; updateMergeButtonState();
findViewById(R.id.conf_simple_merge).setVisibility(showSimpleActions ? VISIBLE : GONE);
} }
@Override @Override
@ -529,6 +528,13 @@ public class ConferenceActivity extends ListActivity implements
private Handler mHandler = new Handler(); private Handler mHandler = new Handler();
private void updateMergeButtonState() {
int callNb = lc().getCallsNb();
int confSize = lc().getConferenceSize();
if (lc().isInConference()) confSize--;
boolean showSimpleActions = callNb >= 2 && confSize != callNb;
findViewById(R.id.conf_simple_merge).setVisibility(showSimpleActions ? VISIBLE : GONE);
}
public void onCallStateChanged(final LinphoneCall call, final State state, public void onCallStateChanged(final LinphoneCall call, final State state,
final String message) { final String message) {
final String stateStr = call + " " + state.toString(); final String stateStr = call + " " + state.toString();
@ -537,8 +543,7 @@ public class ConferenceActivity extends ListActivity implements
public void run() { public void run() {
CalleeListAdapter adapter = (CalleeListAdapter) getListAdapter(); CalleeListAdapter adapter = (CalleeListAdapter) getListAdapter();
Log.d("ConferenceActivity applying state ",stateStr); Log.d("ConferenceActivity applying state ",stateStr);
boolean showSimpleActions = lc().getConferenceSize() == 0 && lc().getCallsNb() == 2; updateMergeButtonState();
findViewById(R.id.conf_simple_merge).setVisibility(showSimpleActions ? VISIBLE : GONE);
if (state == State.IncomingReceived || state == State.OutgoingRinging) { if (state == State.IncomingReceived || state == State.OutgoingRinging) {
if (!adapter.linphoneCalls.contains(call)) { if (!adapter.linphoneCalls.contains(call)) {
adapter.linphoneCalls.add(call); adapter.linphoneCalls.add(call);