Rework linphoneListener
This commit is contained in:
parent
8102d6a5f3
commit
90ea41dd24
13 changed files with 471 additions and 421 deletions
|
@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCore.LogCollectionUploadState;
|
||||
import org.linphone.core.LinphoneCoreListener;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.content.Intent;
|
||||
|
@ -36,10 +37,11 @@ import android.widget.TextView;
|
|||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class AboutFragment extends Fragment implements OnClickListener, LinphoneCoreListener.LinphoneLogCollectionUploadListener {
|
||||
public class AboutFragment extends Fragment implements OnClickListener {
|
||||
private FragmentsAvailable about = FragmentsAvailable.ABOUT_INSTEAD_OF_CHAT;
|
||||
View exitButton = null;
|
||||
View sendLogButton = null;
|
||||
LinphoneCoreListener mListener;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
@ -66,7 +68,34 @@ public class AboutFragment extends Fragment implements OnClickListener, Linphone
|
|||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(this);
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
@Override
|
||||
public void uploadProgressIndication(LinphoneCore lc, int offset, int total) {
|
||||
Log.d("Log upload progress: currently uploaded = " + offset + " , total = " + total + ", % = " + String.valueOf((offset * 100) / total));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadStateChanged(LinphoneCore lc, LogCollectionUploadState state, String info) {
|
||||
Log.d("Log upload state: " + state.toString() + ", info = " + info);
|
||||
|
||||
if (state == LogCollectionUploadState.LogCollectionUploadStateDelivered) {
|
||||
final String appName = getString(R.string.app_name);
|
||||
|
||||
Intent i = new Intent(Intent.ACTION_SEND);
|
||||
i.putExtra(Intent.EXTRA_EMAIL, new String[]{ getString(R.string.about_bugreport_email) });
|
||||
i.putExtra(Intent.EXTRA_SUBJECT, appName + " Logs");
|
||||
i.putExtra(Intent.EXTRA_TEXT, info);
|
||||
i.setType("application/zip");
|
||||
|
||||
try {
|
||||
startActivity(Intent.createChooser(i, "Send mail..."));
|
||||
} catch (android.content.ActivityNotFoundException ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
|
||||
return view;
|
||||
|
@ -105,35 +134,11 @@ public class AboutFragment extends Fragment implements OnClickListener, Linphone
|
|||
public void onDestroy() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(this);
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgressIndication(LinphoneCore lc, int offset, int total) {
|
||||
Log.d("Log upload progress: currently uploaded = " + offset + " , total = " + total + ", % = " + String.valueOf((offset * 100) / total));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadStateChanged(LinphoneCore lc, LogCollectionUploadState state, String info) {
|
||||
Log.d("Log upload state: " + state.toString() + ", info = " + info);
|
||||
|
||||
if (state == LogCollectionUploadState.LogCollectionUploadStateDelivered) {
|
||||
final String appName = getString(R.string.app_name);
|
||||
|
||||
Intent i = new Intent(Intent.ACTION_SEND);
|
||||
i.putExtra(Intent.EXTRA_EMAIL, new String[]{ getString(R.string.about_bugreport_email) });
|
||||
i.putExtra(Intent.EXTRA_SUBJECT, appName + " Logs");
|
||||
i.putExtra(Intent.EXTRA_TEXT, info);
|
||||
i.setType("application/zip");
|
||||
|
||||
try {
|
||||
startActivity(Intent.createChooser(i, "Send mail..."));
|
||||
} catch (android.content.ActivityNotFoundException ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,8 +35,6 @@ import android.preference.Preference.OnPreferenceClickListener;
|
|||
import android.preference.PreferenceCategory;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.text.InputType;
|
||||
import android.text.method.PasswordTransformationMethod;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
|
|
|
@ -63,6 +63,7 @@ import org.linphone.core.LinphoneAddress;
|
|||
import org.linphone.core.LinphoneChatMessage;
|
||||
import org.linphone.core.LinphoneChatRoom;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.ui.AvatarWithShadow;
|
||||
import org.linphone.ui.BubbleChat;
|
||||
|
@ -83,13 +84,11 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
|
||||
import org.linphone.core.LinphoneChatMessage.StateListener;
|
||||
import org.linphone.core.LinphoneCoreListener.LinphoneComposingListener;
|
||||
import org.linphone.core.LinphoneCoreListener.LinphoneMessageListener;
|
||||
|
||||
/**
|
||||
* @author Margaux Clerc
|
||||
*/
|
||||
public class ChatActivity extends FragmentActivity implements OnClickListener, LinphoneMessageListener, StateListener, LinphoneComposingListener {
|
||||
public class ChatActivity extends FragmentActivity implements OnClickListener, StateListener {
|
||||
private static ChatActivity instance;
|
||||
|
||||
private static final int ADD_PHOTO = 1337;
|
||||
|
@ -131,6 +130,7 @@ public class ChatActivity extends FragmentActivity implements OnClickListener, L
|
|||
private TextWatcher textWatcher;
|
||||
private ViewTreeObserver.OnGlobalLayoutListener keyboardListener;
|
||||
private ChatMessageAdapter adapter;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
|
||||
public static boolean isInstanciated() {
|
||||
return instance != null;
|
||||
|
@ -215,6 +215,30 @@ public class ChatActivity extends FragmentActivity implements OnClickListener, L
|
|||
//Only works if using liblinphone storage
|
||||
chatRoom.markAsRead();
|
||||
}
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
@Override
|
||||
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
|
||||
LinphoneAddress from = cr.getPeerAddress();
|
||||
if (from.asStringUriOnly().equals(sipUri)) {
|
||||
if (message.getText() != null) {
|
||||
adapter.refreshHistory();
|
||||
adapter.notifyDataSetChanged();
|
||||
} else if (message.getExternalBodyUrl() != null) {
|
||||
adapter.refreshHistory();
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
scrollToEnd();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void isComposingReceived(LinphoneCore lc, LinphoneChatRoom room) {
|
||||
if (chatRoom != null && room != null && chatRoom.getPeerAddress().asStringUriOnly().equals(room.getPeerAddress().asStringUriOnly())) {
|
||||
remoteComposing.setVisibility(chatRoom.isRemoteComposing() ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
textWatcher = new TextWatcher() {
|
||||
public void afterTextChanged(Editable arg0) {}
|
||||
|
@ -531,7 +555,7 @@ public class ChatActivity extends FragmentActivity implements OnClickListener, L
|
|||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(this);
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
||||
getIntent().putExtra("MessageDraft", message.getText());
|
||||
|
@ -548,8 +572,11 @@ public class ChatActivity extends FragmentActivity implements OnClickListener, L
|
|||
super.onResume();
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
|
||||
|
||||
|
||||
if (lc != null) {
|
||||
lc.addListener(this);
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
|
||||
if (LinphoneActivity.isInstanciated()) {
|
||||
|
@ -681,20 +708,7 @@ public class ChatActivity extends FragmentActivity implements OnClickListener, L
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
|
||||
LinphoneAddress from = cr.getPeerAddress();
|
||||
if (from.asStringUriOnly().equals(sipUri)) {
|
||||
if (message.getText() != null) {
|
||||
adapter.refreshHistory();
|
||||
adapter.notifyDataSetChanged();
|
||||
} else if (message.getExternalBodyUrl() != null) {
|
||||
adapter.refreshHistory();
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
scrollToEnd();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public synchronized void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, LinphoneChatMessage.State state) {
|
||||
|
@ -1077,12 +1091,5 @@ public class ChatActivity extends FragmentActivity implements OnClickListener, L
|
|||
LARGE,
|
||||
REAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void isComposingReceived(LinphoneCore lc, LinphoneChatRoom room) {
|
||||
if (chatRoom != null && room != null && chatRoom.getPeerAddress().asStringUriOnly().equals(room.getPeerAddress().asStringUriOnly())) {
|
||||
remoteComposing.setVisibility(chatRoom.isRemoteComposing() ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@ import org.linphone.core.LinphoneCallParams;
|
|||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneCoreListener.LinphoneCallEncryptionStateListener;
|
||||
import org.linphone.core.LinphoneCoreListener.LinphoneCallStateListener;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphonePlayer;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||
|
@ -70,7 +69,7 @@ import android.widget.Toast;
|
|||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class InCallActivity extends FragmentActivity implements LinphoneCallStateListener, LinphoneCallEncryptionStateListener, OnClickListener {
|
||||
public class InCallActivity extends FragmentActivity implements OnClickListener {
|
||||
private final static int SECONDS_BEFORE_HIDING_CONTROLS = 3000;
|
||||
private final static int SECONDS_BEFORE_DENYING_CALL_UPDATE = 30000;
|
||||
|
||||
|
@ -99,6 +98,7 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
|||
private ViewGroup container;
|
||||
private boolean isConferenceRunning = false;
|
||||
private boolean showCallListInVideo = false;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
|
||||
public static InCallActivity instance() {
|
||||
return instance;
|
||||
|
@ -123,6 +123,100 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
|||
isAnimationDisabled = getApplicationContext().getResources().getBoolean(R.bool.disable_animations) || !LinphonePreferences.instance().areAnimationsEnabled();
|
||||
cameraNumber = AndroidCameraConfiguration.retrieveCameras().length;
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
@Override
|
||||
public void callState(LinphoneCore lc, final LinphoneCall call, LinphoneCall.State state, String message) {
|
||||
if (LinphoneManager.getLc().getCallsNb() == 0) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!LinphonePreferences.instance().isVideoEnabled()){
|
||||
video.setEnabled(true);
|
||||
}
|
||||
|
||||
if (state == State.IncomingReceived) {
|
||||
startIncomingCallActivity();
|
||||
return;
|
||||
}
|
||||
|
||||
if (state == State.Paused || state == State.PausedByRemote || state == State.Pausing) {
|
||||
video.setEnabled(false);
|
||||
if(isVideoEnabled(call)){
|
||||
showAudioView();
|
||||
}
|
||||
}
|
||||
|
||||
if (state == State.Resuming) {
|
||||
if(LinphonePreferences.instance().isVideoEnabled()){
|
||||
status.refreshStatusItems(call, isVideoEnabled(call));
|
||||
if(call.getCurrentParamsCopy().getVideoEnabled()){
|
||||
showVideoView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state == State.StreamsRunning) {
|
||||
switchVideo(isVideoEnabled(call));
|
||||
|
||||
LinphoneManager.getLc().enableSpeaker(isSpeakerEnabled);
|
||||
|
||||
isMicMuted = LinphoneManager.getLc().isMicMuted();
|
||||
enableAndRefreshInCallActions();
|
||||
|
||||
if (status != null) {
|
||||
videoProgress.setVisibility(View.GONE);
|
||||
status.refreshStatusItems(call, isVideoEnabled(call));
|
||||
}
|
||||
}
|
||||
|
||||
refreshInCallActions();
|
||||
|
||||
refreshCallList(getResources());
|
||||
|
||||
if (state == State.CallUpdatedByRemote) {
|
||||
// If the correspondent proposes video while audio call
|
||||
boolean videoEnabled = LinphonePreferences.instance().isVideoEnabled();
|
||||
if (!videoEnabled) {
|
||||
acceptCallUpdate(false);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean remoteVideo = call.getRemoteParams().getVideoEnabled();
|
||||
boolean localVideo = call.getCurrentParamsCopy().getVideoEnabled();
|
||||
boolean autoAcceptCameraPolicy = LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests();
|
||||
if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) {
|
||||
showAcceptCallUpdateDialog();
|
||||
|
||||
timer = new CountDownTimer(SECONDS_BEFORE_DENYING_CALL_UPDATE, 1000) {
|
||||
public void onTick(long millisUntilFinished) { }
|
||||
public void onFinish() {
|
||||
acceptCallUpdate(false);
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
// else if (remoteVideo && !LinphoneManager.getLc().isInConference() && autoAcceptCameraPolicy) {
|
||||
// mHandler.post(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// acceptCallUpdate(true);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
transfer.setEnabled(LinphoneManager.getLc().getCurrentCall() != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callEncryptionChanged(LinphoneCore lc, final LinphoneCall call, boolean encrypted, String authenticationToken) {
|
||||
if (status != null) {
|
||||
status.refreshStatusItems(call, call.getCurrentParamsCopy().getVideoEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
if (findViewById(R.id.fragmentContainer) != null) {
|
||||
initUI();
|
||||
|
||||
|
@ -1039,89 +1133,7 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
|||
startActivity(new Intent(this, IncomingCallActivity.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callState(LinphoneCore lc, final LinphoneCall call, LinphoneCall.State state, String message) {
|
||||
if (LinphoneManager.getLc().getCallsNb() == 0) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!LinphonePreferences.instance().isVideoEnabled()){
|
||||
video.setEnabled(true);
|
||||
}
|
||||
|
||||
if (state == State.IncomingReceived) {
|
||||
startIncomingCallActivity();
|
||||
return;
|
||||
}
|
||||
|
||||
if (state == State.Paused || state == State.PausedByRemote || state == State.Pausing) {
|
||||
video.setEnabled(false);
|
||||
if(isVideoEnabled(call)){
|
||||
showAudioView();
|
||||
}
|
||||
}
|
||||
|
||||
if (state == State.Resuming) {
|
||||
if(LinphonePreferences.instance().isVideoEnabled()){
|
||||
status.refreshStatusItems(call, isVideoEnabled(call));
|
||||
if(call.getCurrentParamsCopy().getVideoEnabled()){
|
||||
showVideoView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state == State.StreamsRunning) {
|
||||
switchVideo(isVideoEnabled(call));
|
||||
|
||||
LinphoneManager.getLc().enableSpeaker(isSpeakerEnabled);
|
||||
|
||||
isMicMuted = LinphoneManager.getLc().isMicMuted();
|
||||
enableAndRefreshInCallActions();
|
||||
|
||||
if (status != null) {
|
||||
videoProgress.setVisibility(View.GONE);
|
||||
status.refreshStatusItems(call, isVideoEnabled(call));
|
||||
}
|
||||
}
|
||||
|
||||
refreshInCallActions();
|
||||
|
||||
refreshCallList(getResources());
|
||||
|
||||
if (state == State.CallUpdatedByRemote) {
|
||||
// If the correspondent proposes video while audio call
|
||||
boolean videoEnabled = LinphonePreferences.instance().isVideoEnabled();
|
||||
if (!videoEnabled) {
|
||||
acceptCallUpdate(false);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean remoteVideo = call.getRemoteParams().getVideoEnabled();
|
||||
boolean localVideo = call.getCurrentParamsCopy().getVideoEnabled();
|
||||
boolean autoAcceptCameraPolicy = LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests();
|
||||
if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) {
|
||||
showAcceptCallUpdateDialog();
|
||||
|
||||
timer = new CountDownTimer(SECONDS_BEFORE_DENYING_CALL_UPDATE, 1000) {
|
||||
public void onTick(long millisUntilFinished) { }
|
||||
public void onFinish() {
|
||||
acceptCallUpdate(false);
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
// else if (remoteVideo && !LinphoneManager.getLc().isInConference() && autoAcceptCameraPolicy) {
|
||||
// mHandler.post(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// acceptCallUpdate(true);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
transfer.setEnabled(LinphoneManager.getLc().getCurrentCall() != null);
|
||||
}
|
||||
|
||||
|
||||
private void showAcceptCallUpdateDialog() {
|
||||
FragmentManager fm = getSupportFragmentManager();
|
||||
|
@ -1129,13 +1141,6 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
|||
callUpdateDialog.show(fm, "Accept Call Update Dialog");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callEncryptionChanged(LinphoneCore lc, final LinphoneCall call, boolean encrypted, String authenticationToken) {
|
||||
if (status != null) {
|
||||
status.refreshStatusItems(call, call.getCurrentParamsCopy().getVideoEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
instance = this;
|
||||
|
@ -1151,7 +1156,7 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
|||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(this);
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
|
||||
refreshCallList(getResources());
|
||||
|
@ -1195,7 +1200,7 @@ public class InCallActivity extends FragmentActivity implements LinphoneCallStat
|
|||
protected void onPause() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(this);
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
||||
super.onPause();
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.linphone.core.LinphoneCall;
|
|||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCallParams;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreListener.LinphoneCallStateListener;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.ui.AvatarWithShadow;
|
||||
import org.linphone.ui.LinphoneSliders;
|
||||
|
@ -45,7 +45,7 @@ import android.widget.Toast;
|
|||
*
|
||||
* @author Guillaume Beraudo
|
||||
*/
|
||||
public class IncomingCallActivity extends Activity implements LinphoneCallStateListener, LinphoneSliderTriggered {
|
||||
public class IncomingCallActivity extends Activity implements LinphoneSliderTriggered {
|
||||
|
||||
private static IncomingCallActivity instance;
|
||||
|
||||
|
@ -54,6 +54,7 @@ public class IncomingCallActivity extends Activity implements LinphoneCallStateL
|
|||
private AvatarWithShadow mPictureView;
|
||||
private LinphoneCall mCall;
|
||||
private LinphoneSliders mIncomingCallWidget;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
|
||||
public static IncomingCallActivity instance() {
|
||||
return instance;
|
||||
|
@ -79,6 +80,19 @@ public class IncomingCallActivity extends Activity implements LinphoneCallStateL
|
|||
// "Dial-to-answer" widget for incoming calls.
|
||||
mIncomingCallWidget = (LinphoneSliders) findViewById(R.id.sliding_widget);
|
||||
mIncomingCallWidget.setOnTriggerListener(this);
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
@Override
|
||||
public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) {
|
||||
if (call == mCall && State.CallEnd == state) {
|
||||
finish();
|
||||
}
|
||||
if (state == State.StreamsRunning) {
|
||||
// The following should not be needed except some devices need it (e.g. Galaxy S).
|
||||
LinphoneManager.getLc().enableSpeaker(LinphoneManager.getLc().isSpeakerEnabled());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
instance = this;
|
||||
|
@ -90,7 +104,7 @@ public class IncomingCallActivity extends Activity implements LinphoneCallStateL
|
|||
instance = this;
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(this);
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
|
||||
// Only one call ringing at a time is allowed
|
||||
|
@ -126,7 +140,7 @@ public class IncomingCallActivity extends Activity implements LinphoneCallStateL
|
|||
protected void onPause() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(this);
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
@ -146,16 +160,7 @@ public class IncomingCallActivity extends Activity implements LinphoneCallStateL
|
|||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) {
|
||||
if (call == mCall && State.CallEnd == state) {
|
||||
finish();
|
||||
}
|
||||
if (state == State.StreamsRunning) {
|
||||
// The following should not be needed except some devices need it (e.g. Galaxy S).
|
||||
LinphoneManager.getLc().enableSpeaker(LinphoneManager.getLc().isSpeakerEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void decline() {
|
||||
LinphoneManager.getLc().terminateCall(mCall);
|
||||
|
|
|
@ -41,9 +41,7 @@ import org.linphone.core.LinphoneCore;
|
|||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneCoreListener.LinphoneCallStateListener;
|
||||
import org.linphone.core.LinphoneCoreListener.LinphoneMessageListener;
|
||||
import org.linphone.core.LinphoneCoreListener.LinphoneRegistrationStateListener;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
@ -88,7 +86,7 @@ import android.widget.Toast;
|
|||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class LinphoneActivity extends FragmentActivity implements OnClickListener, ContactPicked, LinphoneCallStateListener, LinphoneMessageListener, LinphoneRegistrationStateListener {
|
||||
public class LinphoneActivity extends FragmentActivity implements OnClickListener, ContactPicked {
|
||||
public static final String PREF_FIRST_LAUNCH = "pref_first_launch";
|
||||
private static final int SETTINGS_ACTIVITY = 123;
|
||||
private static final int FIRST_LOGIN_ACTIVITY = 101;
|
||||
|
@ -111,6 +109,7 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
|||
private List<Contact> contactList, sipContactList;
|
||||
private Cursor contactCursor, sipContactCursor;
|
||||
private OrientationEventListener mOrientationHelper;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
|
||||
static final boolean isInstanciated() {
|
||||
return instance != null;
|
||||
|
@ -169,6 +168,53 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
|||
selectMenu(FragmentsAvailable.DIALER);
|
||||
}
|
||||
}
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
@Override
|
||||
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
|
||||
displayMissedChats(getChatStorage().getUnreadMessageCount());
|
||||
if (messageListFragment != null && messageListFragment.isVisible()) {
|
||||
((ChatListFragment) messageListFragment).refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig proxy, LinphoneCore.RegistrationState state, String smessage) {
|
||||
if (state.equals(RegistrationState.RegistrationCleared)) {
|
||||
if (lc != null) {
|
||||
LinphoneAuthInfo authInfo = lc.findAuthInfo(proxy.getIdentity(), proxy.getRealm(), proxy.getDomain());
|
||||
if (authInfo != null)
|
||||
lc.removeAuthInfo(authInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) {
|
||||
if (state == State.IncomingReceived) {
|
||||
startActivity(new Intent(LinphoneActivity.instance(), IncomingCallActivity.class));
|
||||
} else if (state == State.OutgoingInit) {
|
||||
if (call.getCurrentParamsCopy().getVideoEnabled()) {
|
||||
startVideoActivity(call);
|
||||
} else {
|
||||
startIncallActivity(call);
|
||||
}
|
||||
} else if (state == State.CallEnd || state == State.Error || state == State.CallReleased) {
|
||||
// Convert LinphoneCore message for internalization
|
||||
if (message != null && message.equals("Call declined.")) {
|
||||
displayCustomToast(getString(R.string.error_call_declined), Toast.LENGTH_LONG);
|
||||
} else if (message != null && message.equals("Not Found")) {
|
||||
displayCustomToast(getString(R.string.error_user_not_found), Toast.LENGTH_LONG);
|
||||
} else if (message != null && message.equals("Unsupported media type")) {
|
||||
displayCustomToast(getString(R.string.error_incompatible_media), Toast.LENGTH_LONG);
|
||||
}
|
||||
resetClassicMenuLayoutAndGoBackToCallIfStillRunning();
|
||||
}
|
||||
|
||||
int missedCalls = LinphoneManager.getLc().getMissedCallsCount();
|
||||
displayMissedCalls(missedCalls);
|
||||
}
|
||||
};
|
||||
|
||||
int missedCalls = LinphoneManager.getLc().getMissedCallsCount();
|
||||
displayMissedCalls(missedCalls);
|
||||
|
@ -711,13 +757,7 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
|||
getChatStorage().deleteDraft(sipUri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
|
||||
displayMissedChats(getChatStorage().getUnreadMessageCount());
|
||||
if (messageListFragment != null && messageListFragment.isVisible()) {
|
||||
((ChatListFragment) messageListFragment).refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void updateMissedChatCount() {
|
||||
displayMissedChats(getChatStorage().getUnreadMessageCount());
|
||||
|
@ -741,17 +781,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
|||
getChatStorage().updateMessageStatus(to, id, newState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig proxy, LinphoneCore.RegistrationState state, String smessage) {
|
||||
if (state.equals(RegistrationState.RegistrationCleared)) {
|
||||
if (lc != null) {
|
||||
LinphoneAuthInfo authInfo = lc.findAuthInfo(proxy.getIdentity(), proxy.getRealm(), proxy.getDomain());
|
||||
if (authInfo != null)
|
||||
lc.removeAuthInfo(authInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void displayMissedCalls(final int missedCallsCount) {
|
||||
if (missedCallsCount > 0) {
|
||||
missedCalls.setText(missedCallsCount + "");
|
||||
|
@ -783,32 +812,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) {
|
||||
if (state == State.IncomingReceived) {
|
||||
startActivity(new Intent(this, IncomingCallActivity.class));
|
||||
} else if (state == State.OutgoingInit) {
|
||||
if (call.getCurrentParamsCopy().getVideoEnabled()) {
|
||||
startVideoActivity(call);
|
||||
} else {
|
||||
startIncallActivity(call);
|
||||
}
|
||||
} else if (state == State.CallEnd || state == State.Error || state == State.CallReleased) {
|
||||
// Convert LinphoneCore message for internalization
|
||||
if (message != null && message.equals("Call declined.")) {
|
||||
displayCustomToast(getString(R.string.error_call_declined), Toast.LENGTH_LONG);
|
||||
} else if (message != null && message.equals("Not Found")) {
|
||||
displayCustomToast(getString(R.string.error_user_not_found), Toast.LENGTH_LONG);
|
||||
} else if (message != null && message.equals("Unsupported media type")) {
|
||||
displayCustomToast(getString(R.string.error_incompatible_media), Toast.LENGTH_LONG);
|
||||
}
|
||||
resetClassicMenuLayoutAndGoBackToCallIfStillRunning();
|
||||
}
|
||||
|
||||
int missedCalls = LinphoneManager.getLc().getMissedCallsCount();
|
||||
displayMissedCalls(missedCalls);
|
||||
}
|
||||
|
||||
public void displayCustomToast(final String message, final int duration) {
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
View layout = inflater.inflate(R.layout.toast, (ViewGroup) findViewById(R.id.toastRoot));
|
||||
|
@ -1209,7 +1212,7 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
|||
protected void onPause() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(this);
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
||||
getIntent().putExtra("PreviousActivity", 0);
|
||||
|
@ -1226,7 +1229,7 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
|||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(this);
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
|
||||
prepareContactsInBackground();
|
||||
|
|
|
@ -53,7 +53,6 @@ import org.linphone.core.LinphoneCoreException;
|
|||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneCoreFactoryImpl;
|
||||
import org.linphone.core.LinphoneCoreListener;
|
||||
import org.linphone.core.LinphoneCoreListener.LinphoneListener;
|
||||
import org.linphone.core.LinphoneEvent;
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
import org.linphone.core.LinphoneInfoMessage;
|
||||
|
@ -118,7 +117,7 @@ import android.widget.Toast;
|
|||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class LinphoneManager implements LinphoneListener {
|
||||
public class LinphoneManager implements LinphoneCoreListener {
|
||||
|
||||
private static LinphoneManager instance;
|
||||
private Context mServiceContext;
|
||||
|
@ -448,7 +447,6 @@ public class LinphoneManager implements LinphoneListener {
|
|||
LinphoneCoreFactory.instance().setDebugMode(isDebugLogEnabled, getString(R.string.app_name));
|
||||
|
||||
mLc = LinphoneCoreFactory.instance().createLinphoneCore(this, mLinphoneConfigFile, mLinphoneFactoryConfigFile, null, c);
|
||||
mLc.addListener((LinphoneCoreListener) c);
|
||||
|
||||
try {
|
||||
initLiblinphone();
|
||||
|
@ -897,7 +895,7 @@ public class LinphoneManager implements LinphoneListener {
|
|||
boolean encrypted, String authenticationToken) {
|
||||
}
|
||||
|
||||
public void startEcCalibration(LinphoneEchoCalibrationListener l) throws LinphoneCoreException {
|
||||
public void startEcCalibration(LinphoneCoreListener l) throws LinphoneCoreException {
|
||||
routeAudioToSpeaker();
|
||||
int oldVolume = mAudioManager.getStreamVolume(STREAM_VOICE_CALL);
|
||||
int maxVolume = mAudioManager.getStreamMaxVolume(STREAM_VOICE_CALL);
|
||||
|
@ -1285,4 +1283,11 @@ public class LinphoneManager implements LinphoneListener {
|
|||
LogCollectionUploadState state, String info) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,
|
||||
int delay_ms, Object data) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,9 +31,7 @@ import org.linphone.core.LinphoneCore.RegistrationState;
|
|||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactoryImpl;
|
||||
import org.linphone.core.LinphoneCoreImpl;
|
||||
import org.linphone.core.LinphoneCoreListener.LinphoneCallStateListener;
|
||||
import org.linphone.core.LinphoneCoreListener.LinphoneGlobalStateListener;
|
||||
import org.linphone.core.LinphoneCoreListener.LinphoneRegistrationStateListener;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.mediastream.Version;
|
||||
|
@ -74,8 +72,7 @@ import android.provider.MediaStore;
|
|||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public final class LinphoneService extends Service implements LinphoneCallStateListener,
|
||||
LinphoneGlobalStateListener, LinphoneRegistrationStateListener {
|
||||
public final class LinphoneService extends Service {
|
||||
/* Listener needs to be implemented in the Service as it calls
|
||||
* setLatestEventInfo and startActivity() which needs a context.
|
||||
*/
|
||||
|
@ -122,6 +119,7 @@ public final class LinphoneService extends Service implements LinphoneCallStateL
|
|||
private PendingIntent mkeepAlivePendingIntent;
|
||||
private String mNotificationTitle;
|
||||
private boolean mDisableRegistrationStatus;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
|
||||
public int getMessageNotifCount() {
|
||||
return mMsgNotifCount;
|
||||
|
@ -170,6 +168,80 @@ public final class LinphoneService extends Service implements LinphoneCallStateL
|
|||
}
|
||||
instance = this; // instance is ready once linphone manager has been created
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
|
||||
@Override
|
||||
public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) {
|
||||
if (instance == null) {
|
||||
Log.i("Service not ready, discarding call state change to ",state.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
if (state == LinphoneCall.State.IncomingReceived) {
|
||||
onIncomingReceived();
|
||||
}
|
||||
|
||||
if (state == State.CallUpdatedByRemote) {
|
||||
// If the correspondent proposes video while audio call
|
||||
boolean remoteVideo = call.getRemoteParams().getVideoEnabled();
|
||||
boolean localVideo = call.getCurrentParamsCopy().getVideoEnabled();
|
||||
boolean autoAcceptCameraPolicy = LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests();
|
||||
if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) {
|
||||
try {
|
||||
LinphoneManager.getLc().deferCallUpdate(call);
|
||||
} catch (LinphoneCoreException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state == State.StreamsRunning) {
|
||||
// Workaround bug current call seems to be updated after state changed to streams running
|
||||
if (getResources().getBoolean(R.bool.enable_call_notification))
|
||||
refreshIncallIcon(call);
|
||||
if (Version.sdkAboveOrEqual(Version.API12_HONEYCOMB_MR1_31X)) {
|
||||
mWifiLock.acquire();
|
||||
}
|
||||
} else {
|
||||
if (getResources().getBoolean(R.bool.enable_call_notification))
|
||||
refreshIncallIcon(LinphoneManager.getLc().getCurrentCall());
|
||||
}
|
||||
if ((state == State.CallEnd || state == State.Error) && LinphoneManager.getLc().getCallsNb() < 1) {
|
||||
if (Version.sdkAboveOrEqual(Version.API12_HONEYCOMB_MR1_31X)) {
|
||||
mWifiLock.release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void globalState(LinphoneCore lc,LinphoneCore.GlobalState state, String message) {
|
||||
if (state == GlobalState.GlobalOn) {
|
||||
sendNotification(IC_LEVEL_OFFLINE, R.string.notification_started);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState state, String smessage) {
|
||||
// if (instance == null) {
|
||||
// Log.i("Service not ready, discarding registration state change to ",state.toString());
|
||||
// return;
|
||||
// }
|
||||
if (!mDisableRegistrationStatus) {
|
||||
if (state == RegistrationState.RegistrationOk && LinphoneManager.getLc().getDefaultProxyConfig() != null && LinphoneManager.getLc().getDefaultProxyConfig().isRegistered()) {
|
||||
sendNotification(IC_LEVEL_ORANGE, R.string.notification_registered);
|
||||
}
|
||||
|
||||
if ((state == RegistrationState.RegistrationFailed || state == RegistrationState.RegistrationCleared) && (LinphoneManager.getLc().getDefaultProxyConfig() == null || !LinphoneManager.getLc().getDefaultProxyConfig().isRegistered())) {
|
||||
sendNotification(IC_LEVEL_OFFLINE, R.string.notification_register_failure);
|
||||
}
|
||||
|
||||
if (state == RegistrationState.RegistrationNone) {
|
||||
sendNotification(IC_LEVEL_OFFLINE, R.string.notification_started);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Retrieve methods to publish notification and keep Android
|
||||
// from killing us and keep the audio quality high.
|
||||
if (Version.sdkStrictlyBelow(Version.API05_ECLAIR_20)) {
|
||||
|
@ -490,7 +562,7 @@ public final class LinphoneService extends Service implements LinphoneCallStateL
|
|||
public synchronized void onDestroy() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(this);
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
||||
instance = null;
|
||||
|
@ -507,34 +579,6 @@ public final class LinphoneService extends Service implements LinphoneCallStateL
|
|||
((AlarmManager) this.getSystemService(Context.ALARM_SERVICE)).cancel(mkeepAlivePendingIntent);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void globalState(LinphoneCore lc,LinphoneCore.GlobalState state, String message) {
|
||||
if (state == GlobalState.GlobalOn) {
|
||||
sendNotification(IC_LEVEL_OFFLINE, R.string.notification_started);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState state, String smessage) {
|
||||
// if (instance == null) {
|
||||
// Log.i("Service not ready, discarding registration state change to ",state.toString());
|
||||
// return;
|
||||
// }
|
||||
if (!mDisableRegistrationStatus) {
|
||||
if (state == RegistrationState.RegistrationOk && LinphoneManager.getLc().getDefaultProxyConfig() != null && LinphoneManager.getLc().getDefaultProxyConfig().isRegistered()) {
|
||||
sendNotification(IC_LEVEL_ORANGE, R.string.notification_registered);
|
||||
}
|
||||
|
||||
if ((state == RegistrationState.RegistrationFailed || state == RegistrationState.RegistrationCleared) && (LinphoneManager.getLc().getDefaultProxyConfig() == null || !LinphoneManager.getLc().getDefaultProxyConfig().isRegistered())) {
|
||||
sendNotification(IC_LEVEL_OFFLINE, R.string.notification_register_failure);
|
||||
}
|
||||
|
||||
if (state == RegistrationState.RegistrationNone) {
|
||||
sendNotification(IC_LEVEL_OFFLINE, R.string.notification_started);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setActivityToLaunchOnIncomingReceived(Class<? extends Activity> activity) {
|
||||
incomingReceivedActivity = activity;
|
||||
|
@ -558,48 +602,6 @@ public final class LinphoneService extends Service implements LinphoneCallStateL
|
|||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) {
|
||||
if (instance == null) {
|
||||
Log.i("Service not ready, discarding call state change to ",state.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
if (state == LinphoneCall.State.IncomingReceived) {
|
||||
onIncomingReceived();
|
||||
}
|
||||
|
||||
if (state == State.CallUpdatedByRemote) {
|
||||
// If the correspondent proposes video while audio call
|
||||
boolean remoteVideo = call.getRemoteParams().getVideoEnabled();
|
||||
boolean localVideo = call.getCurrentParamsCopy().getVideoEnabled();
|
||||
boolean autoAcceptCameraPolicy = LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests();
|
||||
if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) {
|
||||
try {
|
||||
LinphoneManager.getLc().deferCallUpdate(call);
|
||||
} catch (LinphoneCoreException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state == State.StreamsRunning) {
|
||||
// Workaround bug current call seems to be updated after state changed to streams running
|
||||
if (getResources().getBoolean(R.bool.enable_call_notification))
|
||||
refreshIncallIcon(call);
|
||||
if (Version.sdkAboveOrEqual(Version.API12_HONEYCOMB_MR1_31X)) {
|
||||
mWifiLock.acquire();
|
||||
}
|
||||
} else {
|
||||
if (getResources().getBoolean(R.bool.enable_call_notification))
|
||||
refreshIncallIcon(LinphoneManager.getLc().getCurrentCall());
|
||||
}
|
||||
if ((state == State.CallEnd || state == State.Error) && LinphoneManager.getLc().getCallsNb() < 1) {
|
||||
if (Version.sdkAboveOrEqual(Version.API12_HONEYCOMB_MR1_31X)) {
|
||||
mWifiLock.release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void tryingNewOutgoingCallButAlreadyInCall() {
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
|||
import org.linphone.core.LinphoneCore.MediaEncryption;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneCoreListener.LinphoneEchoCalibrationListener;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.PayloadType;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
@ -54,10 +54,11 @@ import android.preference.PreferenceScreen;
|
|||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class SettingsFragment extends PreferencesListFragment implements LinphoneEchoCalibrationListener {
|
||||
public class SettingsFragment extends PreferencesListFragment {
|
||||
private static final int WIZARD_INTENT = 1;
|
||||
private LinphonePreferences mPrefs;
|
||||
private Handler mHandler = new Handler();
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
|
||||
public SettingsFragment() {
|
||||
super(R.xml.preferences);
|
||||
|
@ -72,6 +73,30 @@ public class SettingsFragment extends PreferencesListFragment implements Linphon
|
|||
initSettings();
|
||||
setListeners();
|
||||
hideSettings();
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
@Override
|
||||
public void ecCalibrationStatus(LinphoneCore lc, final EcCalibratorStatus status, final int delayMs, Object data) {
|
||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||
|
||||
CheckBoxPreference echoCancellation = (CheckBoxPreference) findPreference(getString(R.string.pref_echo_cancellation_key));
|
||||
Preference echoCancellerCalibration = findPreference(getString(R.string.pref_echo_canceller_calibration_key));
|
||||
|
||||
if (status == EcCalibratorStatus.DoneNoEcho) {
|
||||
echoCancellerCalibration.setSummary(R.string.no_echo);
|
||||
echoCancellation.setChecked(false);
|
||||
LinphonePreferences.instance().setEchoCancellation(false);
|
||||
} else if (status == EcCalibratorStatus.Done) {
|
||||
echoCancellerCalibration.setSummary(String.format(getString(R.string.ec_calibrated), delayMs));
|
||||
echoCancellation.setChecked(true);
|
||||
LinphonePreferences.instance().setEchoCancellation(true);
|
||||
} else if (status == EcCalibratorStatus.Failed) {
|
||||
echoCancellerCalibration.setSummary(R.string.failed);
|
||||
echoCancellation.setChecked(true);
|
||||
LinphonePreferences.instance().setEchoCancellation(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Inits the values or the listener on some settings
|
||||
|
@ -531,7 +556,7 @@ public class SettingsFragment extends PreferencesListFragment implements Linphon
|
|||
public boolean onPreferenceClick(Preference preference) {
|
||||
synchronized (SettingsFragment.this) {
|
||||
try {
|
||||
LinphoneManager.getInstance().startEcCalibration(SettingsFragment.this);
|
||||
LinphoneManager.getInstance().startEcCalibration(mListener);
|
||||
preference.setSummary(R.string.ec_calibrating);
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.w(e, "Cannot calibrate EC");
|
||||
|
@ -924,29 +949,7 @@ public class SettingsFragment extends PreferencesListFragment implements Linphon
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ecCalibrationStatus(LinphoneCore lc, final EcCalibratorStatus status, final int delayMs, Object data) {
|
||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||
|
||||
CheckBoxPreference echoCancellation = (CheckBoxPreference) findPreference(getString(R.string.pref_echo_cancellation_key));
|
||||
Preference echoCancellerCalibration = findPreference(getString(R.string.pref_echo_canceller_calibration_key));
|
||||
|
||||
if (status == EcCalibratorStatus.DoneNoEcho) {
|
||||
echoCancellerCalibration.setSummary(R.string.no_echo);
|
||||
echoCancellation.setChecked(false);
|
||||
LinphonePreferences.instance().setEchoCancellation(false);
|
||||
} else if (status == EcCalibratorStatus.Done) {
|
||||
echoCancellerCalibration.setSummary(String.format(getString(R.string.ec_calibrated), delayMs));
|
||||
echoCancellation.setChecked(true);
|
||||
LinphonePreferences.instance().setEchoCancellation(true);
|
||||
} else if (status == EcCalibratorStatus.Failed) {
|
||||
echoCancellerCalibration.setSummary(R.string.failed);
|
||||
echoCancellation.setChecked(true);
|
||||
LinphonePreferences.instance().setEchoCancellation(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
|
|
@ -29,8 +29,7 @@ import org.linphone.core.LinphoneContent;
|
|||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCore.MediaEncryption;
|
||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
import org.linphone.core.LinphoneCoreListener.LinphoneNotifyListener;
|
||||
import org.linphone.core.LinphoneCoreListener.LinphoneRegistrationStateListener;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphoneEvent;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.PayloadType;
|
||||
|
@ -59,7 +58,7 @@ import android.widget.TextView;
|
|||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class StatusFragment extends Fragment implements LinphoneNotifyListener, LinphoneRegistrationStateListener {
|
||||
public class StatusFragment extends Fragment {
|
||||
private Handler mHandler = new Handler();
|
||||
private Handler refreshHandler = new Handler();
|
||||
private TextView statusText, exit, voicemailCount;
|
||||
|
@ -72,6 +71,7 @@ public class StatusFragment extends Fragment implements LinphoneNotifyListener,
|
|||
private boolean isInCall, isAttached = false;
|
||||
private Timer mTimer;
|
||||
private TimerTask mTask;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
|
@ -113,13 +113,64 @@ public class StatusFragment extends Fragment implements LinphoneNotifyListener,
|
|||
// We create it once to not delay the first display
|
||||
populateSliderContent();
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
@Override
|
||||
public void registrationState(final LinphoneCore lc, LinphoneProxyConfig proxy, final LinphoneCore.RegistrationState state, String smessage) {
|
||||
if (!isAttached || !LinphoneService.isReady()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
statusLed.setImageResource(getStatusIconResource(state, true));
|
||||
statusText.setText(getStatusIconText(state));
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
if (getResources().getBoolean(R.bool.lock_statusbar)) {
|
||||
statusText.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
lc.refreshRegisters();
|
||||
}
|
||||
});
|
||||
}
|
||||
// setMiniLedsForEachAccount();
|
||||
populateSliderContent();
|
||||
sliderContentAccounts.invalidate();
|
||||
} catch (IllegalStateException ise) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyReceived(LinphoneCore lc, LinphoneEvent ev, String eventName, LinphoneContent content) {
|
||||
|
||||
if(!content.getType().equals("application")) return;
|
||||
if(!content.getSubtype().equals("imple-message-summary")) return;
|
||||
|
||||
if (content.getData() == null) return;
|
||||
|
||||
//TODO Parse
|
||||
int unreadCount = -1;
|
||||
|
||||
if (unreadCount > 0) {
|
||||
voicemailCount.setText(unreadCount + " unread messages");
|
||||
voicemailCount.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
voicemailCount.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(this);
|
||||
lc.addListener(mListener);
|
||||
|
||||
LinphoneProxyConfig lpc = lc.getDefaultProxyConfig();
|
||||
if (lpc != null) {
|
||||
registrationState(lc, lpc, lpc.getState(), null);
|
||||
mListener.registrationState(lc, lpc, lpc.getState(), null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,35 +244,6 @@ public class StatusFragment extends Fragment implements LinphoneNotifyListener,
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registrationState(final LinphoneCore lc, LinphoneProxyConfig proxy, final LinphoneCore.RegistrationState state, String smessage) {
|
||||
if (!isAttached || !LinphoneService.isReady()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
statusLed.setImageResource(getStatusIconResource(state, true));
|
||||
statusText.setText(getStatusIconText(state));
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
if (getResources().getBoolean(R.bool.lock_statusbar)) {
|
||||
statusText.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
lc.refreshRegisters();
|
||||
}
|
||||
});
|
||||
}
|
||||
// setMiniLedsForEachAccount();
|
||||
populateSliderContent();
|
||||
sliderContentAccounts.invalidate();
|
||||
} catch (IllegalStateException ise) {}
|
||||
}
|
||||
|
||||
// private void setMiniLedsForEachAccount() {
|
||||
// if (allAccountsLed == null)
|
||||
// return;
|
||||
|
@ -381,7 +403,7 @@ public class StatusFragment extends Fragment implements LinphoneNotifyListener,
|
|||
public void onDestroy() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(this);
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
||||
super.onDestroy();
|
||||
|
@ -495,7 +517,7 @@ public class StatusFragment extends Fragment implements LinphoneNotifyListener,
|
|||
ice.setText(videoStats.getIceState().toString());
|
||||
|
||||
videoResolutionLayout.setVisibility(View.VISIBLE);
|
||||
videoResolution.setText("↑ " + params.getSentVideoSize().toDisplayableString() + " / ↓ " + params.getReceivedVideoSize().toDisplayableString());
|
||||
videoResolution.setText("<EFBFBD><EFBFBD><EFBFBD> " + params.getSentVideoSize().toDisplayableString() + " / <EFBFBD><EFBFBD><EFBFBD> " + params.getReceivedVideoSize().toDisplayableString());
|
||||
}
|
||||
} else {
|
||||
final LinphoneCallStats audioStats = call.getAudioStats();
|
||||
|
@ -645,23 +667,5 @@ public class StatusFragment extends Fragment implements LinphoneNotifyListener,
|
|||
return view;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyReceived(LinphoneCore lc, LinphoneEvent ev, String eventName, LinphoneContent content) {
|
||||
|
||||
if(!content.getType().equals("application")) return;
|
||||
if(!content.getSubtype().equals("imple-message-summary")) return;
|
||||
|
||||
if (content.getData() == null) return;
|
||||
|
||||
//TODO Parse
|
||||
int unreadCount = -1;
|
||||
|
||||
if (unreadCount > 0) {
|
||||
voicemailCount.setText(unreadCount + " unread messages");
|
||||
voicemailCount.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
voicemailCount.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.linphone.R;
|
|||
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreListener.LinphoneEchoCalibrationListener;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.os.Build;
|
||||
|
@ -45,38 +45,43 @@ import de.timroes.axmlrpc.XMLRPCServerException;
|
|||
/**
|
||||
* @author Ghislain MARY
|
||||
*/
|
||||
public class EchoCancellerCalibrationFragment extends Fragment implements LinphoneEchoCalibrationListener {
|
||||
public class EchoCancellerCalibrationFragment extends Fragment {
|
||||
private Handler mHandler = new Handler();
|
||||
private boolean mSendEcCalibrationResult = false;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.setup_ec_calibration, container, false);
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
@Override
|
||||
public void ecCalibrationStatus(LinphoneCore lc,LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data) {
|
||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||
|
||||
if (status == EcCalibratorStatus.DoneNoEcho) {
|
||||
LinphonePreferences.instance().setEchoCancellation(false);
|
||||
} else if ((status == EcCalibratorStatus.Done) || (status == EcCalibratorStatus.Failed)) {
|
||||
LinphonePreferences.instance().setEchoCancellation(true);
|
||||
}
|
||||
if (mSendEcCalibrationResult) {
|
||||
sendEcCalibrationResult(status, delay_ms);
|
||||
} else {
|
||||
SetupActivity.instance().isEchoCalibrationFinished();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
LinphoneManager.getInstance().startEcCalibration(this);
|
||||
LinphoneManager.getInstance().startEcCalibration(mListener);
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e(e, "Unable to calibrate EC");
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ecCalibrationStatus(LinphoneCore lc,LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data) {
|
||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||
|
||||
if (status == EcCalibratorStatus.DoneNoEcho) {
|
||||
LinphonePreferences.instance().setEchoCancellation(false);
|
||||
} else if ((status == EcCalibratorStatus.Done) || (status == EcCalibratorStatus.Failed)) {
|
||||
LinphonePreferences.instance().setEchoCancellation(true);
|
||||
}
|
||||
if (mSendEcCalibrationResult) {
|
||||
sendEcCalibrationResult(status, delay_ms);
|
||||
} else {
|
||||
SetupActivity.instance().isEchoCalibrationFinished();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void enableEcCalibrationResultSending(boolean enabled) {
|
||||
mSendEcCalibrationResult = enabled;
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.linphone.LinphoneService;
|
|||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCore.RemoteProvisioningState;
|
||||
import org.linphone.core.LinphoneCoreListener.LinphoneRemoteProvisioningListener;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.app.Activity;
|
||||
|
@ -48,16 +48,29 @@ import android.widget.Toast;
|
|||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class RemoteProvisioningActivity extends Activity implements LinphoneRemoteProvisioningListener {
|
||||
public class RemoteProvisioningActivity extends Activity {
|
||||
private Handler mHandler = new Handler();
|
||||
private String configUriParam = null;
|
||||
private ProgressBar spinner;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.remote_provisioning);
|
||||
spinner = (ProgressBar) findViewById(R.id.spinner);
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
@Override
|
||||
public void configuringStatus(LinphoneCore lc, final RemoteProvisioningState state, String message) {
|
||||
if (spinner != null) spinner.setVisibility(View.GONE);
|
||||
if (state == RemoteProvisioningState.ConfiguringSuccessful) {
|
||||
goToLinphoneActivity();
|
||||
} else if (state == RemoteProvisioningState.ConfiguringFailed) {
|
||||
Toast.makeText(RemoteProvisioningActivity.this, R.string.remote_provisioning_failure, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -65,7 +78,7 @@ public class RemoteProvisioningActivity extends Activity implements LinphoneRemo
|
|||
super.onResume();
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(this);
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
LinphonePreferences.instance().setContext(this);
|
||||
|
||||
|
@ -76,20 +89,10 @@ public class RemoteProvisioningActivity extends Activity implements LinphoneRemo
|
|||
protected void onPause() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(this);
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configuringStatus(LinphoneCore lc, final RemoteProvisioningState state, String message) {
|
||||
if (spinner != null) spinner.setVisibility(View.GONE);
|
||||
if (state == RemoteProvisioningState.ConfiguringSuccessful) {
|
||||
goToLinphoneActivity();
|
||||
} else if (state == RemoteProvisioningState.ConfiguringFailed) {
|
||||
Toast.makeText(RemoteProvisioningActivity.this, R.string.remote_provisioning_failure, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.linphone.core.LinphoneAddress.TransportType;
|
|||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreListener;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
|
||||
import android.app.Activity;
|
||||
|
@ -44,7 +44,7 @@ import android.widget.Toast;
|
|||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class SetupActivity extends FragmentActivity implements OnClickListener, LinphoneCoreListener {
|
||||
public class SetupActivity extends FragmentActivity implements OnClickListener {
|
||||
private static SetupActivity instance;
|
||||
private RelativeLayout back, next, cancel;
|
||||
private SetupFragmentsEnum currentFragment;
|
||||
|
@ -52,6 +52,7 @@ public class SetupActivity extends FragmentActivity implements OnClickListener,
|
|||
private Fragment fragment;
|
||||
private LinphonePreferences mPrefs;
|
||||
private boolean accountCreated = false;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -73,6 +74,20 @@ public class SetupActivity extends FragmentActivity implements OnClickListener,
|
|||
mPrefs = LinphonePreferences.instance();
|
||||
|
||||
initUI();
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
@Override
|
||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState state, String smessage) {
|
||||
if (state == RegistrationState.RegistrationOk) {
|
||||
if (LinphoneManager.getLc().getDefaultProxyConfig() != null) {
|
||||
launchEchoCancellerCalibration(true);
|
||||
}
|
||||
} else if (state == RegistrationState.RegistrationFailed) {
|
||||
Toast.makeText(SetupActivity.this, getString(R.string.first_launch_bad_login_password), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
instance = this;
|
||||
};
|
||||
|
||||
|
@ -82,7 +97,7 @@ public class SetupActivity extends FragmentActivity implements OnClickListener,
|
|||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(this);
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,7 +105,7 @@ public class SetupActivity extends FragmentActivity implements OnClickListener,
|
|||
protected void onPause() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(this);
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
||||
super.onPause();
|
||||
|
@ -220,16 +235,6 @@ public class SetupActivity extends FragmentActivity implements OnClickListener,
|
|||
}
|
||||
}
|
||||
|
||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState state, String smessage) {
|
||||
if (state == RegistrationState.RegistrationOk) {
|
||||
if (LinphoneManager.getLc().getDefaultProxyConfig() != null) {
|
||||
launchEchoCancellerCalibration(true);
|
||||
}
|
||||
} else if (state == RegistrationState.RegistrationFailed) {
|
||||
Toast.makeText(SetupActivity.this, getString(R.string.first_launch_bad_login_password), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
public void checkAccount(String username, String password, String domain) {
|
||||
saveCreatedAccount(username, password, domain);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue