Changes to make project library compatible

This commit is contained in:
Sylvain Berfini 2012-06-05 17:23:30 +02:00
parent 22afd5691f
commit d5ce3dc4b8
7 changed files with 93 additions and 99 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:linphone="http://schemas.android.com/apk/res/org.linphone"
xmlns:linphone="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">

View file

@ -268,19 +268,16 @@ public abstract class AbstractCalleesActivity extends ListActivity implements Li
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.toggleMuteMic:
int id = v.getId();
if (id == R.id.toggleMuteMic) {
lc().muteMic(((Checkable) v).isChecked());
break;
case R.id.toggleSpeaker:
}
else if (id == R.id.toggleSpeaker) {
if (((Checkable) v).isChecked()) {
LinphoneManager.getInstance().routeAudioToSpeaker();
} else {
LinphoneManager.getInstance().routeAudioToReceiver();
}
break;
default:
break;
}
}

View file

@ -119,17 +119,17 @@ public class ConferenceDetailsActivity extends AbstractCalleesActivity {
this.dialog = dialog;
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.terminate_call:
int id = v.getId();
if (id == R.id.terminate_call) {
lc().terminateCall(call);
break;
case R.id.remove_from_conference:
}
else if (id == R.id.remove_from_conference) {
lc().removeFromConference(call);
if (LinphoneUtils.countConferenceCalls(lc()) == 0) {
finish();
}
break;
default:
}
else {
throw new RuntimeException("unknown id " + v.getId());
}
if (dialog != null) dialog.dismiss();

View file

@ -95,15 +95,13 @@ public class HistoryActivity extends ListActivity {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_clear_history:
int id = item.getItemId();
if (id == R.id.menu_clear_history) {
LinphoneManager.getLc().clearCallLogs();
setListAdapter(new CallHistoryAdapter(this));
break;
default:
}
else {
Log.e("Unknown menu item [",item,"]");
break;
}
return false;

View file

@ -332,29 +332,29 @@ public class IncallActivity extends AbstractCalleesActivity implements
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.addCall:
int id = v.getId();
if (id == R.id.addCall) {
finish();
break;
case R.id.incallHang:
}
else if (id == R.id.incallHang) {
terminateCurrentCallOrConferenceOrAll();
break;
case R.id.conf_header:
}
else if (id == R.id.conf_header) {
boolean enterConf = !lc().isInConference();
enterConferenceAndVirtualConfView(enterConf);
break;
case R.id.conf_header_details:
}
else if (id == R.id.conf_header_details) {
onLongClick(v);
break;
case R.id.incallNumpadShow:
}
else if (id == R.id.incallNumpadShow) {
showDialog(numpadDialogId);
break;
case R.id.conf_simple_merge:
}
else if (id == R.id.conf_simple_merge) {
if (!lc().soundResourcesLocked()) {
lc().addAllToConference();
}
break;
case R.id.conf_simple_pause:
}
else if (id == R.id.conf_simple_pause) {
LinphoneCall call = lc().getCurrentCall();
if (call != null) {
lc().pauseCall(call);
@ -366,8 +366,8 @@ public class IncallActivity extends AbstractCalleesActivity implements
lc().resumeCall(callToResume);
}
}
break;
case R.id.conf_simple_video:
}
else if (id == R.id.conf_simple_video) {
LinphoneCall vCall = lc().getCurrentCall();
if (vCall != null) {
if (!vCall.cameraEnabled() && vCall.getCurrentParamsCopy().getVideoEnabled()) {
@ -378,8 +378,8 @@ public class IncallActivity extends AbstractCalleesActivity implements
LinphoneActivity.instance().startVideoActivity(vCall, 0);
}
}
break;
default:
}
else {
// mic, speaker
super.onClick(v);
}
@ -431,21 +431,21 @@ public class IncallActivity extends AbstractCalleesActivity implements
this.dialog = dialog;
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.merge_to_conference:
int id =v.getId();
if (id == R.id.merge_to_conference) {
lc().addToConference(call);
break;
case R.id.terminate_call:
}
else if (id == R.id.terminate_call) {
lc().terminateCall(call);
break;
case R.id.transfer_existing:
}
else if (id == R.id.transfer_existing) {
prepareForTransferingExistingOrNewCall(call);
break;
case R.id.transfer_new:
}
else if (id == R.id.transfer_new) {
openUriPicker(UriPickerActivity.EXTRA_PICKER_TYPE_TRANSFER, transferCallId);
mCallToTransfer = call;
break;
case R.id.addVideo:
}
else if (id == R.id.addVideo) {
if (!call.cameraEnabled() && call.getCurrentParamsCopy().getVideoEnabled()) {
// NoWebcam mode, we let it this way
LinphoneActivity.instance().startVideoActivity(call, 0);
@ -453,17 +453,17 @@ public class IncallActivity extends AbstractCalleesActivity implements
else if (!LinphoneManager.getInstance().addVideo()) {
LinphoneActivity.instance().startVideoActivity(call, 0);
}
break;
case R.id.set_auth_token_verified:
}
else if (id == R.id.set_auth_token_verified) {
call.setAuthenticationTokenVerified(true);
break;
case R.id.set_auth_token_not_verified:
}
else if (id == R.id.set_auth_token_not_verified) {
call.setAuthenticationTokenVerified(false);
break;
case R.id.encrypted:
}
else if (id == R.id.encrypted) {
call.setAuthenticationTokenVerified(!call.isAuthenticationTokenVerified());
break;
default:
}
else {
throw new RuntimeException("unknown id " + v.getId());
}
if (dialog != null) dialog.dismiss();

View file

@ -263,21 +263,22 @@ public class LinphoneActivity extends TabActivity implements ContactPicked
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_settings:
int id = item.getItemId();
if (id == R.id.menu_settings) {
startprefActivity();
return true;
case R.id.menu_exit:
}
else if (id == R.id.menu_exit) {
finish();
stopService(new Intent(ACTION_MAIN)
.setClass(this, LinphoneService.class));
break;
case R.id.menu_about:
}
else if (id == R.id.menu_about) {
startActivity(new Intent(ACTION_MAIN)
.setClass(this, AboutActivity.class));
default:
}
else {
Log.e("Unknown menu item [",item,"]");
break;
}
return false;

View file

@ -260,12 +260,12 @@ public class VideoCallActivity extends Activity implements
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.videocall_menu_back_to_dialer:
int id = item.getItemId();
if (id == R.id.videocall_menu_back_to_dialer) {
finish();
LinphoneActivity.instance().startIncallActivity();
break;
case R.id.videocall_menu_change_resolution:
}
else if (id == R.id.videocall_menu_change_resolution) {
LinphoneManager.getInstance().changeResolution();
// previous call will cause graph reconstruction -> regive preview
// window
@ -273,11 +273,11 @@ public class VideoCallActivity extends Activity implements
LinphoneManager.getLc()
.setPreviewWindow(mVideoCaptureViewReady);
rewriteChangeResolutionItem(item);
break;
case R.id.videocall_menu_terminate_call:
}
else if (id == R.id.videocall_menu_terminate_call) {
LinphoneManager.getInstance().terminateCall();
break;
case R.id.videocall_menu_toggle_camera:
}
else if (id == R.id.videocall_menu_toggle_camera) {
boolean camEnabled = LinphoneManager.getInstance()
.toggleEnableCamera();
updatePreview(camEnabled);
@ -291,21 +291,20 @@ public class VideoCallActivity extends Activity implements
mVideoCaptureViewReady);
} else
LinphoneManager.getLc().setPreviewWindow(null);
break;
case R.id.videocall_menu_switch_camera:
int id = LinphoneManager.getLc().getVideoDevice();
id = (id + 1) % AndroidCameraConfiguration.retrieveCameras().length;
LinphoneManager.getLc().setVideoDevice(id);
}
else if (id == R.id.videocall_menu_switch_camera) {
int videoDeviceId = LinphoneManager.getLc().getVideoDevice();
videoDeviceId = (videoDeviceId + 1) % AndroidCameraConfiguration.retrieveCameras().length;
LinphoneManager.getLc().setVideoDevice(videoDeviceId);
CallManager.getInstance().updateCall();
// previous call will cause graph reconstruction -> regive preview
// window
if (mVideoCaptureViewReady != null)
LinphoneManager.getLc()
.setPreviewWindow(mVideoCaptureViewReady);
break;
default:
}
else {
Log.e("Unknown menu item [", item, "]");
break;
}
return true;
}
@ -500,48 +499,47 @@ public class VideoCallActivity extends Activity implements
public void onClick(View v) {
resetControlsLayoutExpiration();
switch (v.getId()) {
case R.id.incallHang:
int id = v.getId();
if (id == R.id.incallHang) {
terminateCurrentCallOrConferenceOrAll();
break;
case R.id.toggleSpeaker:
}
else if (id == R.id.toggleSpeaker) {
if (((Checkable) v).isChecked()) {
LinphoneManager.getInstance().routeAudioToSpeaker();
} else {
LinphoneManager.getInstance().routeAudioToReceiver();
}
break;
case R.id.incallNumpadShow:
}
else if (id == R.id.incallNumpadShow) {
showDialog(numpadDialogId);
break;
case R.id.toggleMuteMic:
}
else if (id == R.id.toggleMuteMic) {
LinphoneManager.getLc().muteMic(((Checkable) v).isChecked());
break;
case R.id.switch_camera:
int id = LinphoneManager.getLc().getVideoDevice();
id = (id + 1) % AndroidCameraConfiguration.retrieveCameras().length;
LinphoneManager.getLc().setVideoDevice(id);
}
else if (id == R.id.switch_camera) {
int videoDeviceId = LinphoneManager.getLc().getVideoDevice();
videoDeviceId = (videoDeviceId + 1) % AndroidCameraConfiguration.retrieveCameras().length;
LinphoneManager.getLc().setVideoDevice(videoDeviceId);
CallManager.getInstance().updateCall();
// previous call will cause graph reconstruction -> regive preview
// window
if (mVideoCaptureViewReady != null)
LinphoneManager.getLc()
.setPreviewWindow(mVideoCaptureViewReady);
break;
case R.id.conf_simple_pause:
}
else if (id == R.id.conf_simple_pause) {
finish();
LinphoneActivity.instance().startIncallActivity();
LinphoneManager.getLc().pauseCall(videoCall);
break;
case R.id.conf_simple_video:
}
else if (id == R.id.conf_simple_video) {
LinphoneCallParams params = videoCall.getCurrentParamsCopy();
params.setVideoEnabled(false);
LinphoneManager.getLc().updateCall(videoCall, params);
break;
case R.id.back:
}
else if (id == R.id.back) {
finish();
LinphoneActivity.instance().startIncallActivity();
break;
}
}