Plug mic and speaker toggle buttons in conferencing activity.

This commit is contained in:
Guillaume Beraudo 2011-09-27 12:02:01 +02:00
parent ebe078c70e
commit da73120458

View file

@ -51,6 +51,7 @@ import android.widget.BaseAdapter;
import android.widget.ListAdapter; import android.widget.ListAdapter;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import android.widget.ToggleButton;
/** /**
* @author Guillaume Beraudo * @author Guillaume Beraudo
@ -94,6 +95,12 @@ public class ConferenceActivity extends ListActivity implements
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
} }
private void pauseCurrentCallOrLeaveConference() {
LinphoneCall call = lc().getCurrentCall();
if (call != null) lc().pauseCall(call);
lc().leaveConference();
}
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.conferencing); setContentView(R.layout.conferencing);
@ -108,6 +115,9 @@ public class ConferenceActivity extends ListActivity implements
findViewById(R.id.incallNumpadShow).setOnClickListener(this); findViewById(R.id.incallNumpadShow).setOnClickListener(this);
findViewById(R.id.conf_simple_merge).setOnClickListener(this); findViewById(R.id.conf_simple_merge).setOnClickListener(this);
findViewById(R.id.toggleMuteMic).setOnClickListener(this);
findViewById(R.id.toggleSpeaker).setOnClickListener(this);
List<LinphoneCall> calls = getInitialCalls(); List<LinphoneCall> calls = getInitialCalls();
setListAdapter(new CalleeListAdapter(calls)); setListAdapter(new CalleeListAdapter(calls));
workaroundStatusBarBug(); workaroundStatusBarBug();
@ -201,7 +211,7 @@ public class ConferenceActivity extends ListActivity implements
Intent intent = new Intent().setClass(this, UriPickerActivity.class); Intent intent = new Intent().setClass(this, UriPickerActivity.class);
intent.putExtra(UriPickerActivity.EXTRA_PICKER_TYPE, UriPickerActivity.EXTRA_PICKER_TYPE_ADD); intent.putExtra(UriPickerActivity.EXTRA_PICKER_TYPE, UriPickerActivity.EXTRA_PICKER_TYPE_ADD);
startActivityForResult(intent, ID_ADD_CALL); startActivityForResult(intent, ID_ADD_CALL);
lc().pauseAllCalls(); pauseCurrentCallOrLeaveConference();
break; break;
case R.id.conf_header: case R.id.conf_header:
View content = getLayoutInflater().inflate(R.layout.conf_choices_admin, null); View content = getLayoutInflater().inflate(R.layout.conf_choices_admin, null);
@ -247,6 +257,16 @@ public class ConferenceActivity extends ListActivity implements
case R.id.conf_simple_merge: case R.id.conf_simple_merge:
lc().addAllToConference(); lc().addAllToConference();
break; break;
case R.id.toggleMuteMic:
lc().muteMic(((ToggleButton) v).isChecked());
break;
case R.id.toggleSpeaker:
if (((ToggleButton) v).isChecked()) {
LinphoneManager.getInstance().routeAudioToSpeaker();
} else {
LinphoneManager.getInstance().routeAudioToReceiver();
}
break;
default: default:
break; break;
} }