Fixed deprecated liblinphone APIs
This commit is contained in:
parent
8123c5dbeb
commit
3a2f54eece
11 changed files with 41 additions and 33 deletions
|
@ -203,7 +203,7 @@ public class LinphoneManager implements SensorEventListener {
|
||||||
if ((state == State.IncomingReceived || state == State.IncomingEarlyMedia)
|
if ((state == State.IncomingReceived || state == State.IncomingEarlyMedia)
|
||||||
&& getCallGsmON()) {
|
&& getCallGsmON()) {
|
||||||
if (mCore != null) {
|
if (mCore != null) {
|
||||||
mCore.declineCall(call, Reason.Busy);
|
call.decline(Reason.Busy);
|
||||||
}
|
}
|
||||||
} else if (state == State.IncomingReceived
|
} else if (state == State.IncomingReceived
|
||||||
&& (LinphonePreferences.instance().isAutoAnswerEnabled())
|
&& (LinphonePreferences.instance().isAutoAnswerEnabled())
|
||||||
|
@ -241,7 +241,7 @@ public class LinphoneManager implements SensorEventListener {
|
||||||
&& !localVideo
|
&& !localVideo
|
||||||
&& !autoAcceptCameraPolicy
|
&& !autoAcceptCameraPolicy
|
||||||
&& mCore.getConference() == null) {
|
&& mCore.getConference() == null) {
|
||||||
mCore.deferCallUpdate(call);
|
call.deferUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -851,7 +851,7 @@ public class CallActivity extends LinphoneGenericActivity
|
||||||
if (videoDisabled) {
|
if (videoDisabled) {
|
||||||
CallParams params = core.createCallParams(call);
|
CallParams params = core.createCallParams(call);
|
||||||
params.enableVideo(false);
|
params.enableVideo(false);
|
||||||
core.updateCall(call, params);
|
call.update(params);
|
||||||
} else {
|
} else {
|
||||||
mVideoProgress.setVisibility(View.VISIBLE);
|
mVideoProgress.setVisibility(View.VISIBLE);
|
||||||
if (call.getRemoteParams() != null && !call.getRemoteParams().lowBandwidthEnabled()) {
|
if (call.getRemoteParams() != null && !call.getRemoteParams().lowBandwidthEnabled()) {
|
||||||
|
@ -1000,14 +1000,14 @@ public class CallActivity extends LinphoneGenericActivity
|
||||||
private void pauseOrResumeCall(Call call) {
|
private void pauseOrResumeCall(Call call) {
|
||||||
Core core = LinphoneManager.getCore();
|
Core core = LinphoneManager.getCore();
|
||||||
if (call != null && core.getCurrentCall() == call) {
|
if (call != null && core.getCurrentCall() == call) {
|
||||||
core.pauseCall(call);
|
call.pause();
|
||||||
if (isVideoEnabled(core.getCurrentCall())) {
|
if (isVideoEnabled(core.getCurrentCall())) {
|
||||||
mIsVideoCallPaused = true;
|
mIsVideoCallPaused = true;
|
||||||
}
|
}
|
||||||
mPause.setSelected(true);
|
mPause.setSelected(true);
|
||||||
} else if (call != null) {
|
} else if (call != null) {
|
||||||
if (call.getState() == State.Paused) {
|
if (call.getState() == State.Paused) {
|
||||||
core.resumeCall(call);
|
call.resume();
|
||||||
if (mIsVideoCallPaused) {
|
if (mIsVideoCallPaused) {
|
||||||
mIsVideoCallPaused = false;
|
mIsVideoCallPaused = false;
|
||||||
}
|
}
|
||||||
|
@ -1025,7 +1025,7 @@ public class CallActivity extends LinphoneGenericActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentCall != null) {
|
if (currentCall != null) {
|
||||||
core.terminateCall(currentCall);
|
currentCall.terminate();
|
||||||
} else if (core.isInConference()) {
|
} else if (core.isInConference()) {
|
||||||
core.terminateConference();
|
core.terminateConference();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1192,7 +1192,7 @@ public class CallActivity extends LinphoneGenericActivity
|
||||||
core.enableVideoDisplay(true);
|
core.enableVideoDisplay(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
core.acceptCallUpdate(call, params);
|
call.acceptUpdate(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideStatusBar() {
|
private void hideStatusBar() {
|
||||||
|
|
|
@ -190,7 +190,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity {
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
if (LinphoneService.isReady()
|
if (LinphoneService.isReady()
|
||||||
&& (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_HOME)) {
|
&& (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_HOME)) {
|
||||||
LinphoneManager.getCore().terminateCall(mCall);
|
mCall.terminate();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
return super.onKeyDown(keyCode, event);
|
return super.onKeyDown(keyCode, event);
|
||||||
|
@ -214,7 +214,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity {
|
||||||
}
|
}
|
||||||
mAlreadyAcceptedOrDeniedCall = true;
|
mAlreadyAcceptedOrDeniedCall = true;
|
||||||
|
|
||||||
LinphoneManager.getCore().terminateCall(mCall);
|
mCall.terminate();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class CallManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not yet in video call: try to re-invite with video
|
// Not yet in video call: try to re-invite with video
|
||||||
core.updateCall(call, params);
|
call.update(params);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,9 +140,7 @@ public class CallManager {
|
||||||
Log.e("[Call Manager] Trying to updateCall while not in call: doing nothing");
|
Log.e("[Call Manager] Trying to updateCall while not in call: doing nothing");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CallParams params = core.createCallParams(call);
|
call.update(null);
|
||||||
mBandwidthManager.updateWithProfileSettings(params);
|
|
||||||
core.updateCall(call, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void newOutgoingCall(AddressType address) {
|
public void newOutgoingCall(AddressType address) {
|
||||||
|
@ -238,7 +236,7 @@ public class CallManager {
|
||||||
private void terminateCall() {
|
private void terminateCall() {
|
||||||
Core core = LinphoneManager.getCore();
|
Core core = LinphoneManager.getCore();
|
||||||
if (core.inCall()) {
|
if (core.inCall()) {
|
||||||
core.terminateCall(core.getCurrentCall());
|
core.getCurrentCall().terminate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +266,7 @@ public class CallManager {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
core.acceptCallWithParams(call, params);
|
call.acceptWithParams(params);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
if (LinphoneService.isReady()
|
if (LinphoneService.isReady()
|
||||||
&& (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_HOME)) {
|
&& (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_HOME)) {
|
||||||
LinphoneManager.getCore().terminateCall(mCall);
|
mCall.terminate();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
return super.onKeyDown(keyCode, event);
|
return super.onKeyDown(keyCode, event);
|
||||||
|
@ -238,7 +238,7 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
|
||||||
}
|
}
|
||||||
|
|
||||||
private void decline() {
|
private void decline() {
|
||||||
LinphoneManager.getCore().terminateCall(mCall);
|
mCall.terminate();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,6 @@ import org.linphone.core.Content;
|
||||||
import org.linphone.core.Core;
|
import org.linphone.core.Core;
|
||||||
import org.linphone.core.EventLog;
|
import org.linphone.core.EventLog;
|
||||||
import org.linphone.core.Factory;
|
import org.linphone.core.Factory;
|
||||||
import org.linphone.core.LimeState;
|
|
||||||
import org.linphone.core.Participant;
|
import org.linphone.core.Participant;
|
||||||
import org.linphone.core.ParticipantDevice;
|
import org.linphone.core.ParticipantDevice;
|
||||||
import org.linphone.core.Reason;
|
import org.linphone.core.Reason;
|
||||||
|
@ -1115,7 +1114,7 @@ public class ChatMessagesFragment extends Fragment
|
||||||
final Address from = msg.getFromAddress();
|
final Address from = msg.getFromAddress();
|
||||||
final LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(from);
|
final LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(from);
|
||||||
|
|
||||||
if (LinphoneManager.getCore().limeEnabled() == LimeState.Mandatory) {
|
if (LinphoneManager.getCore().limeX3DhEnabled()) {
|
||||||
final Dialog dialog =
|
final Dialog dialog =
|
||||||
((ChatActivity) getActivity())
|
((ChatActivity) getActivity())
|
||||||
.displayDialog(
|
.displayDialog(
|
||||||
|
|
|
@ -358,7 +358,7 @@ public class LinphoneContact extends AndroidContact
|
||||||
mFriend.done();
|
mFriend.done();
|
||||||
}
|
}
|
||||||
if (created) {
|
if (created) {
|
||||||
core.addFriend(mFriend);
|
core.getDefaultFriendList().addFriend(mFriend);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ContactsManager.getInstance().hasReadContactsAccess()) {
|
if (!ContactsManager.getInstance().hasReadContactsAccess()) {
|
||||||
|
|
|
@ -177,18 +177,25 @@ public class HistoryDetailFragment extends Fragment {
|
||||||
|
|
||||||
private void displayHistory() {
|
private void displayHistory() {
|
||||||
if (mSipUri != null) {
|
if (mSipUri != null) {
|
||||||
Address lAddress = Factory.instance().createAddress(mSipUri);
|
Address address = Factory.instance().createAddress(mSipUri);
|
||||||
mChatSecured.setVisibility(View.GONE);
|
mChatSecured.setVisibility(View.GONE);
|
||||||
|
|
||||||
if (lAddress != null) {
|
Core core = LinphoneManager.getCore();
|
||||||
CallLog[] logs = LinphoneManager.getCore().getCallHistoryForAddress(lAddress);
|
if (address != null && core != null) {
|
||||||
|
ProxyConfig proxyConfig = core.getDefaultProxyConfig();
|
||||||
|
CallLog[] logs;
|
||||||
|
if (proxyConfig != null) {
|
||||||
|
logs = core.getCallHistory(address, proxyConfig.getIdentityAddress());
|
||||||
|
} else {
|
||||||
|
logs = core.getCallHistoryForAddress(address);
|
||||||
|
}
|
||||||
List<CallLog> logsList = Arrays.asList(logs);
|
List<CallLog> logsList = Arrays.asList(logs);
|
||||||
mLogsList.setAdapter(
|
mLogsList.setAdapter(
|
||||||
new HistoryLogAdapter(
|
new HistoryLogAdapter(
|
||||||
getActivity(), R.layout.history_detail_cell, logsList));
|
getActivity(), R.layout.history_detail_cell, logsList));
|
||||||
|
|
||||||
mContactAddress.setText(LinphoneUtils.getDisplayableAddress(lAddress));
|
mContactAddress.setText(LinphoneUtils.getDisplayableAddress(address));
|
||||||
mContact = ContactsManager.getInstance().findContactFromAddress(lAddress);
|
mContact = ContactsManager.getInstance().findContactFromAddress(address);
|
||||||
|
|
||||||
if (mContact != null) {
|
if (mContact != null) {
|
||||||
mContactName.setText(mContact.getFullName());
|
mContactName.setText(mContact.getFullName());
|
||||||
|
@ -207,7 +214,7 @@ public class HistoryDetailFragment extends Fragment {
|
||||||
? LinphoneUtils.getAddressDisplayName(mSipUri)
|
? LinphoneUtils.getAddressDisplayName(mSipUri)
|
||||||
: mDisplayName);
|
: mDisplayName);
|
||||||
ContactAvatar.displayAvatar(
|
ContactAvatar.displayAvatar(
|
||||||
LinphoneUtils.getAddressDisplayName(lAddress), mAvatarLayout);
|
LinphoneUtils.getAddressDisplayName(address), mAvatarLayout);
|
||||||
mAddToContacts.setVisibility(View.VISIBLE);
|
mAddToContacts.setVisibility(View.VISIBLE);
|
||||||
mGoToContact.setVisibility(View.GONE);
|
mGoToContact.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -636,7 +636,8 @@ public class AccountSettingsFragment extends SettingsFragment {
|
||||||
mUseAsDefault.setChecked(mProxyConfig.equals(core.getDefaultProxyConfig()));
|
mUseAsDefault.setChecked(mProxyConfig.equals(core.getDefaultProxyConfig()));
|
||||||
mUseAsDefault.setEnabled(!mUseAsDefault.isChecked());
|
mUseAsDefault.setEnabled(!mUseAsDefault.isChecked());
|
||||||
|
|
||||||
mOutboundProxy.setChecked(mProxyConfig.getRoute() != null);
|
String[] routes = mProxyConfig.getRoutes();
|
||||||
|
mOutboundProxy.setChecked(routes != null && routes.length > 0);
|
||||||
|
|
||||||
mIce.setChecked(natPolicy.iceEnabled());
|
mIce.setChecked(natPolicy.iceEnabled());
|
||||||
mIce.setEnabled(
|
mIce.setEnabled(
|
||||||
|
|
|
@ -45,6 +45,7 @@ import org.linphone.core.Transports;
|
||||||
import org.linphone.core.Tunnel;
|
import org.linphone.core.Tunnel;
|
||||||
import org.linphone.core.TunnelConfig;
|
import org.linphone.core.TunnelConfig;
|
||||||
import org.linphone.core.VideoActivationPolicy;
|
import org.linphone.core.VideoActivationPolicy;
|
||||||
|
import org.linphone.core.VideoDefinition;
|
||||||
import org.linphone.core.tools.Log;
|
import org.linphone.core.tools.Log;
|
||||||
import org.linphone.purchase.Purchasable;
|
import org.linphone.purchase.Purchasable;
|
||||||
import org.linphone.utils.LinphoneUtils;
|
import org.linphone.utils.LinphoneUtils;
|
||||||
|
@ -338,7 +339,9 @@ public class LinphonePreferences {
|
||||||
|
|
||||||
public void setPreferredVideoSize(String preferredVideoSize) {
|
public void setPreferredVideoSize(String preferredVideoSize) {
|
||||||
if (getLc() == null) return;
|
if (getLc() == null) return;
|
||||||
getLc().setPreferredVideoSizeByName(preferredVideoSize);
|
VideoDefinition preferredVideoDefinition =
|
||||||
|
Factory.instance().createVideoDefinitionFromName(preferredVideoSize);
|
||||||
|
getLc().setPreferredVideoDefinition(preferredVideoDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPreferredVideoFps() {
|
public int getPreferredVideoFps() {
|
||||||
|
@ -719,24 +722,24 @@ public class LinphonePreferences {
|
||||||
|
|
||||||
public String getDefaultDisplayName() {
|
public String getDefaultDisplayName() {
|
||||||
if (getLc() == null) return null;
|
if (getLc() == null) return null;
|
||||||
return getLc().getPrimaryContactParsed().getDisplayName();
|
return getLc().createPrimaryContactParsed().getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultDisplayName(String displayName) {
|
public void setDefaultDisplayName(String displayName) {
|
||||||
if (getLc() == null) return;
|
if (getLc() == null) return;
|
||||||
Address primary = getLc().getPrimaryContactParsed();
|
Address primary = getLc().createPrimaryContactParsed();
|
||||||
primary.setDisplayName(displayName);
|
primary.setDisplayName(displayName);
|
||||||
getLc().setPrimaryContact(primary.asString());
|
getLc().setPrimaryContact(primary.asString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDefaultUsername() {
|
public String getDefaultUsername() {
|
||||||
if (getLc() == null) return null;
|
if (getLc() == null) return null;
|
||||||
return getLc().getPrimaryContactParsed().getUsername();
|
return getLc().createPrimaryContactParsed().getUsername();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultUsername(String username) {
|
public void setDefaultUsername(String username) {
|
||||||
if (getLc() == null) return;
|
if (getLc() == null) return;
|
||||||
Address primary = getLc().getPrimaryContactParsed();
|
Address primary = getLc().createPrimaryContactParsed();
|
||||||
primary.setUsername(username);
|
primary.setUsername(username);
|
||||||
getLc().setPrimaryContact(primary.asString());
|
getLc().setPrimaryContact(primary.asString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class CallButton extends ImageView implements OnClickListener, AddressAwa
|
||||||
if (core.getCurrentCall() == null) {
|
if (core.getCurrentCall() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
core.transferCall(core.getCurrentCall(), mAddress.getText().toString());
|
core.getCurrentCall().transfer(mAddress.getText().toString());
|
||||||
} else {
|
} else {
|
||||||
LinphoneManager.getCallManager().newOutgoingCall(mAddress);
|
LinphoneManager.getCallManager().newOutgoingCall(mAddress);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue