Changes to make project library compatible
This commit is contained in:
parent
22afd5691f
commit
d5ce3dc4b8
7 changed files with 93 additions and 99 deletions
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<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:orientation="vertical" android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
|
|
||||||
|
|
|
@ -268,19 +268,16 @@ public abstract class AbstractCalleesActivity extends ListActivity implements Li
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
switch (v.getId()) {
|
int id = v.getId();
|
||||||
case R.id.toggleMuteMic:
|
if (id == R.id.toggleMuteMic) {
|
||||||
lc().muteMic(((Checkable) v).isChecked());
|
lc().muteMic(((Checkable) v).isChecked());
|
||||||
break;
|
}
|
||||||
case R.id.toggleSpeaker:
|
else if (id == R.id.toggleSpeaker) {
|
||||||
if (((Checkable) v).isChecked()) {
|
if (((Checkable) v).isChecked()) {
|
||||||
LinphoneManager.getInstance().routeAudioToSpeaker();
|
LinphoneManager.getInstance().routeAudioToSpeaker();
|
||||||
} else {
|
} else {
|
||||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,17 +119,17 @@ public class ConferenceDetailsActivity extends AbstractCalleesActivity {
|
||||||
this.dialog = dialog;
|
this.dialog = dialog;
|
||||||
}
|
}
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
switch (v.getId()) {
|
int id = v.getId();
|
||||||
case R.id.terminate_call:
|
if (id == R.id.terminate_call) {
|
||||||
lc().terminateCall(call);
|
lc().terminateCall(call);
|
||||||
break;
|
}
|
||||||
case R.id.remove_from_conference:
|
else if (id == R.id.remove_from_conference) {
|
||||||
lc().removeFromConference(call);
|
lc().removeFromConference(call);
|
||||||
if (LinphoneUtils.countConferenceCalls(lc()) == 0) {
|
if (LinphoneUtils.countConferenceCalls(lc()) == 0) {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
default:
|
else {
|
||||||
throw new RuntimeException("unknown id " + v.getId());
|
throw new RuntimeException("unknown id " + v.getId());
|
||||||
}
|
}
|
||||||
if (dialog != null) dialog.dismiss();
|
if (dialog != null) dialog.dismiss();
|
||||||
|
|
|
@ -95,15 +95,13 @@ public class HistoryActivity extends ListActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
int id = item.getItemId();
|
||||||
case R.id.menu_clear_history:
|
if (id == R.id.menu_clear_history) {
|
||||||
LinphoneManager.getLc().clearCallLogs();
|
LinphoneManager.getLc().clearCallLogs();
|
||||||
setListAdapter(new CallHistoryAdapter(this));
|
setListAdapter(new CallHistoryAdapter(this));
|
||||||
|
}
|
||||||
break;
|
else {
|
||||||
default:
|
|
||||||
Log.e("Unknown menu item [",item,"]");
|
Log.e("Unknown menu item [",item,"]");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -332,29 +332,29 @@ public class IncallActivity extends AbstractCalleesActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
switch (v.getId()) {
|
int id = v.getId();
|
||||||
case R.id.addCall:
|
if (id == R.id.addCall) {
|
||||||
finish();
|
finish();
|
||||||
break;
|
}
|
||||||
case R.id.incallHang:
|
else if (id == R.id.incallHang) {
|
||||||
terminateCurrentCallOrConferenceOrAll();
|
terminateCurrentCallOrConferenceOrAll();
|
||||||
break;
|
}
|
||||||
case R.id.conf_header:
|
else if (id == R.id.conf_header) {
|
||||||
boolean enterConf = !lc().isInConference();
|
boolean enterConf = !lc().isInConference();
|
||||||
enterConferenceAndVirtualConfView(enterConf);
|
enterConferenceAndVirtualConfView(enterConf);
|
||||||
break;
|
}
|
||||||
case R.id.conf_header_details:
|
else if (id == R.id.conf_header_details) {
|
||||||
onLongClick(v);
|
onLongClick(v);
|
||||||
break;
|
}
|
||||||
case R.id.incallNumpadShow:
|
else if (id == R.id.incallNumpadShow) {
|
||||||
showDialog(numpadDialogId);
|
showDialog(numpadDialogId);
|
||||||
break;
|
}
|
||||||
case R.id.conf_simple_merge:
|
else if (id == R.id.conf_simple_merge) {
|
||||||
if (!lc().soundResourcesLocked()) {
|
if (!lc().soundResourcesLocked()) {
|
||||||
lc().addAllToConference();
|
lc().addAllToConference();
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case R.id.conf_simple_pause:
|
else if (id == R.id.conf_simple_pause) {
|
||||||
LinphoneCall call = lc().getCurrentCall();
|
LinphoneCall call = lc().getCurrentCall();
|
||||||
if (call != null) {
|
if (call != null) {
|
||||||
lc().pauseCall(call);
|
lc().pauseCall(call);
|
||||||
|
@ -366,8 +366,8 @@ public class IncallActivity extends AbstractCalleesActivity implements
|
||||||
lc().resumeCall(callToResume);
|
lc().resumeCall(callToResume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case R.id.conf_simple_video:
|
else if (id == R.id.conf_simple_video) {
|
||||||
LinphoneCall vCall = lc().getCurrentCall();
|
LinphoneCall vCall = lc().getCurrentCall();
|
||||||
if (vCall != null) {
|
if (vCall != null) {
|
||||||
if (!vCall.cameraEnabled() && vCall.getCurrentParamsCopy().getVideoEnabled()) {
|
if (!vCall.cameraEnabled() && vCall.getCurrentParamsCopy().getVideoEnabled()) {
|
||||||
|
@ -378,8 +378,8 @@ public class IncallActivity extends AbstractCalleesActivity implements
|
||||||
LinphoneActivity.instance().startVideoActivity(vCall, 0);
|
LinphoneActivity.instance().startVideoActivity(vCall, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
default:
|
else {
|
||||||
// mic, speaker
|
// mic, speaker
|
||||||
super.onClick(v);
|
super.onClick(v);
|
||||||
}
|
}
|
||||||
|
@ -431,21 +431,21 @@ public class IncallActivity extends AbstractCalleesActivity implements
|
||||||
this.dialog = dialog;
|
this.dialog = dialog;
|
||||||
}
|
}
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
switch (v.getId()) {
|
int id =v.getId();
|
||||||
case R.id.merge_to_conference:
|
if (id == R.id.merge_to_conference) {
|
||||||
lc().addToConference(call);
|
lc().addToConference(call);
|
||||||
break;
|
}
|
||||||
case R.id.terminate_call:
|
else if (id == R.id.terminate_call) {
|
||||||
lc().terminateCall(call);
|
lc().terminateCall(call);
|
||||||
break;
|
}
|
||||||
case R.id.transfer_existing:
|
else if (id == R.id.transfer_existing) {
|
||||||
prepareForTransferingExistingOrNewCall(call);
|
prepareForTransferingExistingOrNewCall(call);
|
||||||
break;
|
}
|
||||||
case R.id.transfer_new:
|
else if (id == R.id.transfer_new) {
|
||||||
openUriPicker(UriPickerActivity.EXTRA_PICKER_TYPE_TRANSFER, transferCallId);
|
openUriPicker(UriPickerActivity.EXTRA_PICKER_TYPE_TRANSFER, transferCallId);
|
||||||
mCallToTransfer = call;
|
mCallToTransfer = call;
|
||||||
break;
|
}
|
||||||
case R.id.addVideo:
|
else if (id == R.id.addVideo) {
|
||||||
if (!call.cameraEnabled() && call.getCurrentParamsCopy().getVideoEnabled()) {
|
if (!call.cameraEnabled() && call.getCurrentParamsCopy().getVideoEnabled()) {
|
||||||
// NoWebcam mode, we let it this way
|
// NoWebcam mode, we let it this way
|
||||||
LinphoneActivity.instance().startVideoActivity(call, 0);
|
LinphoneActivity.instance().startVideoActivity(call, 0);
|
||||||
|
@ -453,17 +453,17 @@ public class IncallActivity extends AbstractCalleesActivity implements
|
||||||
else if (!LinphoneManager.getInstance().addVideo()) {
|
else if (!LinphoneManager.getInstance().addVideo()) {
|
||||||
LinphoneActivity.instance().startVideoActivity(call, 0);
|
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);
|
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);
|
call.setAuthenticationTokenVerified(false);
|
||||||
break;
|
}
|
||||||
case R.id.encrypted:
|
else if (id == R.id.encrypted) {
|
||||||
call.setAuthenticationTokenVerified(!call.isAuthenticationTokenVerified());
|
call.setAuthenticationTokenVerified(!call.isAuthenticationTokenVerified());
|
||||||
break;
|
}
|
||||||
default:
|
else {
|
||||||
throw new RuntimeException("unknown id " + v.getId());
|
throw new RuntimeException("unknown id " + v.getId());
|
||||||
}
|
}
|
||||||
if (dialog != null) dialog.dismiss();
|
if (dialog != null) dialog.dismiss();
|
||||||
|
|
|
@ -263,21 +263,22 @@ public class LinphoneActivity extends TabActivity implements ContactPicked
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
int id = item.getItemId();
|
||||||
case R.id.menu_settings:
|
if (id == R.id.menu_settings) {
|
||||||
startprefActivity();
|
startprefActivity();
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_exit:
|
}
|
||||||
|
else if (id == R.id.menu_exit) {
|
||||||
finish();
|
finish();
|
||||||
stopService(new Intent(ACTION_MAIN)
|
stopService(new Intent(ACTION_MAIN)
|
||||||
.setClass(this, LinphoneService.class));
|
.setClass(this, LinphoneService.class));
|
||||||
break;
|
}
|
||||||
case R.id.menu_about:
|
else if (id == R.id.menu_about) {
|
||||||
startActivity(new Intent(ACTION_MAIN)
|
startActivity(new Intent(ACTION_MAIN)
|
||||||
.setClass(this, AboutActivity.class));
|
.setClass(this, AboutActivity.class));
|
||||||
default:
|
}
|
||||||
|
else {
|
||||||
Log.e("Unknown menu item [",item,"]");
|
Log.e("Unknown menu item [",item,"]");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -260,12 +260,12 @@ public class VideoCallActivity extends Activity implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
int id = item.getItemId();
|
||||||
case R.id.videocall_menu_back_to_dialer:
|
if (id == R.id.videocall_menu_back_to_dialer) {
|
||||||
finish();
|
finish();
|
||||||
LinphoneActivity.instance().startIncallActivity();
|
LinphoneActivity.instance().startIncallActivity();
|
||||||
break;
|
}
|
||||||
case R.id.videocall_menu_change_resolution:
|
else if (id == R.id.videocall_menu_change_resolution) {
|
||||||
LinphoneManager.getInstance().changeResolution();
|
LinphoneManager.getInstance().changeResolution();
|
||||||
// previous call will cause graph reconstruction -> regive preview
|
// previous call will cause graph reconstruction -> regive preview
|
||||||
// window
|
// window
|
||||||
|
@ -273,11 +273,11 @@ public class VideoCallActivity extends Activity implements
|
||||||
LinphoneManager.getLc()
|
LinphoneManager.getLc()
|
||||||
.setPreviewWindow(mVideoCaptureViewReady);
|
.setPreviewWindow(mVideoCaptureViewReady);
|
||||||
rewriteChangeResolutionItem(item);
|
rewriteChangeResolutionItem(item);
|
||||||
break;
|
}
|
||||||
case R.id.videocall_menu_terminate_call:
|
else if (id == R.id.videocall_menu_terminate_call) {
|
||||||
LinphoneManager.getInstance().terminateCall();
|
LinphoneManager.getInstance().terminateCall();
|
||||||
break;
|
}
|
||||||
case R.id.videocall_menu_toggle_camera:
|
else if (id == R.id.videocall_menu_toggle_camera) {
|
||||||
boolean camEnabled = LinphoneManager.getInstance()
|
boolean camEnabled = LinphoneManager.getInstance()
|
||||||
.toggleEnableCamera();
|
.toggleEnableCamera();
|
||||||
updatePreview(camEnabled);
|
updatePreview(camEnabled);
|
||||||
|
@ -291,21 +291,20 @@ public class VideoCallActivity extends Activity implements
|
||||||
mVideoCaptureViewReady);
|
mVideoCaptureViewReady);
|
||||||
} else
|
} else
|
||||||
LinphoneManager.getLc().setPreviewWindow(null);
|
LinphoneManager.getLc().setPreviewWindow(null);
|
||||||
break;
|
}
|
||||||
case R.id.videocall_menu_switch_camera:
|
else if (id == R.id.videocall_menu_switch_camera) {
|
||||||
int id = LinphoneManager.getLc().getVideoDevice();
|
int videoDeviceId = LinphoneManager.getLc().getVideoDevice();
|
||||||
id = (id + 1) % AndroidCameraConfiguration.retrieveCameras().length;
|
videoDeviceId = (videoDeviceId + 1) % AndroidCameraConfiguration.retrieveCameras().length;
|
||||||
LinphoneManager.getLc().setVideoDevice(id);
|
LinphoneManager.getLc().setVideoDevice(videoDeviceId);
|
||||||
CallManager.getInstance().updateCall();
|
CallManager.getInstance().updateCall();
|
||||||
// previous call will cause graph reconstruction -> regive preview
|
// previous call will cause graph reconstruction -> regive preview
|
||||||
// window
|
// window
|
||||||
if (mVideoCaptureViewReady != null)
|
if (mVideoCaptureViewReady != null)
|
||||||
LinphoneManager.getLc()
|
LinphoneManager.getLc()
|
||||||
.setPreviewWindow(mVideoCaptureViewReady);
|
.setPreviewWindow(mVideoCaptureViewReady);
|
||||||
break;
|
}
|
||||||
default:
|
else {
|
||||||
Log.e("Unknown menu item [", item, "]");
|
Log.e("Unknown menu item [", item, "]");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -500,48 +499,47 @@ public class VideoCallActivity extends Activity implements
|
||||||
|
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
resetControlsLayoutExpiration();
|
resetControlsLayoutExpiration();
|
||||||
switch (v.getId()) {
|
int id = v.getId();
|
||||||
case R.id.incallHang:
|
if (id == R.id.incallHang) {
|
||||||
terminateCurrentCallOrConferenceOrAll();
|
terminateCurrentCallOrConferenceOrAll();
|
||||||
break;
|
}
|
||||||
case R.id.toggleSpeaker:
|
else if (id == R.id.toggleSpeaker) {
|
||||||
if (((Checkable) v).isChecked()) {
|
if (((Checkable) v).isChecked()) {
|
||||||
LinphoneManager.getInstance().routeAudioToSpeaker();
|
LinphoneManager.getInstance().routeAudioToSpeaker();
|
||||||
} else {
|
} else {
|
||||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case R.id.incallNumpadShow:
|
else if (id == R.id.incallNumpadShow) {
|
||||||
showDialog(numpadDialogId);
|
showDialog(numpadDialogId);
|
||||||
break;
|
}
|
||||||
case R.id.toggleMuteMic:
|
else if (id == R.id.toggleMuteMic) {
|
||||||
LinphoneManager.getLc().muteMic(((Checkable) v).isChecked());
|
LinphoneManager.getLc().muteMic(((Checkable) v).isChecked());
|
||||||
break;
|
}
|
||||||
case R.id.switch_camera:
|
else if (id == R.id.switch_camera) {
|
||||||
int id = LinphoneManager.getLc().getVideoDevice();
|
int videoDeviceId = LinphoneManager.getLc().getVideoDevice();
|
||||||
id = (id + 1) % AndroidCameraConfiguration.retrieveCameras().length;
|
videoDeviceId = (videoDeviceId + 1) % AndroidCameraConfiguration.retrieveCameras().length;
|
||||||
LinphoneManager.getLc().setVideoDevice(id);
|
LinphoneManager.getLc().setVideoDevice(videoDeviceId);
|
||||||
CallManager.getInstance().updateCall();
|
CallManager.getInstance().updateCall();
|
||||||
// previous call will cause graph reconstruction -> regive preview
|
// previous call will cause graph reconstruction -> regive preview
|
||||||
// window
|
// window
|
||||||
if (mVideoCaptureViewReady != null)
|
if (mVideoCaptureViewReady != null)
|
||||||
LinphoneManager.getLc()
|
LinphoneManager.getLc()
|
||||||
.setPreviewWindow(mVideoCaptureViewReady);
|
.setPreviewWindow(mVideoCaptureViewReady);
|
||||||
break;
|
}
|
||||||
case R.id.conf_simple_pause:
|
else if (id == R.id.conf_simple_pause) {
|
||||||
finish();
|
finish();
|
||||||
LinphoneActivity.instance().startIncallActivity();
|
LinphoneActivity.instance().startIncallActivity();
|
||||||
LinphoneManager.getLc().pauseCall(videoCall);
|
LinphoneManager.getLc().pauseCall(videoCall);
|
||||||
break;
|
}
|
||||||
case R.id.conf_simple_video:
|
else if (id == R.id.conf_simple_video) {
|
||||||
LinphoneCallParams params = videoCall.getCurrentParamsCopy();
|
LinphoneCallParams params = videoCall.getCurrentParamsCopy();
|
||||||
params.setVideoEnabled(false);
|
params.setVideoEnabled(false);
|
||||||
LinphoneManager.getLc().updateCall(videoCall, params);
|
LinphoneManager.getLc().updateCall(videoCall, params);
|
||||||
break;
|
}
|
||||||
case R.id.back:
|
else if (id == R.id.back) {
|
||||||
finish();
|
finish();
|
||||||
LinphoneActivity.instance().startIncallActivity();
|
LinphoneActivity.instance().startIncallActivity();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue