Started migration of Android app to new JNI/Java wrapper
This commit is contained in:
parent
312821c6b4
commit
857c0ed130
58 changed files with 2007 additions and 2068 deletions
|
@ -58,10 +58,7 @@ if (firebaseEnable()) {
|
|||
|
||||
//// Submodule Dir /////
|
||||
def submoduleDir = ['submodules/mediastreamer2/java/src',
|
||||
'submodules/linphone/java/j2se',
|
||||
'submodules/linphone/java/common',
|
||||
'submodules/linphone/java/impl',
|
||||
'submodules/linphone/coreapi/help/examples/java']
|
||||
'liblinphone-sdk/android-arm64/share/linphonej/java/']
|
||||
////////////////////////
|
||||
|
||||
///// Exclude Files /////
|
||||
|
@ -75,6 +72,7 @@ if (!firebaseEnable()) {
|
|||
println '[Push Notification] Firebase enabled'
|
||||
}
|
||||
excludeFiles.add('**/mediastream/MediastreamerActivity.java')
|
||||
excludeFiles.add('src/android/org/linphone/tutorials/*.java')
|
||||
|
||||
def excludePackage = []
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCore.LogCollectionUploadState;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Core.LogCollectionUploadState;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.app.Fragment;
|
||||
|
@ -44,7 +44,7 @@ public class AboutFragment extends Fragment implements OnClickListener {
|
|||
View sendLogButton = null;
|
||||
View resetLogButton = null;
|
||||
ImageView cancel;
|
||||
LinphoneCoreListenerBase mListener;
|
||||
CoreListenerStub mListener;
|
||||
private ProgressDialog progress;
|
||||
private boolean uploadInProgress;
|
||||
|
||||
|
@ -72,19 +72,19 @@ public class AboutFragment extends Fragment implements OnClickListener {
|
|||
resetLogButton.setOnClickListener(this);
|
||||
resetLogButton.setVisibility(LinphonePreferences.instance().isDebugEnabled() ? View.VISIBLE : View.GONE);
|
||||
|
||||
mListener = new LinphoneCoreListenerBase() {
|
||||
mListener = new CoreListenerStub() {
|
||||
@Override
|
||||
public void uploadProgressIndication(LinphoneCore lc, int offset, int total) {
|
||||
public void onLogCollectionUploadProgressIndication(Core lc, int offset, int total) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadStateChanged(LinphoneCore lc, LogCollectionUploadState state, String info) {
|
||||
if (state == LogCollectionUploadState.LogCollectionUploadStateInProgress) {
|
||||
public void onLogCollectionUploadStateChanged(Core lc, LogCollectionUploadState state, String info) {
|
||||
if (state == LogCollectionUploadState.InProgress) {
|
||||
displayUploadLogsInProgress();
|
||||
} else if (state == LogCollectionUploadState.LogCollectionUploadStateDelivered || state == LogCollectionUploadState.LogCollectionUploadStateNotDelivered) {
|
||||
} else if (state == LogCollectionUploadState.Delivered || state == LogCollectionUploadState.NotDelivered) {
|
||||
uploadInProgress = false;
|
||||
if (progress != null) progress.dismiss();
|
||||
if (state == LogCollectionUploadState.LogCollectionUploadStateDelivered) {
|
||||
if (state == LogCollectionUploadState.Delivered) {
|
||||
sendLogs(LinphoneService.instance().getApplicationContext(), info);
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public class AboutFragment extends Fragment implements OnClickListener {
|
|||
|
||||
@Override
|
||||
public void onPause() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class AboutFragment extends Fragment implements OnClickListener {
|
|||
|
||||
@Override
|
||||
public void onResume() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ public class AboutFragment extends Fragment implements OnClickListener {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
if (LinphoneActivity.isInstanciated()) {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (v == sendLogButton) {
|
||||
if (lc != null) {
|
||||
lc.uploadLogCollection();
|
||||
|
|
|
@ -23,11 +23,12 @@ import java.util.List;
|
|||
|
||||
import org.linphone.LinphonePreferences.AccountBuilder;
|
||||
import org.linphone.assistant.AssistantActivity;
|
||||
import org.linphone.core.LinphoneAccountCreator;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneNatPolicy;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.AccountCreator;
|
||||
import org.linphone.core.AccountCreatorListener;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.NatPolicy;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.ui.PreferencesListFragment;
|
||||
|
||||
|
@ -53,14 +54,14 @@ import android.view.WindowManager;
|
|||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
|
||||
public class AccountPreferencesFragment extends PreferencesListFragment implements LinphoneAccountCreator.LinphoneAccountCreatorListener {
|
||||
public class AccountPreferencesFragment extends PreferencesListFragment implements AccountCreatorListener {
|
||||
private int n;
|
||||
private boolean isNewAccount=false;
|
||||
private LinphonePreferences mPrefs;
|
||||
private EditTextPreference mProxyPreference;
|
||||
private ListPreference mTransportPreference;
|
||||
private AccountBuilder builder;
|
||||
private LinphoneAccountCreator accountCreator;
|
||||
private AccountCreator accountCreator;
|
||||
private ProgressDialog progress;
|
||||
|
||||
public AccountPreferencesFragment() {
|
||||
|
@ -104,7 +105,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
|
|||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
if (isNewAccount) {
|
||||
builder.setUserId(newValue.toString());
|
||||
builder.setUserid(newValue.toString());
|
||||
} else {
|
||||
mPrefs.setAccountUserId(n, newValue.toString());
|
||||
}
|
||||
|
@ -154,7 +155,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
|
|||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
String value = newValue.toString();
|
||||
if (isNewAccount) {
|
||||
builder.setProxy(newValue.toString());
|
||||
builder.setServerAddr(newValue.toString());
|
||||
preference.setSummary(newValue.toString());
|
||||
} else {
|
||||
mPrefs.setAccountProxy(n, value);
|
||||
|
@ -211,7 +212,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
|
|||
if (isNewAccount) {
|
||||
builder.setAvpfEnabled(value);
|
||||
} else {
|
||||
mPrefs.enableAvpf(n, value);
|
||||
mPrefs.setAvpfMode(n, value);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -229,7 +230,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
|
|||
if (isNewAccount) {
|
||||
//TODO
|
||||
} else {
|
||||
mPrefs.setAvpfRRInterval(n, value);
|
||||
mPrefs.setAvpfRrInterval(n, value);
|
||||
}
|
||||
preference.setSummary(value);
|
||||
return true;
|
||||
|
@ -320,11 +321,11 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
|
|||
|
||||
private void initAccountPreferencesFields(PreferenceScreen parent) {
|
||||
boolean isDefaultAccount = mPrefs.getDefaultAccountIndex() == n;
|
||||
LinphoneNatPolicy natPolicy = null;
|
||||
NatPolicy natPolicy = null;
|
||||
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null &&
|
||||
LinphoneManager.getLc().getProxyConfigList() != null &&
|
||||
LinphoneManager.getLc().getProxyConfigList().length > n) {
|
||||
LinphoneProxyConfig proxy = LinphoneManager.getLc().getProxyConfigList()[n];
|
||||
ProxyConfig proxy = LinphoneManager.getLc().getProxyConfigList()[n];
|
||||
natPolicy = proxy.getNatPolicy();
|
||||
if (natPolicy == null) {
|
||||
natPolicy = LinphoneManager.getLc().createNatPolicy();
|
||||
|
@ -334,8 +335,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
|
|||
}
|
||||
}
|
||||
|
||||
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc()
|
||||
, LinphonePreferences.instance().getXmlrpcUrl());
|
||||
accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
|
||||
accountCreator.setListener(this);
|
||||
|
||||
PreferenceCategory account = (PreferenceCategory) getPreferenceScreen().findPreference(getString(R.string.pref_sipaccount_key));
|
||||
|
@ -430,8 +430,8 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
|
|||
EditTextPreference avpfRRInterval = (EditTextPreference) advanced.getPreference(8);
|
||||
avpfRRInterval.setOnPreferenceChangeListener(avpfRRIntervalChangedListener);
|
||||
if (!isNewAccount){
|
||||
avpfRRInterval.setText(mPrefs.getAvpfRRInterval(n));
|
||||
avpfRRInterval.setSummary(mPrefs.getAvpfRRInterval(n));
|
||||
avpfRRInterval.setText(mPrefs.getAvpfRrInterval(n));
|
||||
avpfRRInterval.setSummary(mPrefs.getAvpfRrInterval(n));
|
||||
}
|
||||
|
||||
CheckBoxPreference escape = (CheckBoxPreference) advanced.getPreference(9);
|
||||
|
@ -483,17 +483,17 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
|
|||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
alert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||
/*alert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
LinphoneAccountCreator.PasswordCheck status = accountCreator.setPassword(pass1.getText().toString());
|
||||
if (status.equals(LinphoneAccountCreator.PasswordCheck.Ok)) {
|
||||
AccountCreator.PasswordStatus status = accountCreator.setPassword(pass1.getText().toString());
|
||||
if (status.equals(AccountCreator.PasswordStatus.Ok)) {
|
||||
if (pass1.getText().toString().compareTo(pass2.getText().toString()) == 0) {
|
||||
accountCreator.setUsername(mPrefs.getAccountUsername(n));
|
||||
accountCreator.setHa1(mPrefs.getAccountHa1(n));
|
||||
LinphoneAccountCreator.RequestStatus req_status = accountCreator.updatePassword(pass1.getText().toString());
|
||||
if (!req_status.equals(LinphoneAccountCreator.RequestStatus.Ok)) {
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(req_status)
|
||||
AccountCreator.Status req_status = accountCreator.updatePassword(pass1.getText().toString());
|
||||
if (!req_status.equals(AccountCreator.Status.RequestOk)) {
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(req_status)
|
||||
, LinphoneActivity.instance());
|
||||
} else {
|
||||
progress = ProgressDialog.show(LinphoneActivity.instance(), null, null);
|
||||
|
@ -512,7 +512,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
|
|||
}
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForPasswordStatus(status), LinphoneActivity.instance());
|
||||
}
|
||||
});
|
||||
});*/ // TODO FIXME
|
||||
|
||||
alert.setView(layout);
|
||||
alert.show();
|
||||
|
@ -587,7 +587,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
|
|||
if(isNewAccount){
|
||||
builder.saveNewAccount();
|
||||
}
|
||||
} catch (LinphoneCoreException e) {
|
||||
} catch (CoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
LinphoneActivity.instance().isNewProxyConfig();
|
||||
|
@ -597,58 +597,58 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onIsAccountExist(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onCreateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onActivateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onLinkAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onActivateAlias(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onIsAccountActivated(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onRecoverAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onIsAccountLinked(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onIsAliasUsed(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onUpdateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
if (progress != null) progress.dismiss();
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.Ok)) {
|
||||
if (status.equals(AccountCreator.Status.RequestOk)) {
|
||||
mPrefs.setAccountPassword(n, accountCreator.getPassword());
|
||||
PreferenceCategory account = (PreferenceCategory) getPreferenceScreen().findPreference(getString(R.string.pref_sipaccount_key));
|
||||
((EditTextPreference) account.getPreference(2)).setText(mPrefs.getAccountPassword(n));
|
||||
LinphoneUtils.displayErrorAlert(getString(R.string.pref_password_changed), LinphoneActivity.instance());
|
||||
} else {
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status), LinphoneActivity.instance());
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), LinphoneActivity.instance());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import org.linphone.core.LinphoneCallParams;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.CallParams;
|
||||
import org.linphone.core.Core;
|
||||
|
||||
public class BandwidthManager {
|
||||
|
||||
|
@ -47,15 +47,15 @@ public class BandwidthManager {
|
|||
}
|
||||
|
||||
|
||||
public void updateWithProfileSettings(LinphoneCore lc, LinphoneCallParams callParams) {
|
||||
public void updateWithProfileSettings(Core lc, CallParams callParams) {
|
||||
if (callParams != null) { // in call
|
||||
// Update video parm if
|
||||
if (!isVideoPossible()) { // NO VIDEO
|
||||
callParams.setVideoEnabled(false);
|
||||
callParams.setAudioBandwidth(40);
|
||||
callParams.enableVideo(false);
|
||||
callParams.setAudioBandwidthLimit(40);
|
||||
} else {
|
||||
callParams.setVideoEnabled(true);
|
||||
callParams.setAudioBandwidth(0); // disable limitation
|
||||
callParams.enableVideo(true);
|
||||
callParams.setAudioBandwidthLimit(0); // disable limitation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LpConfig;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.Config;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
|
@ -32,12 +32,10 @@ public class BootReceiver extends BroadcastReceiver {
|
|||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent.getAction().equalsIgnoreCase(Intent.ACTION_SHUTDOWN)) {
|
||||
android.util.Log.d("LinphoneBootReceiver", "Device is shutting down, destroying LinphoneCore to unregister");
|
||||
android.util.Log.d("LinphoneBootReceiver", "Device is shutting down, destroying Core to unregister");
|
||||
LinphoneManager.destroy();
|
||||
} else {
|
||||
String path = context.getFilesDir().getAbsolutePath() + "/.linphonerc";
|
||||
LpConfig lpConfig = LinphoneCoreFactory.instance().createLpConfig(path);
|
||||
boolean autostart = lpConfig.getBool("app", "auto_start", false);
|
||||
boolean autostart = LinphonePreferences.instance().isAutoStartEnabled();
|
||||
android.util.Log.i("LinphoneBootReceiver", "Device is starting, auto_start is " + autostart);
|
||||
if (autostart) {
|
||||
Intent lLinphoneServiceIntent = new Intent(Intent.ACTION_MAIN);
|
||||
|
|
|
@ -62,19 +62,20 @@ import android.widget.RelativeLayout;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCallParams;
|
||||
import org.linphone.core.LinphoneCallStats;
|
||||
import org.linphone.core.LinphoneCallStats.LinphoneAddressFamily;
|
||||
import org.linphone.core.LinphoneChatMessage;
|
||||
import org.linphone.core.LinphoneChatRoom;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphonePlayer;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.Call;
|
||||
import org.linphone.core.Call.State;
|
||||
import org.linphone.core.CallParams;
|
||||
import org.linphone.core.CallStats;
|
||||
import org.linphone.core.CallStats.AddressFamily;
|
||||
import org.linphone.core.ChatMessage;
|
||||
import org.linphone.core.ChatRoom;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.core.Player;
|
||||
import org.linphone.core.PayloadType;
|
||||
import org.linphone.core.StreamType;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||
import org.linphone.ui.Numpad;
|
||||
|
@ -120,7 +121,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
private LayoutInflater inflater;
|
||||
private ViewGroup container;
|
||||
private boolean isConferenceRunning = false;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
private CoreListenerStub mListener;
|
||||
private DrawerLayout sideMenu;
|
||||
|
||||
private Handler mHandler = new Handler();
|
||||
|
@ -156,14 +157,14 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
mEncoderTexts = new HashMap<String, String>();
|
||||
mDecoderTexts = new HashMap<String, String>();
|
||||
|
||||
mListener = new LinphoneCoreListenerBase() {
|
||||
mListener = new CoreListenerStub() {
|
||||
@Override
|
||||
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
|
||||
public void onMessageReceived(Core lc, ChatRoom cr, ChatMessage message) {
|
||||
displayMissedChats();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callState(LinphoneCore lc, final LinphoneCall call, LinphoneCall.State state, String message) {
|
||||
public void onCallStateChanged(Core lc, final Call call, Call.State state, String message) {
|
||||
if (LinphoneManager.getLc().getCallsNb() == 0) {
|
||||
if (status != null) {
|
||||
LinphoneService.instance().removeSasNotification();
|
||||
|
@ -186,7 +187,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
} else if (state == State.Resuming) {
|
||||
if(LinphonePreferences.instance().isVideoEnabled()){
|
||||
status.refreshStatusItems(call, isVideoEnabled(call));
|
||||
if(call.getCurrentParams().getVideoEnabled()){
|
||||
if(call.getCurrentParams().videoEnabled()){
|
||||
showVideoView();
|
||||
}
|
||||
}
|
||||
|
@ -201,21 +202,21 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
videoProgress.setVisibility(View.GONE);
|
||||
status.refreshStatusItems(call, isVideoEnabled(call));
|
||||
}
|
||||
} else if (state == State.CallUpdatedByRemote) {
|
||||
} else if (state == State.UpdatedByRemote) {
|
||||
// If the correspondent proposes video while audio call
|
||||
boolean videoEnabled = LinphonePreferences.instance().isVideoEnabled();
|
||||
if (!videoEnabled) {
|
||||
acceptCallUpdate(false);
|
||||
}
|
||||
|
||||
boolean remoteVideo = call.getRemoteParams().getVideoEnabled();
|
||||
boolean localVideo = call.getCurrentParams().getVideoEnabled();
|
||||
boolean remoteVideo = call.getRemoteParams().videoEnabled();
|
||||
boolean localVideo = call.getCurrentParams().videoEnabled();
|
||||
boolean autoAcceptCameraPolicy = LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests();
|
||||
if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) {
|
||||
if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !(LinphoneManager.getLc().getConference() != null)) {
|
||||
showAcceptCallUpdateDialog();
|
||||
createTimerForDialog(SECONDS_BEFORE_DENYING_CALL_UPDATE);
|
||||
}
|
||||
// else if (remoteVideo && !LinphoneManager.getLc().isInConference() && autoAcceptCameraPolicy) {
|
||||
// else if (remoteVideo && !LinphoneManager.getLc().(getConference() != null) && autoAcceptCameraPolicy) {
|
||||
// mHandler.post(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
|
@ -230,12 +231,12 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
}
|
||||
|
||||
@Override
|
||||
public void callEncryptionChanged(LinphoneCore lc, final LinphoneCall call, boolean encrypted, String authenticationToken) {
|
||||
public void onCallEncryptionChanged(Core lc, final Call call, boolean encrypted, String authenticationToken) {
|
||||
if (status != null) {
|
||||
if(call.getCurrentParams().getMediaEncryption().equals(LinphoneCore.MediaEncryption.ZRTP) && !call.isAuthenticationTokenVerified()){
|
||||
if(call.getCurrentParams().getMediaEncryption().equals(Core.MediaEncryption.ZRTP) && !call.getAuthenticationTokenVerified()){
|
||||
status.showZRTPDialog(call);
|
||||
}
|
||||
status.refreshStatusItems(call, call.getCurrentParams().getVideoEnabled());
|
||||
status.refreshStatusItems(call, call.getCurrentParams().videoEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -245,7 +246,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
initUI();
|
||||
|
||||
if (LinphoneManager.getLc().getCallsNb() > 0) {
|
||||
LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
|
||||
Call call = LinphoneManager.getLc().getCalls()[0];
|
||||
|
||||
if (LinphoneUtils.isCallEstablished(call)) {
|
||||
enableAndRefreshInCallActions();
|
||||
|
@ -267,8 +268,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
refreshInCallActions();
|
||||
return;
|
||||
} else {
|
||||
isSpeakerEnabled = LinphoneManager.getLc().isSpeakerEnabled();
|
||||
isMicMuted = LinphoneManager.getLc().isMicMuted();
|
||||
isSpeakerEnabled = LinphoneManager.getInstance().isSpeakerEnabled();
|
||||
isMicMuted = !LinphoneManager.getLc().micEnabled();
|
||||
}
|
||||
|
||||
Fragment callFragment;
|
||||
|
@ -307,17 +308,17 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
}.start();
|
||||
}
|
||||
|
||||
private boolean isVideoEnabled(LinphoneCall call) {
|
||||
private boolean isVideoEnabled(Call call) {
|
||||
if(call != null){
|
||||
return call.getCurrentParams().getVideoEnabled();
|
||||
return call.getCurrentParams().videoEnabled();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
outState.putBoolean("Speaker", LinphoneManager.getLc().isSpeakerEnabled());
|
||||
outState.putBoolean("Mic", LinphoneManager.getLc().isMicMuted());
|
||||
outState.putBoolean("Speaker", LinphoneManager.getInstance().isSpeakerEnabled());
|
||||
outState.putBoolean("Mic", !LinphoneManager.getLc().micEnabled());
|
||||
outState.putBoolean("VideoCallPaused", isVideoCallPaused);
|
||||
outState.putBoolean("AskingVideo", isVideoAsk);
|
||||
outState.putLong("TimeRemind", TimeRemind);
|
||||
|
@ -573,8 +574,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
private void enableAndRefreshInCallActions() {
|
||||
int confsize = 0;
|
||||
|
||||
if(LinphoneManager.getLc().isInConference()) {
|
||||
confsize = LinphoneManager.getLc().getConferenceSize() - (LinphoneManager.getLc().isInConference() ? 1 : 0);
|
||||
if( LinphoneManager.getLc().getConference() != null) {
|
||||
confsize = LinphoneManager.getLc().getConferenceSize() - (LinphoneManager.getLc().getConference() != null ? 1 : 0);
|
||||
}
|
||||
|
||||
//Enabled transfer button
|
||||
|
@ -706,7 +707,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
}
|
||||
|
||||
else if (id == R.id.call_pause) {
|
||||
LinphoneCall call = (LinphoneCall) v.getTag();
|
||||
Call call = (Call) v.getTag();
|
||||
pauseOrResumeCall(call);
|
||||
}
|
||||
else if (id == R.id.conference_pause) {
|
||||
|
@ -749,18 +750,18 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
}
|
||||
|
||||
private void disableVideo(final boolean videoDisabled) {
|
||||
final LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
|
||||
final Call call = LinphoneManager.getLc().getCurrentCall();
|
||||
if (call == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (videoDisabled) {
|
||||
LinphoneCallParams params = LinphoneManager.getLc().createCallParams(call);
|
||||
params.setVideoEnabled(false);
|
||||
CallParams params = LinphoneManager.getLc().createCallParams(call);
|
||||
params.enableVideo(false);
|
||||
LinphoneManager.getLc().updateCall(call, params);
|
||||
} else {
|
||||
videoProgress.setVisibility(View.VISIBLE);
|
||||
if (call.getRemoteParams() != null && !call.getRemoteParams().isLowBandwidthEnabled()) {
|
||||
if (call.getRemoteParams() != null && !call.getRemoteParams().lowBandwidthEnabled()) {
|
||||
LinphoneManager.getInstance().addVideo();
|
||||
} else {
|
||||
displayCustomToast(getString(R.string.error_low_bandwidth), Toast.LENGTH_LONG);
|
||||
|
@ -783,18 +784,18 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
}
|
||||
|
||||
private void switchVideo(final boolean displayVideo) {
|
||||
final LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
|
||||
final Call call = LinphoneManager.getLc().getCurrentCall();
|
||||
if (call == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Check if the call is not terminated
|
||||
if(call.getState() == State.CallEnd || call.getState() == State.CallReleased) return;
|
||||
if(call.getState() == State.End || call.getState() == State.Released) return;
|
||||
|
||||
if (!displayVideo) {
|
||||
showAudioView();
|
||||
} else {
|
||||
if (!call.getRemoteParams().isLowBandwidthEnabled()) {
|
||||
if (!call.getRemoteParams().lowBandwidthEnabled()) {
|
||||
LinphoneManager.getInstance().addVideo();
|
||||
if (videoCallFragment == null || !videoCallFragment.isVisible())
|
||||
showVideoView();
|
||||
|
@ -879,9 +880,9 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
}
|
||||
|
||||
private void toggleMicro() {
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
Core lc = LinphoneManager.getLc();
|
||||
isMicMuted = !isMicMuted;
|
||||
lc.muteMic(isMicMuted);
|
||||
lc.enableMic(!isMicMuted);
|
||||
if (isMicMuted) {
|
||||
micro.setImageResource(R.drawable.micro_selected);
|
||||
} else {
|
||||
|
@ -897,7 +898,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
if (isSpeakerEnabled) {
|
||||
LinphoneManager.getInstance().routeAudioToSpeaker();
|
||||
speaker.setImageResource(R.drawable.speaker_selected);
|
||||
LinphoneManager.getLc().enableSpeaker(isSpeakerEnabled);
|
||||
LinphoneManager.getInstance().enableSpeaker(isSpeakerEnabled);
|
||||
} else {
|
||||
Log.d("Toggle speaker off, routing back to earpiece");
|
||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||
|
@ -905,8 +906,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
}
|
||||
}
|
||||
|
||||
public void pauseOrResumeCall(LinphoneCall call) {
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
public void pauseOrResumeCall(Call call) {
|
||||
Core lc = LinphoneManager.getLc();
|
||||
if (call != null && LinphoneManager.getLc().getCurrentCall() == call) {
|
||||
lc.pauseCall(call);
|
||||
if (isVideoEnabled(LinphoneManager.getLc().getCurrentCall())) {
|
||||
|
@ -925,12 +926,12 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
}
|
||||
|
||||
private void hangUp() {
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
LinphoneCall currentCall = lc.getCurrentCall();
|
||||
Core lc = LinphoneManager.getLc();
|
||||
Call currentCall = lc.getCurrentCall();
|
||||
|
||||
if (currentCall != null) {
|
||||
lc.terminateCall(currentCall);
|
||||
} else if (lc.isInConference()) {
|
||||
} else if (lc.getConference() != null) {
|
||||
lc.terminateConference();
|
||||
} else {
|
||||
lc.terminateAllCalls();
|
||||
|
@ -1076,22 +1077,19 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
timer.cancel();
|
||||
}
|
||||
|
||||
LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
|
||||
Call call = LinphoneManager.getLc().getCurrentCall();
|
||||
if (call == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
LinphoneCallParams params = LinphoneManager.getLc().createCallParams(call);
|
||||
CallParams params = LinphoneManager.getLc().createCallParams(call);
|
||||
if (accept) {
|
||||
params.setVideoEnabled(true);
|
||||
LinphoneManager.getLc().enableVideo(true, true);
|
||||
params.enableVideo(true);
|
||||
LinphoneManager.getLc().enableVideoCapture(true);
|
||||
LinphoneManager.getLc().enableVideoDisplay(true);
|
||||
}
|
||||
|
||||
try {
|
||||
LinphoneManager.getLc().acceptCallUpdate(call, params);
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
LinphoneManager.getLc().acceptCallUpdate(call, params);
|
||||
}
|
||||
|
||||
public void startIncomingCallActivity() {
|
||||
|
@ -1176,11 +1174,11 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
instance = this;
|
||||
super.onResume();
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
isSpeakerEnabled = LinphoneManager.getLc().isSpeakerEnabled();
|
||||
isSpeakerEnabled = LinphoneManager.getInstance().isSpeakerEnabled();
|
||||
|
||||
refreshIncallUi();
|
||||
handleViewIntent();
|
||||
|
@ -1200,32 +1198,32 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
private void handleViewIntent() {
|
||||
Intent intent = getIntent();
|
||||
if(intent != null && intent.getAction() == "android.intent.action.VIEW") {
|
||||
LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
|
||||
Call call = LinphoneManager.getLc().getCurrentCall();
|
||||
if(call != null && isVideoEnabled(call)) {
|
||||
LinphonePlayer player = call.getPlayer();
|
||||
Player player = call.getPlayer();
|
||||
String path = intent.getData().getPath();
|
||||
Log.i("Openning " + path);
|
||||
int openRes = player.open(path);
|
||||
if(openRes == -1) {
|
||||
/*int openRes = */player.open(path);
|
||||
/*if(openRes == -1) {
|
||||
String message = "Could not open " + path;
|
||||
Log.e(message);
|
||||
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
Log.i("Start playing");
|
||||
if(player.start() == -1) {
|
||||
player.close();
|
||||
/*if(*/player.start()/* == -1) {*/;
|
||||
/*player.close();
|
||||
String message = "Could not start playing " + path;
|
||||
Log.e(message);
|
||||
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
@ -1300,14 +1298,14 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
|
||||
|
||||
//CALL INFORMATION
|
||||
private void displayCurrentCall(LinphoneCall call){
|
||||
LinphoneAddress lAddress = call.getRemoteAddress();
|
||||
private void displayCurrentCall(Call call){
|
||||
Address lAddress = call.getRemoteAddress();
|
||||
TextView contactName = (TextView) findViewById(R.id.current_contact_name);
|
||||
setContactInformation(contactName, contactPicture, lAddress);
|
||||
registerCallDurationTimer(null, call);
|
||||
}
|
||||
|
||||
private void displayPausedCalls(Resources resources, final LinphoneCall call, int index) {
|
||||
private void displayPausedCalls(Resources resources, final Call call, int index) {
|
||||
// Control Row
|
||||
LinearLayout callView;
|
||||
|
||||
|
@ -1327,7 +1325,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
TextView contactName = (TextView) callView.findViewById(R.id.contact_name);
|
||||
ImageView contactImage = (ImageView) callView.findViewById(R.id.contact_picture);
|
||||
|
||||
LinphoneAddress lAddress = call.getRemoteAddress();
|
||||
Address lAddress = call.getRemoteAddress();
|
||||
setContactInformation(contactName, contactImage, lAddress);
|
||||
displayCallStatusIconAndReturnCallPaused(callView, call);
|
||||
registerCallDurationTimer(callView, call);
|
||||
|
@ -1335,7 +1333,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
callsList.addView(callView);
|
||||
}
|
||||
|
||||
private void setContactInformation(TextView contactName, ImageView contactPicture, LinphoneAddress lAddress) {
|
||||
private void setContactInformation(TextView contactName, ImageView contactPicture, Address lAddress) {
|
||||
LinphoneContact lContact = ContactsManager.getInstance().findContactFromAddress(lAddress);
|
||||
if (lContact == null) {
|
||||
contactName.setText(LinphoneUtils.getAddressDisplayName(lAddress));
|
||||
|
@ -1346,28 +1344,28 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
}
|
||||
}
|
||||
|
||||
private boolean displayCallStatusIconAndReturnCallPaused(LinearLayout callView, LinphoneCall call) {
|
||||
private boolean displayCallStatusIconAndReturnCallPaused(LinearLayout callView, Call call) {
|
||||
boolean isCallPaused, isInConference;
|
||||
ImageView callState = (ImageView) callView.findViewById(R.id.call_pause);
|
||||
callState.setTag(call);
|
||||
callState.setOnClickListener(this);
|
||||
ImageView onCallStateChanged = (ImageView) callView.findViewById(R.id.call_pause);
|
||||
onCallStateChanged.setTag(call);
|
||||
onCallStateChanged.setOnClickListener(this);
|
||||
|
||||
if (call.getState() == State.Paused || call.getState() == State.PausedByRemote || call.getState() == State.Pausing) {
|
||||
callState.setImageResource(R.drawable.pause);
|
||||
onCallStateChanged.setImageResource(R.drawable.pause);
|
||||
isCallPaused = true;
|
||||
isInConference = false;
|
||||
} else if (call.getState() == State.OutgoingInit || call.getState() == State.OutgoingProgress || call.getState() == State.OutgoingRinging) {
|
||||
isCallPaused = false;
|
||||
isInConference = false;
|
||||
} else {
|
||||
isInConference = isConferenceRunning && call.isInConference();
|
||||
isInConference = isConferenceRunning && call.getConference() != null;
|
||||
isCallPaused = false;
|
||||
}
|
||||
|
||||
return isCallPaused || isInConference;
|
||||
}
|
||||
|
||||
private void registerCallDurationTimer(View v, LinphoneCall call) {
|
||||
private void registerCallDurationTimer(View v, Call call) {
|
||||
int callDuration = call.getDuration();
|
||||
if (callDuration == 0 && call.getState() != State.StreamsRunning) {
|
||||
return;
|
||||
|
@ -1389,8 +1387,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
}
|
||||
|
||||
public void refreshCallList(Resources resources) {
|
||||
isConferenceRunning = LinphoneManager.getLc().isInConference();
|
||||
List<LinphoneCall> pausedCalls = LinphoneUtils.getCallsInState(LinphoneManager.getLc(), Arrays.asList(State.PausedByRemote));
|
||||
isConferenceRunning = LinphoneManager.getLc().getConference() != null;
|
||||
List<Call> pausedCalls = LinphoneUtils.getCallsInState(LinphoneManager.getLc(), Arrays.asList(State.PausedByRemote));
|
||||
|
||||
//MultiCalls
|
||||
if(LinphoneManager.getLc().getCallsNb() > 1){
|
||||
|
@ -1430,12 +1428,12 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
}
|
||||
|
||||
boolean isConfPaused = false;
|
||||
for (LinphoneCall call : LinphoneManager.getLc().getCalls()) {
|
||||
if (call.isInConference() && !isConferenceRunning) {
|
||||
for (Call call : LinphoneManager.getLc().getCalls()) {
|
||||
if (call.getConference() != null && !isConferenceRunning) {
|
||||
isConfPaused = true;
|
||||
index++;
|
||||
} else {
|
||||
if (call != LinphoneManager.getLc().getCurrentCall() && !call.isInConference()) {
|
||||
if (call != LinphoneManager.getLc().getCurrentCall() && !(call.getConference() != null)) {
|
||||
displayPausedCalls(resources, call, index);
|
||||
index++;
|
||||
} else {
|
||||
|
@ -1463,10 +1461,10 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
}
|
||||
|
||||
//Conference
|
||||
private void exitConference(final LinphoneCall call){
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
private void exitConference(final Call call){
|
||||
Core lc = LinphoneManager.getLc();
|
||||
|
||||
if (call.isInConference()) {
|
||||
if (call.getConference() != null) {
|
||||
lc.removeFromConference(call);
|
||||
if (lc.getConferenceSize() <= 1) {
|
||||
lc.leaveConference();
|
||||
|
@ -1480,10 +1478,10 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
}
|
||||
|
||||
public void pauseOrResumeConference() {
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
Core lc = LinphoneManager.getLc();
|
||||
conferenceStatus = (ImageView) findViewById(R.id.conference_pause);
|
||||
if(conferenceStatus != null) {
|
||||
if (lc.isInConference()) {
|
||||
if (lc.getConference() != null) {
|
||||
conferenceStatus.setImageResource(R.drawable.pause_big_over_selected);
|
||||
lc.leaveConference();
|
||||
} else {
|
||||
|
@ -1494,14 +1492,14 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
refreshCallList(getResources());
|
||||
}
|
||||
|
||||
private void displayConferenceParticipant(int index, final LinphoneCall call){
|
||||
private void displayConferenceParticipant(int index, final Call call){
|
||||
LinearLayout confView = (LinearLayout) inflater.inflate(R.layout.conf_call_control_row, container, false);
|
||||
conferenceList.setId(index + 1);
|
||||
TextView contact = (TextView) confView.findViewById(R.id.contactNameOrNumber);
|
||||
|
||||
LinphoneContact lContact = ContactsManager.getInstance().findContactFromAddress(call.getRemoteAddress());
|
||||
if (lContact == null) {
|
||||
contact.setText(call.getRemoteAddress().getUserName());
|
||||
contact.setText(call.getRemoteAddress().getUsername());
|
||||
} else {
|
||||
contact.setText(lContact.getFullName());
|
||||
}
|
||||
|
@ -1540,8 +1538,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
|
||||
//Conference participant
|
||||
int index = 1;
|
||||
for (LinphoneCall call : LinphoneManager.getLc().getCalls()) {
|
||||
if (call.isInConference()) {
|
||||
for (Call call : LinphoneManager.getLc().getCalls()) {
|
||||
if (call.getConference() != null) {
|
||||
displayConferenceParticipant(index, call);
|
||||
index++;
|
||||
}
|
||||
|
@ -1554,8 +1552,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
|
||||
private void displayMissedChats() {
|
||||
int count = 0;
|
||||
LinphoneChatRoom[] chats = LinphoneManager.getLc().getChatRooms();
|
||||
for (LinphoneChatRoom chatroom : chats) {
|
||||
ChatRoom[] chats = LinphoneManager.getLc().getChatRooms();
|
||||
for (ChatRoom chatroom : chats) {
|
||||
count += chatroom.getUnreadMessagesCount();
|
||||
}
|
||||
|
||||
|
@ -1576,7 +1574,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
private String getEncoderText(String mime){
|
||||
String ret = mEncoderTexts.get(mime);
|
||||
if (ret == null){
|
||||
org.linphone.mediastream.Factory msfactory = LinphoneManager.getLc().getMSFactory();
|
||||
org.linphone.mediastream.Factory msfactory = LinphoneManager.getLc().getMediastreamerFactory();
|
||||
ret = msfactory.getEncoderText(mime);
|
||||
mEncoderTexts.put(mime, ret);
|
||||
}
|
||||
|
@ -1585,14 +1583,14 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
private String getDecoderText(String mime){
|
||||
String ret = mDecoderTexts.get(mime);
|
||||
if (ret == null){
|
||||
org.linphone.mediastream.Factory msfactory = LinphoneManager.getLc().getMSFactory();
|
||||
org.linphone.mediastream.Factory msfactory = LinphoneManager.getLc().getMediastreamerFactory();
|
||||
ret = msfactory.getDecoderText(mime);
|
||||
mDecoderTexts.put(mime, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private void displayMediaStats(LinphoneCallParams params, LinphoneCallStats stats
|
||||
private void displayMediaStats(CallParams params, CallStats stats
|
||||
, PayloadType media , View layout, TextView title, TextView codec, TextView dl
|
||||
, TextView ul, TextView edl, TextView ice, TextView ip, TextView senderLossRate
|
||||
, TextView receiverLossRate, TextView enc, TextView dec, TextView videoResolutionSent
|
||||
|
@ -1604,9 +1602,9 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
layout.setVisibility(View.VISIBLE);
|
||||
title.setVisibility(TextView.VISIBLE);
|
||||
if (media != null) {
|
||||
mime = media.getMime();
|
||||
mime = media.getMimeType();
|
||||
formatText(codec, getString(R.string.call_stats_codec),
|
||||
mime + " / " + (media.getRate() / 1000) + "kHz");
|
||||
mime + " / " + (media.getClockRate() / 1000) + "kHz");
|
||||
}
|
||||
if (mime != null ){
|
||||
formatText(enc, getString(R.string.call_stats_encoder_name), getEncoderText(mime));
|
||||
|
@ -1623,8 +1621,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
formatText(ice, getString(R.string.call_stats_ice),
|
||||
stats.getIceState().toString());
|
||||
formatText(ip, getString(R.string.call_stats_ip),
|
||||
(stats.getIpFamilyOfRemote() == LinphoneAddressFamily.INET_6.getInt()) ?
|
||||
"IpV6" : (stats.getIpFamilyOfRemote() == LinphoneAddressFamily.INET.getInt()) ?
|
||||
(stats.getIpFamilyOfRemote() == AddressFamily.Inet6) ?
|
||||
"IpV6" : (stats.getIpFamilyOfRemote() == AddressFamily.Inet) ?
|
||||
"IpV4" : "Unknown");
|
||||
formatText(senderLossRate, getString(R.string.call_stats_sender_loss_rate),
|
||||
new DecimalFormat("##.##").format(stats.getSenderLossRate()) + "%");
|
||||
|
@ -1633,10 +1631,10 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
if (isVideo) {
|
||||
formatText(videoResolutionSent,
|
||||
getString(R.string.call_stats_video_resolution_sent),
|
||||
"\u2191 " + params.getSentVideoSize().toDisplayableString());
|
||||
"\u2191 " + params.getSentVideoDefinition().getName());
|
||||
formatText(videoResolutionReceived,
|
||||
getString(R.string.call_stats_video_resolution_received),
|
||||
"\u2193 " + params.getReceivedVideoSize().toDisplayableString());
|
||||
"\u2193 " + params.getReceivedVideoDefinition().getName());
|
||||
formatText(videoFpsSent,
|
||||
getString(R.string.call_stats_video_fps_sent),
|
||||
"\u2191 " + params.getSentFramerate());
|
||||
|
@ -1645,7 +1643,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
"\u2193 " + params.getReceivedFramerate());
|
||||
} else {
|
||||
formatText(jitterBuffer, getString(R.string.call_stats_jitter_buffer),
|
||||
new DecimalFormat("##.##").format(stats.getJitterBufferSize()) + " ms");
|
||||
new DecimalFormat("##.##").format(stats.getJitterBufferSizeMs()) + " ms");
|
||||
}
|
||||
} else {
|
||||
layout.setVisibility(View.GONE);
|
||||
|
@ -1653,7 +1651,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
}
|
||||
}
|
||||
|
||||
public void initCallStatsRefresher(final LinphoneCall call, final View view) {
|
||||
public void initCallStatsRefresher(final Call call, final View view) {
|
||||
if (mTimer != null && mTask != null) {
|
||||
return;
|
||||
}
|
||||
|
@ -1712,16 +1710,16 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() == null) return;
|
||||
synchronized(LinphoneManager.getLc()) {
|
||||
if (LinphoneActivity.isInstanciated()) {
|
||||
LinphoneCallParams params = call.getCurrentParams();
|
||||
CallParams params = call.getCurrentParams();
|
||||
if (params != null) {
|
||||
LinphoneCallStats audioStats = call.getAudioStats();
|
||||
LinphoneCallStats videoStats = null;
|
||||
CallStats audioStats = call.getStats(StreamType.Audio);
|
||||
CallStats videoStats = null;
|
||||
|
||||
if (params.getVideoEnabled())
|
||||
videoStats = call.getVideoStats();
|
||||
if (params.videoEnabled())
|
||||
videoStats = call.getStats(StreamType.Video);
|
||||
|
||||
PayloadType payloadAudio = params.getUsedAudioCodec();
|
||||
PayloadType payloadVideo = params.getUsedVideoCodec();
|
||||
PayloadType payloadAudio = params.getUsedAudioPayloadType();
|
||||
PayloadType payloadVideo = params.getUsedVideoPayloadType();
|
||||
|
||||
displayMediaStats(params, audioStats, payloadAudio, audioLayout
|
||||
, titleAudio, codecAudio, dlAudio, ulAudio, null, iceAudio
|
||||
|
|
|
@ -33,12 +33,12 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
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.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.Call;
|
||||
import org.linphone.core.Call.State;
|
||||
import org.linphone.core.CallParams;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.ui.LinphoneSliders.LinphoneSliderTriggered;
|
||||
|
||||
|
@ -50,8 +50,8 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
|
|||
|
||||
private TextView name, number;
|
||||
private ImageView contactPicture, accept, decline, arrow;
|
||||
private LinphoneCall mCall;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
private Call mCall;
|
||||
private CoreListenerStub mListener;
|
||||
private LinearLayout acceptUnlock;
|
||||
private LinearLayout declineUnlock;
|
||||
private boolean alreadyAcceptedOrDeniedCall, begin;
|
||||
|
@ -94,7 +94,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
|
|||
lookupCurrentCall();
|
||||
if (LinphonePreferences.instance() != null && mCall != null && mCall.getRemoteParams() != null &&
|
||||
LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests() &&
|
||||
mCall.getRemoteParams().getVideoEnabled()) {
|
||||
mCall.getRemoteParams().videoEnabled()) {
|
||||
accept.setImageResource(R.drawable.call_video_start);
|
||||
}
|
||||
decline = (ImageView) findViewById(R.id.decline);
|
||||
|
@ -182,16 +182,16 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
|
|||
}
|
||||
});
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
mListener = new CoreListenerStub(){
|
||||
@Override
|
||||
public void callState(LinphoneCore lc, LinphoneCall call, State state, String message) {
|
||||
if (call == mCall && State.CallEnd == state) {
|
||||
public void onCallStateChanged(Core lc, Call call, State state, String message) {
|
||||
if (call == mCall && State.End == state) {
|
||||
finish();
|
||||
}
|
||||
if (state == State.StreamsRunning) {
|
||||
Log.e("CallIncommingActivity - onCreate - State.StreamsRunning - speaker = "+LinphoneManager.getLc().isSpeakerEnabled());
|
||||
Log.e("CallIncommingActivity - onCreate - State.StreamsRunning - speaker = "+LinphoneManager.getInstance().isSpeakerEnabled());
|
||||
// The following should not be needed except some devices need it (e.g. Galaxy S).
|
||||
LinphoneManager.getLc().enableSpeaker(LinphoneManager.getLc().isSpeakerEnabled());
|
||||
LinphoneManager.getInstance().enableSpeaker(LinphoneManager.getInstance().isSpeakerEnabled());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -204,7 +204,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
|
|||
protected void onResume() {
|
||||
super.onResume();
|
||||
instance = this;
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
|
|||
}
|
||||
|
||||
|
||||
LinphoneAddress address = mCall.getRemoteAddress();
|
||||
Address address = mCall.getRemoteAddress();
|
||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address);
|
||||
if (contact != null) {
|
||||
LinphoneUtils.setImagePictureFromUri(this, contactPicture, contact.getPhotoUri(), contact.getThumbnailUri());
|
||||
|
@ -241,7 +241,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
|
|||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
@ -265,8 +265,8 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
|
|||
|
||||
private void lookupCurrentCall() {
|
||||
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) {
|
||||
List<LinphoneCall> calls = LinphoneUtils.getLinphoneCalls(LinphoneManager.getLc());
|
||||
for (LinphoneCall call : calls) {
|
||||
List<Call> calls = LinphoneUtils.getCalls(LinphoneManager.getLc());
|
||||
for (Call call : calls) {
|
||||
if (State.IncomingReceived == call.getState()) {
|
||||
mCall = call;
|
||||
break;
|
||||
|
@ -291,7 +291,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
|
|||
}
|
||||
alreadyAcceptedOrDeniedCall = true;
|
||||
|
||||
LinphoneCallParams params = LinphoneManager.getLc().createCallParams(mCall);
|
||||
CallParams params = LinphoneManager.getLc().createCallParams(mCall);
|
||||
|
||||
boolean isLowBandwidthConnection = !LinphoneUtils.isHighBandwidthConnection(LinphoneService.instance().getApplicationContext());
|
||||
|
||||
|
|
|
@ -19,11 +19,11 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCallParams;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.Call;
|
||||
import org.linphone.core.CallParams;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
|
||||
|
@ -47,16 +47,16 @@ public class CallManager {
|
|||
|
||||
|
||||
|
||||
public void inviteAddress(LinphoneAddress lAddress, boolean videoEnabled, boolean lowBandwidth) throws LinphoneCoreException {
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
public void inviteAddress(Address lAddress, boolean videoEnabled, boolean lowBandwidth) throws CoreException {
|
||||
Core lc = LinphoneManager.getLc();
|
||||
|
||||
LinphoneCallParams params = lc.createCallParams(null);
|
||||
CallParams params = lc.createCallParams(null);
|
||||
bm().updateWithProfileSettings(lc, params);
|
||||
|
||||
if (videoEnabled && params.getVideoEnabled()) {
|
||||
params.setVideoEnabled(true);
|
||||
if (videoEnabled && params.videoEnabled()) {
|
||||
params.enableVideo(true);
|
||||
} else {
|
||||
params.setVideoEnabled(false);
|
||||
params.enableVideo(false);
|
||||
}
|
||||
|
||||
if (lowBandwidth) {
|
||||
|
@ -77,22 +77,22 @@ public class CallManager {
|
|||
* @return if updateCall called
|
||||
*/
|
||||
boolean reinviteWithVideo() {
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
LinphoneCall lCall = lc.getCurrentCall();
|
||||
Core lc = LinphoneManager.getLc();
|
||||
Call lCall = lc.getCurrentCall();
|
||||
if (lCall == null) {
|
||||
Log.e("Trying to reinviteWithVideo while not in call: doing nothing");
|
||||
return false;
|
||||
}
|
||||
LinphoneCallParams params = lc.createCallParams(lCall);
|
||||
CallParams params = lc.createCallParams(lCall);
|
||||
|
||||
if (params.getVideoEnabled()) return false;
|
||||
if (params.videoEnabled()) return false;
|
||||
|
||||
|
||||
// Check if video possible regarding bandwidth limitations
|
||||
bm().updateWithProfileSettings(lc, params);
|
||||
|
||||
// Abort if not enough bandwidth...
|
||||
if (!params.getVideoEnabled()) {
|
||||
if (!params.videoEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -107,13 +107,13 @@ public class CallManager {
|
|||
* Re-invite with parameters updated from profile.
|
||||
*/
|
||||
void reinvite() {
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
LinphoneCall lCall = lc.getCurrentCall();
|
||||
Core lc = LinphoneManager.getLc();
|
||||
Call lCall = lc.getCurrentCall();
|
||||
if (lCall == null) {
|
||||
Log.e("Trying to reinvite while not in call: doing nothing");
|
||||
return;
|
||||
}
|
||||
LinphoneCallParams params = lc.createCallParams(lCall);
|
||||
CallParams params = lc.createCallParams(lCall);
|
||||
bm().updateWithProfileSettings(lc, params);
|
||||
lc.updateCall(lCall, params);
|
||||
}
|
||||
|
@ -124,13 +124,13 @@ public class CallManager {
|
|||
* The camera will be restarted when mediastreamer chain is recreated and setParameters is called.
|
||||
*/
|
||||
public void updateCall() {
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
LinphoneCall lCall = lc.getCurrentCall();
|
||||
Core lc = LinphoneManager.getLc();
|
||||
Call lCall = lc.getCurrentCall();
|
||||
if (lCall == null) {
|
||||
Log.e("Trying to updateCall while not in call: doing nothing");
|
||||
return;
|
||||
}
|
||||
LinphoneCallParams params = lc.createCallParams(lCall);
|
||||
CallParams params = lc.createCallParams(lCall);
|
||||
bm().updateWithProfileSettings(lc, params);
|
||||
lc.updateCall(lCall, null);
|
||||
}
|
||||
|
|
|
@ -22,11 +22,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.Call;
|
||||
import org.linphone.core.Call.State;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.core.Reason;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
|
@ -51,8 +51,8 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
|
|||
|
||||
private TextView name, number;
|
||||
private ImageView contactPicture, micro, speaker, hangUp;
|
||||
private LinphoneCall mCall;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
private Call mCall;
|
||||
private CoreListenerStub mListener;
|
||||
private boolean isMicMuted, isSpeakerEnabled;
|
||||
|
||||
public static CallOutgoingActivity instance() {
|
||||
|
@ -93,9 +93,9 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
|
|||
hangUp = (ImageView) findViewById(R.id.outgoing_hang_up);
|
||||
hangUp.setOnClickListener(this);
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
mListener = new CoreListenerStub(){
|
||||
@Override
|
||||
public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) {
|
||||
public void onCallStateChanged(Core lc, Call call, Call.State state, String message) {
|
||||
if (call == mCall && State.Connected == state) {
|
||||
if (!LinphoneActivity.isInstanciated()) {
|
||||
return;
|
||||
|
@ -104,14 +104,14 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
|
|||
finish();
|
||||
return;
|
||||
} else if (state == State.Error) {
|
||||
// Convert LinphoneCore message for internalization
|
||||
// Convert Core message for internalization
|
||||
if (call.getErrorInfo().getReason() == Reason.Declined) {
|
||||
displayCustomToast(getString(R.string.error_call_declined), Toast.LENGTH_SHORT);
|
||||
decline();
|
||||
} else if (call.getErrorInfo().getReason() == Reason.NotFound) {
|
||||
displayCustomToast(getString(R.string.error_user_not_found), Toast.LENGTH_SHORT);
|
||||
decline();
|
||||
} else if (call.getErrorInfo().getReason() == Reason.Media) {
|
||||
} else if (call.getErrorInfo().getReason() == Reason.NotAcceptable) {
|
||||
displayCustomToast(getString(R.string.error_incompatible_media), Toast.LENGTH_SHORT);
|
||||
decline();
|
||||
} else if (call.getErrorInfo().getReason() == Reason.Busy) {
|
||||
|
@ -121,8 +121,8 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
|
|||
displayCustomToast(getString(R.string.error_unknown) + " - " + message, Toast.LENGTH_SHORT);
|
||||
decline();
|
||||
}
|
||||
}else if (state == State.CallEnd) {
|
||||
// Convert LinphoneCore message for internalization
|
||||
}else if (state == State.End) {
|
||||
// Convert Core message for internalization
|
||||
if (call.getErrorInfo().getReason() == Reason.Declined) {
|
||||
displayCustomToast(getString(R.string.error_call_declined), Toast.LENGTH_SHORT);
|
||||
decline();
|
||||
|
@ -142,7 +142,7 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
|
|||
protected void onResume() {
|
||||
super.onResume();
|
||||
instance = this;
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
|
@ -151,8 +151,8 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
|
|||
|
||||
// Only one call ringing at a time is allowed
|
||||
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) {
|
||||
List<LinphoneCall> calls = LinphoneUtils.getLinphoneCalls(LinphoneManager.getLc());
|
||||
for (LinphoneCall call : calls) {
|
||||
List<Call> calls = LinphoneUtils.getCalls(LinphoneManager.getLc());
|
||||
for (Call call : calls) {
|
||||
State cstate = call.getState();
|
||||
if (State.OutgoingInit == cstate || State.OutgoingProgress == cstate
|
||||
|| State.OutgoingRinging == cstate || State.OutgoingEarlyMedia == cstate) {
|
||||
|
@ -175,7 +175,7 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
|
|||
return;
|
||||
}
|
||||
|
||||
LinphoneAddress address = mCall.getRemoteAddress();
|
||||
Address address = mCall.getRemoteAddress();
|
||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address);
|
||||
if (contact != null) {
|
||||
LinphoneUtils.setImagePictureFromUri(this, contactPicture, contact.getPhotoUri(), contact.getThumbnailUri());
|
||||
|
@ -194,7 +194,7 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
|
|||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
|
|||
} else {
|
||||
micro.setImageResource(R.drawable.micro_default);
|
||||
}
|
||||
LinphoneManager.getLc().muteMic(isMicMuted);
|
||||
LinphoneManager.getLc().enableMic(!isMicMuted);
|
||||
}
|
||||
if (id == R.id.speaker) {
|
||||
isSpeakerEnabled = !isSpeakerEnabled;
|
||||
|
@ -227,7 +227,7 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
|
|||
} else {
|
||||
speaker.setImageResource(R.drawable.speaker_default);
|
||||
}
|
||||
LinphoneManager.getLc().enableSpeaker(isSpeakerEnabled);
|
||||
LinphoneManager.getInstance().enableSpeaker(isSpeakerEnabled);
|
||||
}
|
||||
if (id == R.id.outgoing_hang_up) {
|
||||
decline();
|
||||
|
|
|
@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.compatibility.CompatibilityScaleGestureDetector;
|
||||
import org.linphone.compatibility.CompatibilityScaleGestureListener;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.Call;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||
|
@ -57,7 +57,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view;
|
||||
if (LinphoneManager.getLc().hasCrappyOpenGL()) {
|
||||
if (LinphoneManager.getLc().hasCrappyOpengl()) {
|
||||
view = inflater.inflate(R.layout.video_no_opengl, container, false);
|
||||
} else {
|
||||
view = inflater.inflate(R.layout.video, container, false);
|
||||
|
@ -72,7 +72,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
androidVideoWindowImpl = new AndroidVideoWindowImpl(mVideoView, mCaptureView, new AndroidVideoWindowImpl.VideoWindowListener() {
|
||||
public void onVideoRenderingSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) {
|
||||
mVideoView = surface;
|
||||
LinphoneManager.getLc().setVideoWindow(vw);
|
||||
LinphoneManager.getLc().setNativeVideoWindowId(vw);
|
||||
}
|
||||
|
||||
public void onVideoRenderingSurfaceDestroyed(AndroidVideoWindowImpl vw) {
|
||||
|
@ -81,7 +81,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
|
||||
public void onVideoPreviewSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) {
|
||||
mCaptureView = surface;
|
||||
LinphoneManager.getLc().setPreviewWindow(mCaptureView);
|
||||
LinphoneManager.getLc().setNativePreviewWindowId(mCaptureView);
|
||||
}
|
||||
|
||||
public void onVideoPreviewSurfaceDestroyed(AndroidVideoWindowImpl vw) {
|
||||
|
@ -147,15 +147,17 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
|
||||
public void switchCamera() {
|
||||
try {
|
||||
int videoDeviceId = LinphoneManager.getLc().getVideoDevice();
|
||||
/*int videoDeviceId = LinphoneManager.getLc().getVideoDevice();
|
||||
videoDeviceId = (videoDeviceId + 1) % AndroidCameraConfiguration.retrieveCameras().length;
|
||||
LinphoneManager.getLc().setVideoDevice(videoDeviceId);
|
||||
LinphoneManager.getLc().setVideoDevice(videoDeviceId);*/
|
||||
Log.e("TODO FIXME switchCamera");
|
||||
|
||||
CallManager.getInstance().updateCall();
|
||||
|
||||
// previous call will cause graph reconstruction -> regive preview
|
||||
// window
|
||||
if (mCaptureView != null) {
|
||||
LinphoneManager.getLc().setPreviewWindow(mCaptureView);
|
||||
LinphoneManager.getLc().setNativePreviewWindowId(mCaptureView);
|
||||
}
|
||||
} catch (ArithmeticException ae) {
|
||||
Log.e("Cannot swtich camera : no camera");
|
||||
|
@ -171,7 +173,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
}
|
||||
if (androidVideoWindowImpl != null) {
|
||||
synchronized (androidVideoWindowImpl) {
|
||||
LinphoneManager.getLc().setVideoWindow(androidVideoWindowImpl);
|
||||
LinphoneManager.getLc().setNativeVideoWindowId(androidVideoWindowImpl);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,7 +189,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
* this call will destroy native opengl renderer which is used by
|
||||
* androidVideoWindowImpl
|
||||
*/
|
||||
LinphoneManager.getLc().setVideoWindow(null);
|
||||
LinphoneManager.getLc().setNativeVideoWindowId(null);
|
||||
}
|
||||
}
|
||||
if (LinphonePreferences.instance().isOverlayEnabled()) {
|
||||
|
@ -206,9 +208,9 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
float landscapeZoomFactor = ((float) mVideoView.getWidth()) / (float) ((3 * mVideoView.getHeight()) / 4);
|
||||
mZoomFactor = Math.max(0.1f, Math.min(mZoomFactor, Math.max(portraitZoomFactor, landscapeZoomFactor)));
|
||||
|
||||
LinphoneCall currentCall = LinphoneManager.getLc().getCurrentCall();
|
||||
Call currentCall = LinphoneManager.getLc().getCurrentCall();
|
||||
if (currentCall != null) {
|
||||
currentCall.zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY);
|
||||
currentCall.zoom(mZoomFactor, mZoomCenterX, mZoomCenterY);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -239,7 +241,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
if (mZoomCenterY < 0)
|
||||
mZoomCenterY = 0;
|
||||
|
||||
LinphoneManager.getLc().getCurrentCall().zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY);
|
||||
LinphoneManager.getLc().getCurrentCall().zoom(mZoomFactor, mZoomCenterX, mZoomCenterY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -262,7 +264,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
resetZoom();
|
||||
}
|
||||
|
||||
LinphoneManager.getLc().getCurrentCall().zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY);
|
||||
LinphoneManager.getLc().getCurrentCall().zoom(mZoomFactor, mZoomCenterX, mZoomCenterY);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,16 +77,18 @@ import android.widget.TextView;
|
|||
import android.widget.Toast;
|
||||
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneBuffer;
|
||||
import org.linphone.core.LinphoneChatMessage;
|
||||
import org.linphone.core.LinphoneChatMessage.State;
|
||||
import org.linphone.core.LinphoneChatRoom;
|
||||
import org.linphone.core.LinphoneContent;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.Buffer;
|
||||
import org.linphone.core.ChatMessage;
|
||||
import org.linphone.core.ChatMessage.State;
|
||||
import org.linphone.core.ChatMessageListener;
|
||||
import org.linphone.core.ChatRoom;
|
||||
import org.linphone.core.Content;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.core.Friend;
|
||||
import org.linphone.core.FriendList;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
@ -110,7 +112,7 @@ interface ChatUpdatedListener {
|
|||
void onChatUpdated();
|
||||
}
|
||||
|
||||
public class ChatFragment extends Fragment implements OnClickListener, LinphoneChatMessage.LinphoneChatMessageListener, ContactsUpdatedListener{
|
||||
public class ChatFragment extends Fragment implements OnClickListener, ChatMessageListener, ContactsUpdatedListener{
|
||||
private static final int ADD_PHOTO = 1337;
|
||||
private static final int MENU_DELETE_MESSAGE = 0;
|
||||
private static final int MENU_PICTURE_SMALL = 2;
|
||||
|
@ -124,7 +126,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
private static final int SIZE_LARGE = 1500;
|
||||
private static final int SIZE_MAX = 2048;
|
||||
|
||||
private LinphoneChatRoom chatRoom;
|
||||
private ChatRoom chatRoom;
|
||||
private String sipUri;
|
||||
private EditText message;
|
||||
private ImageView edit, selectAll, deselectAll, startCall, delete, sendImage, sendMessage, cancel;
|
||||
|
@ -145,7 +147,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
private ViewTreeObserver.OnGlobalLayoutListener keyboardListener;
|
||||
private ChatMessageAdapter adapter;
|
||||
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
private CoreListenerStub mListener;
|
||||
private boolean newChatConversation = false;
|
||||
private String fileSharedUri, fileAlreadySharedUri;
|
||||
|
||||
|
@ -238,8 +240,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
sendImage.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (LinphoneManager.getLc().getLimeEncryption() == LinphoneCore.LinphoneLimeState.Mandatory
|
||||
&& (chatRoom == null || !chatRoom.islimeAvailable())){
|
||||
if (LinphoneManager.getLc().limeEnabled() == Core.LimeState.Mandatory
|
||||
&& (chatRoom == null || !chatRoom.limeAvailable())){
|
||||
askingForLimeCall();
|
||||
return;
|
||||
}
|
||||
|
@ -259,10 +261,10 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
back.setOnClickListener(this);
|
||||
}
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
mListener = new CoreListenerStub(){
|
||||
@Override
|
||||
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
|
||||
LinphoneAddress from = cr.getPeerAddress();
|
||||
public void onMessageReceived(Core lc, ChatRoom cr, ChatMessage message) {
|
||||
Address from = cr.getPeerAddress();
|
||||
if (from.asStringUriOnly().equals(sipUri)) {
|
||||
//LinphoneService.instance().removeMessageNotification();
|
||||
cr.markAsRead();
|
||||
|
@ -270,7 +272,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
adapter.addMessage(message);
|
||||
|
||||
String externalBodyUrl = message.getExternalBodyUrl();
|
||||
LinphoneContent fileTransferContent = message.getFileTransferInformation();
|
||||
Content fileTransferContent = message.getFileTransferInformation();
|
||||
if (externalBodyUrl != null || fileTransferContent != null) {
|
||||
LinphoneActivity.instance().checkAndRequestExternalStoragePermission();
|
||||
}
|
||||
|
@ -283,7 +285,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
}
|
||||
|
||||
@Override
|
||||
public void isComposingReceived(LinphoneCore lc, LinphoneChatRoom room) {
|
||||
public void onIsComposingReceived(Core lc, ChatRoom room) {
|
||||
if (chatRoom != null && room != null && chatRoom.getPeerAddress().asStringUriOnly().equals(room.getPeerAddress().asStringUriOnly())) {
|
||||
remoteComposing.setVisibility(chatRoom.isRemoteComposing() ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
@ -390,8 +392,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
}
|
||||
|
||||
public void initChatRoom(String sipUri) {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
LinphoneAddress lAddress = null;
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Address lAddress = null;
|
||||
if (sipUri == null) {
|
||||
contact = null; // Tablet rotation issue
|
||||
initNewChatConversation();
|
||||
|
@ -412,7 +414,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
searchContactField.setVisibility(View.GONE);
|
||||
resultContactsSearch.setVisibility(View.GONE);
|
||||
displayChatHeader(lAddress);
|
||||
displayMessageList();
|
||||
removedList();
|
||||
remoteComposing.setVisibility(chatRoom.isRemoteComposing() ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
@ -426,7 +428,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
//messagesList.invalidateViews();
|
||||
}
|
||||
|
||||
private void displayMessageList() {
|
||||
private void removedList() {
|
||||
if (chatRoom != null) {
|
||||
if (adapter != null) {
|
||||
adapter.refreshHistory();
|
||||
|
@ -438,7 +440,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
messagesList.setVisibility(ListView.VISIBLE);
|
||||
}
|
||||
|
||||
private void displayChatHeader(LinphoneAddress address) {
|
||||
private void displayChatHeader(Address address) {
|
||||
if (contact != null || address != null) {
|
||||
if (contact != null) {
|
||||
contactName.setText(contact.getFullName());
|
||||
|
@ -473,8 +475,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
menu.add(v.getId(), MENU_COPY_TEXT, 0, getString(R.string.copy_text));
|
||||
}
|
||||
|
||||
/* LinphoneChatMessage msg = getMessageForId(v.getId());
|
||||
if (msg != null && msg.getStatus() == LinphoneChatMessage.State.NotDelivered) {
|
||||
/* ChatMessage msg = getMessageForId(v.getId());
|
||||
if (msg != null && msg.getStatus() == ChatMessage.State.NotDelivered) {
|
||||
menu.add(v.getId(), MENU_RESEND_MESSAGE, 0, getString(R.string.retry));
|
||||
}
|
||||
*/
|
||||
|
@ -485,7 +487,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
switch (item.getItemId()) {
|
||||
case MENU_DELETE_MESSAGE:
|
||||
if (chatRoom != null) {
|
||||
LinphoneChatMessage message = getMessageForId(item.getGroupId());
|
||||
ChatMessage message = getMessageForId(item.getGroupId());
|
||||
if (message != null) {
|
||||
chatRoom.deleteMessage(message);
|
||||
if (getResources().getBoolean(R.bool.isTablet) && chatRoom.getHistorySize() <= 0) {
|
||||
|
@ -529,7 +531,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
|
||||
LinphoneService.instance().removeMessageNotification();
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
@ -564,7 +566,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
message.addTextChangedListener(textWatcher);
|
||||
addVirtualKeyboardVisiblityListener();
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
|
@ -596,7 +598,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
newChatConversation = true;
|
||||
}
|
||||
|
||||
if(LinphoneManager.getLc().isIncall()){
|
||||
if(LinphoneManager.getLc().inCall()){
|
||||
backToCall.setVisibility(View.VISIBLE);
|
||||
startCall.setVisibility(View.GONE);
|
||||
} else {
|
||||
|
@ -632,7 +634,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
int size = messagesList.getAdapter().getCount();
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (messagesList.isItemChecked(i)) {
|
||||
LinphoneChatMessage message = (LinphoneChatMessage) messagesList.getAdapter().getItem(i);
|
||||
ChatMessage message = (ChatMessage) messagesList.getAdapter().getItem(i);
|
||||
chatRoom.deleteMessage(message);
|
||||
}
|
||||
}
|
||||
|
@ -731,12 +733,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
(searchContactField.getVisibility() == View.VISIBLE
|
||||
&& searchContactField.getText().toString().length() < 1))
|
||||
return;
|
||||
LinphoneCore.LinphoneLimeState state = LinphoneManager.getLc().getLimeEncryption();
|
||||
Core.LimeState state = LinphoneManager.getLc().limeEnabled();
|
||||
|
||||
if ((state == LinphoneCore.LinphoneLimeState.Disabled
|
||||
|| state == LinphoneCore.LinphoneLimeState.Preferred)
|
||||
|| (state == LinphoneCore.LinphoneLimeState.Mandatory
|
||||
&& chatRoom != null && chatRoom.islimeAvailable())){
|
||||
if ((state == Core.LimeState.Disabled
|
||||
|| state == Core.LimeState.Preferred)
|
||||
|| (state == Core.LimeState.Mandatory
|
||||
&& chatRoom != null && chatRoom.limeAvailable())){
|
||||
sendTextMessage(message.getText().toString());
|
||||
message.setText("");
|
||||
invalidate();
|
||||
|
@ -747,9 +749,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
}
|
||||
|
||||
private void sendTextMessage(String messageToSend) {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
boolean isNetworkReachable = lc == null ? false : lc.isNetworkReachable();
|
||||
LinphoneAddress lAddress = null;
|
||||
Address lAddress = null;
|
||||
|
||||
//Start new conversation in fast chat
|
||||
if(newChatConversation && chatRoom == null) {
|
||||
|
@ -759,7 +761,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
}
|
||||
}
|
||||
if (chatRoom != null && messageToSend != null && messageToSend.length() > 0 && isNetworkReachable) {
|
||||
LinphoneChatMessage message = chatRoom.createLinphoneChatMessage(messageToSend);
|
||||
ChatMessage message = chatRoom.createMessage(messageToSend);
|
||||
chatRoom.sendChatMessage(message);
|
||||
lAddress = chatRoom.getPeerAddress();
|
||||
|
||||
|
@ -774,7 +776,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
adapter.addMessage(message);
|
||||
}
|
||||
|
||||
Log.i("Sent message current status: " + message.getStatus());
|
||||
Log.i("Sent message current status: " + message.getState());
|
||||
} else if (!isNetworkReachable && LinphoneActivity.isInstanciated()) {
|
||||
LinphoneActivity.instance().displayCustomToast(getString(R.string.error_network_unreachable), Toast.LENGTH_LONG);
|
||||
}
|
||||
|
@ -787,7 +789,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
if(path.contains("%20")) {
|
||||
path = path.replace("%20", "-");
|
||||
}
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
boolean isNetworkReachable = lc == null ? false : lc.isNetworkReachable();
|
||||
if(newChatConversation && chatRoom == null) {
|
||||
String address = searchContactField.getText().toString();
|
||||
|
@ -826,7 +828,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
if(path.contains("%20")) {
|
||||
path = path.replace("%20", "-");
|
||||
}
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
boolean isNetworkReachable = lc == null ? false : lc.isNetworkReachable();
|
||||
if (newChatConversation && chatRoom == null) {
|
||||
String address = searchContactField.getText().toString();
|
||||
|
@ -882,14 +884,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
if(LinphoneManager.getLc().getLimeEncryption() == LinphoneCore.LinphoneLimeState.Mandatory)
|
||||
if(LinphoneManager.getLc().limeEnabled() == Core.LimeState.Mandatory)
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private LinphoneChatMessage getMessageForId(int id) {
|
||||
private ChatMessage getMessageForId(int id) {
|
||||
if (adapter == null) return null;
|
||||
for (int i = 0; i < adapter.getCount(); i++) {
|
||||
LinphoneChatMessage message = adapter.getItem(i);
|
||||
ChatMessage message = adapter.getItem(i);
|
||||
if (message.getStorageId() == id) {
|
||||
return message;
|
||||
}
|
||||
|
@ -907,29 +909,29 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
}
|
||||
}
|
||||
|
||||
private void resendMessage(LinphoneChatMessage message) {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (message == null || message.getStatus() != State.NotDelivered || !lc.isNetworkReachable())
|
||||
private void resendMessage(ChatMessage message) {
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (message == null || message.getState() != State.NotDelivered || !lc.isNetworkReachable())
|
||||
return;
|
||||
|
||||
message.reSend();
|
||||
message.resend();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
private void resendMessage(int id) {
|
||||
LinphoneChatMessage message = getMessageForId(id);
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (message == null || message.getStatus() != State.NotDelivered || !lc.isNetworkReachable()){
|
||||
ChatMessage message = getMessageForId(id);
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (message == null || message.getState() != State.NotDelivered || !lc.isNetworkReachable()){
|
||||
return;
|
||||
}
|
||||
message.reSend();
|
||||
message.resend();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
private void copyTextMessageToClipboard(int id) {
|
||||
LinphoneChatMessage message = null;
|
||||
ChatMessage message = null;
|
||||
for (int i = 0; i < adapter.getCount(); i++) {
|
||||
LinphoneChatMessage msg = adapter.getItem(i);
|
||||
ChatMessage msg = adapter.getItem(i);
|
||||
if (msg.getStorageId() == id) {
|
||||
message = msg;
|
||||
break;
|
||||
|
@ -987,12 +989,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
|
||||
public Uri getCVSPathFromLookupUri(String content) {
|
||||
String contactId = LinphoneUtils.getNameFromFilePath(content);
|
||||
LinphoneFriend[] friendList = LinphoneManager.getLc().getFriendList();
|
||||
for(LinphoneFriend friend : friendList){
|
||||
if(friend.getRefKey().toString().equals(contactId)) {
|
||||
String contactVcard = friend.getVcardToString();
|
||||
Uri path = LinphoneUtils.createCvsFromString(contactVcard);
|
||||
return path;
|
||||
FriendList[] friendList = LinphoneManager.getLc().getFriendsLists();
|
||||
for (FriendList list : friendList) {
|
||||
for (Friend friend : list.getFriends()) {
|
||||
if (friend.getRefKey().toString().equals(contactId)) {
|
||||
String contactVcard = friend.getVcard().asVcard4String();
|
||||
Uri path = LinphoneUtils.createCvsFromString(contactVcard);
|
||||
return path;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -1097,11 +1101,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
}
|
||||
String fileName = path.substring(path.lastIndexOf("/") + 1);
|
||||
String extension = LinphoneUtils.getExtensionFromFileName(fileName);
|
||||
LinphoneContent content = LinphoneCoreFactory.instance().createLinphoneContent("image", extension, result, null);
|
||||
Content content = chatRoom.getCore().createContent(); // "image", extension, result, null
|
||||
content.setType("image");
|
||||
content.setSubtype(extension);
|
||||
content.setBuffer(result, result.length);
|
||||
content.setName(fileName);
|
||||
LinphoneChatMessage message = chatRoom.createFileTransferMessage(content);
|
||||
ChatMessage message = chatRoom.createFileTransferMessage(content);
|
||||
message.setListener(LinphoneManager.getInstance());
|
||||
message.setAppData(path);
|
||||
message.setAppdata(path);
|
||||
|
||||
LinphoneManager.getInstance().setUploadPendingFileMessage(message);
|
||||
LinphoneManager.getInstance().setUploadingImage(result);
|
||||
|
@ -1151,12 +1158,16 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
|
||||
String fileName = path.substring(path.lastIndexOf("/") + 1);
|
||||
String extension = LinphoneUtils.getExtensionFromFileName(fileName);
|
||||
LinphoneContent content = LinphoneCoreFactory.instance().createLinphoneContent("file", extension, result, null);
|
||||
Content content = chatRoom.getCore().createContent();//"file", extension, result, null
|
||||
content.setType("file");
|
||||
content.setSubtype(extension);
|
||||
content.setBuffer(result, result.length);
|
||||
content.setName(fileName);
|
||||
content.setName(fileName);
|
||||
|
||||
LinphoneChatMessage message = chatRoom.createFileTransferMessage(content);
|
||||
ChatMessage message = chatRoom.createFileTransferMessage(content);
|
||||
message.setListener(LinphoneManager.getInstance());
|
||||
message.setAppData(path);
|
||||
message.setAppdata(path);
|
||||
|
||||
LinphoneManager.getInstance().setUploadPendingFileMessage(message);
|
||||
LinphoneManager.getInstance().setUploadingImage(result);
|
||||
|
@ -1293,7 +1304,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
}
|
||||
|
||||
class ChatMessageAdapter extends BaseAdapter {
|
||||
private class ViewHolder implements LinphoneChatMessage.LinphoneChatMessageListener {
|
||||
private class ViewHolder implements ChatMessageListener {
|
||||
public int id;
|
||||
public RelativeLayout bubbleLayout;
|
||||
public CheckBox delete;
|
||||
|
@ -1337,32 +1348,32 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state) {
|
||||
public void onMsgStateChanged(ChatMessage msg, State state) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLinphoneChatMessageFileTransferReceived(LinphoneChatMessage msg, LinphoneContent content, LinphoneBuffer buffer) {
|
||||
public void onFileTransferRecv(ChatMessage msg, Content content, Buffer buffer) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLinphoneChatMessageFileTransferSent(LinphoneChatMessage msg, LinphoneContent content, int offset, int size, LinphoneBuffer bufferToFill) {
|
||||
|
||||
public Buffer onFileTransferSend(ChatMessage message, Content content, int offset, int size) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLinphoneChatMessageFileTransferProgressChanged(LinphoneChatMessage msg, LinphoneContent content, int offset, int total) {
|
||||
public void onFileTransferProgressIndication(ChatMessage msg, Content content, int offset, int total) {
|
||||
if (msg.getStorageId() == id) fileTransferProgressBar.setProgress(offset * 100 / total);
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<LinphoneChatMessage> history;
|
||||
ArrayList<ChatMessage> history;
|
||||
Context context;
|
||||
|
||||
public ChatMessageAdapter(Context c) {
|
||||
context = c;
|
||||
history = new ArrayList<LinphoneChatMessage>();
|
||||
history = new ArrayList<ChatMessage>();
|
||||
refreshHistory();
|
||||
}
|
||||
|
||||
|
@ -1375,18 +1386,18 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
public void refreshHistory() {
|
||||
if (history == null || chatRoom == null) return;
|
||||
history.clear();
|
||||
LinphoneChatMessage[] messages = chatRoom.getHistory();
|
||||
ChatMessage[] messages = chatRoom.getHistory(0);
|
||||
history.addAll(Arrays.asList(messages));
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void addMessage(LinphoneChatMessage message) {
|
||||
public void addMessage(ChatMessage message) {
|
||||
history.add(message);
|
||||
notifyDataSetChanged();
|
||||
messagesList.setSelection(getCount() - 1);
|
||||
}
|
||||
|
||||
public void refreshMessageCell(LinphoneChatMessage msg){
|
||||
public void refreshMessageCell(ChatMessage msg){
|
||||
|
||||
}
|
||||
|
||||
|
@ -1396,7 +1407,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
}
|
||||
|
||||
@Override
|
||||
public LinphoneChatMessage getItem(int position) {
|
||||
public ChatMessage getItem(int position) {
|
||||
return history.get(position);
|
||||
}
|
||||
|
||||
|
@ -1407,7 +1418,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
final LinphoneChatMessage message = history.get(position);
|
||||
final ChatMessage message = history.get(position);
|
||||
View view = null;
|
||||
final ViewHolder holder;
|
||||
boolean sameMessage = false;
|
||||
|
@ -1426,8 +1437,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
if (holder.id == message.getStorageId()) {
|
||||
// Horrible workaround to not reload image on edit chat list
|
||||
if (holder.messageImage.getTag() != null
|
||||
&& (holder.messageImage.getTag().equals(message.getAppData())
|
||||
|| ((String) holder.messageImage.getTag()).substring(7).equals(message.getAppData()))
|
||||
&& (holder.messageImage.getTag().equals(message.getAppdata())
|
||||
|| ((String) holder.messageImage.getTag()).substring(7).equals(message.getAppdata()))
|
||||
){
|
||||
sameMessage = true;
|
||||
}
|
||||
|
@ -1440,19 +1451,19 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!message.isSecured() && !message.isOutgoing() &&
|
||||
LinphoneManager.getLc().getLimeEncryption() == LinphoneCore.LinphoneLimeState.Mandatory) {
|
||||
LinphoneManager.getLc().limeEnabled() == Core.LimeState.Mandatory) {
|
||||
LinphoneUtils.displayErrorAlert(getString(R.string.message_not_encrypted), LinphoneActivity.instance());
|
||||
}
|
||||
if(message.getStatus() == State.NotDelivered) {
|
||||
if(message.getState() == State.NotDelivered) {
|
||||
resendMessage(message);
|
||||
//resendMessage(holder.id);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
LinphoneChatMessage.State status = message.getStatus();
|
||||
ChatMessage.State status = message.getState();
|
||||
String externalBodyUrl = message.getExternalBodyUrl();
|
||||
LinphoneContent fileTransferContent = message.getFileTransferInformation();
|
||||
Content fileTransferContent = message.getFileTransferInformation();
|
||||
|
||||
holder.delete.setVisibility(View.GONE);
|
||||
holder.messageText.setVisibility(View.GONE);
|
||||
|
@ -1465,9 +1476,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
holder.messageStatus.setVisibility(View.INVISIBLE);
|
||||
holder.messageSendingInProgress.setVisibility(View.GONE);
|
||||
|
||||
String displayName = message.getFrom().getDisplayName();
|
||||
String displayName = message.getFromAddress().getDisplayName();
|
||||
if (displayName == null) {
|
||||
displayName = message.getFrom().getUserName();
|
||||
displayName = message.getFromAddress().getUsername();
|
||||
}
|
||||
if (!message.isOutgoing()) {
|
||||
if (contact != null) {
|
||||
|
@ -1487,11 +1498,11 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
}
|
||||
holder.contactName.setText(timestampToHumanDate(context, message.getTime()) + " - " + displayName);
|
||||
|
||||
if (status == LinphoneChatMessage.State.InProgress) {
|
||||
if (status == ChatMessage.State.InProgress) {
|
||||
holder.messageSendingInProgress.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (!message.isSecured() && !message.isOutgoing() &&
|
||||
LinphoneManager.getLc().getLimeEncryption() == LinphoneCore.LinphoneLimeState.Mandatory && status != LinphoneChatMessage.State.InProgress) {
|
||||
LinphoneManager.getLc().limeEnabled() == Core.LimeState.Mandatory && status != ChatMessage.State.InProgress) {
|
||||
holder.messageStatus.setVisibility(View.VISIBLE);
|
||||
holder.messageStatus.setImageResource(R.drawable.chat_unsecure);
|
||||
}
|
||||
|
@ -1520,14 +1531,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
|
||||
|
||||
if (externalBodyUrl != null || fileTransferContent != null) {
|
||||
String appData = message.getAppData();
|
||||
String appData = message.getAppdata();
|
||||
|
||||
|
||||
if (message.isOutgoing() && appData != null) {
|
||||
holder.messageImage.setVisibility(View.VISIBLE);
|
||||
if (!sameMessage) {
|
||||
loadBitmap(message.getAppData(), holder.messageImage);
|
||||
holder.messageImage.setTag(message.getAppData());
|
||||
loadBitmap(message.getAppdata(), holder.messageImage);
|
||||
holder.messageImage.setTag(message.getAppdata());
|
||||
}
|
||||
|
||||
if (LinphoneManager.getInstance().getMessageUploadPending() != null && LinphoneManager.getInstance().getMessageUploadPending().getStorageId() == message.getStorageId()) {
|
||||
|
@ -1560,9 +1571,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
holder.messageImage.setVisibility(View.VISIBLE);
|
||||
if (!sameMessage) {
|
||||
loadBitmap(appData, holder.messageImage);
|
||||
holder.messageImage.setTag(message.getAppData());
|
||||
holder.messageImage.setTag(message.getAppdata());
|
||||
}
|
||||
//displayMessageList();
|
||||
//removedList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1603,7 +1614,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
String filename = message.getFileTransferInformation().getName();
|
||||
String filename2 = context.getString(R.string.temp_photo_name_with_date).replace("%s", String.valueOf(System.currentTimeMillis())) ; //+ "." + extension;
|
||||
File file = new File(Environment.getExternalStorageDirectory(), filename);
|
||||
message.setAppData(file.getPath());
|
||||
message.setAppdata(file.getPath());
|
||||
LinphoneManager.getInstance().addDownloadMessagePending(message);
|
||||
message.setListener(LinphoneManager.getInstance());
|
||||
message.setFileTransferFilepath(file.getPath());
|
||||
|
@ -1643,12 +1654,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
}
|
||||
holder.bubbleLayout.setLayoutParams(layoutParams);
|
||||
|
||||
if(message.getAppData() != null && holder.fileTransferLayout.getVisibility() != View.VISIBLE){
|
||||
if(LinphoneUtils.isExtensionImage(message.getAppData())){
|
||||
if(message.getAppdata() != null && holder.fileTransferLayout.getVisibility() != View.VISIBLE){
|
||||
if(LinphoneUtils.isExtensionImage(message.getAppdata())){
|
||||
holder.fileExtensionLabel.setVisibility(View.GONE);
|
||||
holder.fileNameLabel.setVisibility(View.GONE);
|
||||
}else {
|
||||
String extension = (LinphoneUtils.getExtensionFromFileName(message.getAppData()));
|
||||
String extension = (LinphoneUtils.getExtensionFromFileName(message.getAppdata()));
|
||||
if(extension != null)
|
||||
extension = extension.toUpperCase();
|
||||
else
|
||||
|
@ -1659,7 +1670,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
|
||||
holder.fileExtensionLabel.setText(extension);
|
||||
holder.fileExtensionLabel.setVisibility(View.VISIBLE);
|
||||
holder.fileNameLabel.setText(LinphoneUtils.getNameFromFilePath(message.getAppData()));
|
||||
holder.fileNameLabel.setText(LinphoneUtils.getNameFromFilePath(message.getAppdata()));
|
||||
holder.fileNameLabel.setVisibility(View.VISIBLE);
|
||||
holder.fileExtensionLabel.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
|
@ -2058,18 +2069,20 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
}
|
||||
}
|
||||
|
||||
//LinphoneChatMessage Listener
|
||||
//ChatMessage Listener
|
||||
@Override
|
||||
public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state) {
|
||||
public void onMsgStateChanged(ChatMessage msg, State state) {
|
||||
redrawMessageList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLinphoneChatMessageFileTransferReceived(LinphoneChatMessage msg, LinphoneContent content, LinphoneBuffer buffer) {}
|
||||
public void onFileTransferRecv(ChatMessage msg, Content content, Buffer buffer) {}
|
||||
|
||||
@Override
|
||||
public void onLinphoneChatMessageFileTransferSent(LinphoneChatMessage msg, LinphoneContent content, int offset, int size, LinphoneBuffer bufferToFill) {}
|
||||
public Buffer onFileTransferSend(ChatMessage msg, Content content, int offset, int size) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLinphoneChatMessageFileTransferProgressChanged(LinphoneChatMessage msg, LinphoneContent content, int offset, int total) {}
|
||||
public void onFileTransferProgressIndication(ChatMessage msg, Content content, int offset, int total) {}
|
||||
}
|
||||
|
|
|
@ -43,13 +43,13 @@ import android.widget.LinearLayout;
|
|||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneChatMessage;
|
||||
import org.linphone.core.LinphoneChatRoom;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.ChatMessage;
|
||||
import org.linphone.core.ChatRoom;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -64,7 +64,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
|||
private ImageView edit, selectAll, deselectAll, delete, newDiscussion, cancel, backInCall;
|
||||
private LinearLayout editList, topbar;
|
||||
private boolean isEditMode = false;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
private CoreListenerStub mListener;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
|
@ -102,9 +102,9 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
|||
delete = (ImageView) view.findViewById(R.id.delete);
|
||||
delete.setOnClickListener(this);
|
||||
|
||||
mListener = new LinphoneCoreListenerBase() {
|
||||
mListener = new CoreListenerStub() {
|
||||
@Override
|
||||
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
|
||||
public void onMessageReceived(Core lc, ChatRoom cr, ChatMessage message) {
|
||||
refresh();
|
||||
}
|
||||
};
|
||||
|
@ -127,7 +127,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
|||
if (chatList.isItemChecked(i)) {
|
||||
String sipUri = chatList.getAdapter().getItem(i).toString();
|
||||
if (sipUri != null) {
|
||||
LinphoneChatRoom chatroom = LinphoneManager.getLc().getOrCreateChatRoom(sipUri);
|
||||
ChatRoom chatroom = LinphoneManager.getLc().getChatRoomFromUri(sipUri);
|
||||
if (chatroom != null) {
|
||||
chatroom.deleteHistory();
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
|||
LinphoneActivity.instance().hideTabBar(false);
|
||||
}
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
|||
|
||||
@Override
|
||||
public void onPause() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
@ -405,24 +405,19 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
|||
view.setTag(holder);
|
||||
}
|
||||
|
||||
LinphoneAddress address;
|
||||
try {
|
||||
address = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e("Chat view cannot parse address", e);
|
||||
return view;
|
||||
}
|
||||
Address address;
|
||||
address = Factory.instance().createAddress(sipUri);
|
||||
|
||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address);
|
||||
String message = "";
|
||||
Long time;
|
||||
|
||||
LinphoneChatRoom chatRoom = LinphoneManager.getLc().getChatRoom(address);
|
||||
ChatRoom chatRoom = LinphoneManager.getLc().getChatRoom(address);
|
||||
int unreadMessagesCount = chatRoom.getUnreadMessagesCount();
|
||||
LinphoneChatMessage[] history = chatRoom.getHistory(1);
|
||||
LinphoneChatMessage msg = history[0];
|
||||
ChatMessage[] history = chatRoom.getHistory(1);
|
||||
ChatMessage msg = history[0];
|
||||
|
||||
if(msg.getFileTransferInformation() != null || msg.getExternalBodyUrl() != null || msg.getAppData() != null ){
|
||||
if(msg.getFileTransferInformation() != null || msg.getExternalBodyUrl() != null || msg.getAppdata() != null ){
|
||||
holder.lastMessageView.setBackgroundResource(R.drawable.chat_file_message);
|
||||
time = msg.getTime();
|
||||
holder.date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),time,getString(R.string.messages_list_date_format)));
|
||||
|
|
|
@ -19,7 +19,7 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
|
@ -136,13 +136,13 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
tv.setSelected(true);
|
||||
|
||||
|
||||
LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
|
||||
ProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
|
||||
if (lpc != null) {
|
||||
String username = lpc.normalizePhoneNumber(displayednumberOrAddress);
|
||||
value = LinphoneUtils.getFullAddressFromUsername(username);
|
||||
}
|
||||
|
||||
String contactAddress = contact.getPresenceModelForUri(noa.getValue());
|
||||
String contactAddress = contact.getPresenceModelForUriOrTel(noa.getValue());
|
||||
if (contactAddress != null) {
|
||||
v.findViewById(R.id.friendLinphone).setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
|
|
@ -542,7 +542,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
holder.separator.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (contact.isInLinphoneFriendList()) {
|
||||
if (contact.isInFriendList()) {
|
||||
holder.linphoneFriend.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.linphoneFriend.setVisibility(View.GONE);
|
||||
|
@ -595,7 +595,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
holder.delete.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
/*LinphoneFriend[] friends = LinphoneManager.getLc().getFriendList();
|
||||
/*Friend[] friends = LinphoneManager.getLc().getFriendsLists();
|
||||
if (!ContactsManager.getInstance().isContactPresenceDisabled() && friends != null) {
|
||||
holder.friendStatus.setVisibility(View.VISIBLE);
|
||||
PresenceActivityType presenceActivity = friends[0].getPresenceModel().getActivity().getType();
|
||||
|
|
|
@ -36,11 +36,11 @@ import android.provider.ContactsContract;
|
|||
import android.provider.ContactsContract.CommonDataKinds;
|
||||
import android.provider.ContactsContract.Data;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
import org.linphone.core.LinphoneFriendImpl;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Friend;
|
||||
import org.linphone.core.FriendList;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -211,30 +211,31 @@ public class ContactsManager extends ContentObserver {
|
|||
initializeContactManager(context, contentResolver);
|
||||
}
|
||||
|
||||
public synchronized LinphoneContact findContactFromAddress(LinphoneAddress address) {
|
||||
public synchronized LinphoneContact findContactFromAddress(Address address) {
|
||||
String sipUri = address.asStringUriOnly();
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
LinphoneFriend lf = lc.findFriendByAddress(sipUri);
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Friend lf = lc.findFriend(address);
|
||||
if (lf != null) {
|
||||
LinphoneContact contact = (LinphoneContact)((LinphoneFriendImpl)lf).getUserData();
|
||||
LinphoneContact contact = (LinphoneContact)lf.getUserData();
|
||||
return contact;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized LinphoneContact findContactFromPhoneNumber(String phoneNumber) {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
LinphoneProxyConfig lpc = null;
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
ProxyConfig lpc = null;
|
||||
if (lc != null) {
|
||||
lpc = lc.getDefaultProxyConfig();
|
||||
}
|
||||
if (lpc == null) return null;
|
||||
String normalized = lpc.normalizePhoneNumber(phoneNumber);
|
||||
|
||||
LinphoneAddress addr = lpc.normalizeSipUri(normalized);
|
||||
LinphoneFriend lf = lc.findFriendByAddress(addr.asStringUriOnly() + ";user=phone"); // Without this, the hashmap inside liblinphone won't find it...
|
||||
Address addr = lpc.normalizeSipUri(normalized);
|
||||
addr.setMethodParam(";user=phone");
|
||||
Friend lf = lc.findFriend(addr); // Without this, the hashmap inside liblinphone won't find it...
|
||||
if (lf != null) {
|
||||
LinphoneContact contact = (LinphoneContact)((LinphoneFriendImpl)lf).getUserData();
|
||||
LinphoneContact contact = (LinphoneContact)lf.getUserData();
|
||||
return contact;
|
||||
}
|
||||
return null;
|
||||
|
@ -248,8 +249,8 @@ public class ContactsManager extends ContentObserver {
|
|||
sipContacts = c;
|
||||
}
|
||||
|
||||
public synchronized void refreshSipContact(LinphoneFriend lf) {
|
||||
LinphoneContact contact = (LinphoneContact)((LinphoneFriendImpl)lf).getUserData();
|
||||
public synchronized void refreshSipContact(Friend lf) {
|
||||
LinphoneContact contact = (LinphoneContact)lf.getUserData();
|
||||
if (contact != null && !sipContacts.contains(contact)) {
|
||||
sipContacts.add(contact);
|
||||
Collections.sort(sipContacts);
|
||||
|
@ -274,29 +275,31 @@ public class ContactsManager extends ContentObserver {
|
|||
Date contactsTime = new Date();
|
||||
androidContactsCache.clear();
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
for (LinphoneFriend friend : lc.getFriendList()) {
|
||||
LinphoneContact contact = (LinphoneContact)((LinphoneFriendImpl)friend).getUserData();
|
||||
if (contact != null) {
|
||||
contact.clearAddresses();
|
||||
contacts.add(contact);
|
||||
if (contact.getAndroidId() != null) {
|
||||
androidContactsCache.put(contact.getAndroidId(), contact);
|
||||
}
|
||||
} else {
|
||||
if (friend.getRefKey() != null) {
|
||||
// Friend has a refkey and but no LinphoneContact => represents a native contact stored in db from a previous version of Linphone, remove it
|
||||
lc.removeFriend(friend);
|
||||
} else {
|
||||
// No refkey so it's a standalone contact
|
||||
contact = new LinphoneContact();
|
||||
contact.setFriend(friend);
|
||||
contact.refresh();
|
||||
if (contact.hasAddress()) {
|
||||
sipContacts.add(contact);
|
||||
}
|
||||
for (FriendList list : lc.getFriendsLists()) {
|
||||
for (Friend friend : list.getFriends()) {
|
||||
LinphoneContact contact = (LinphoneContact) friend.getUserData();
|
||||
if (contact != null) {
|
||||
contact.clearAddresses();
|
||||
contacts.add(contact);
|
||||
if (contact.getAndroidId() != null) {
|
||||
androidContactsCache.put(contact.getAndroidId(), contact);
|
||||
}
|
||||
} else {
|
||||
if (friend.getRefKey() != null) {
|
||||
// Friend has a refkey and but no LinphoneContact => represents a native contact stored in db from a previous version of Linphone, remove it
|
||||
//lc.removeFriend(friend); //TODO FIXME
|
||||
} else {
|
||||
// No refkey so it's a standalone contact
|
||||
contact = new LinphoneContact();
|
||||
contact.setFriend(friend);
|
||||
contact.refresh();
|
||||
if (contact.hasAddress()) {
|
||||
sipContacts.add(contact);
|
||||
}
|
||||
contacts.add(contact);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -356,7 +359,7 @@ public class ContactsManager extends ContentObserver {
|
|||
String id = contact.getAndroidId();
|
||||
if (id != null && !nativeIds.contains(id)) {
|
||||
// Has been removed since last fetch
|
||||
lc.removeFriend(contact.getLinphoneFriend());
|
||||
//lc.removeFriend(contact.getFriend()); //TODO FIXME
|
||||
contacts.remove(contact);
|
||||
}
|
||||
}
|
||||
|
@ -405,8 +408,8 @@ public class ContactsManager extends ContentObserver {
|
|||
Log.i("[ContactsManager] Step 2 for " + contacts.size() + " contacts: " + time + " elapsed since starting");
|
||||
|
||||
for (LinphoneContact contact : contacts) {
|
||||
// Create the LinphoneFriends matching the native contacts
|
||||
contact.createOrUpdateLinphoneFriendFromNativeContact();
|
||||
// Create the Friends matching the native contacts
|
||||
contact.createOrUpdateFriendFromNativeContact();
|
||||
}
|
||||
timeElapsed = (new Date()).getTime() - contactsTime.getTime();
|
||||
time = String.format("%02d:%02d",
|
||||
|
@ -417,7 +420,7 @@ public class ContactsManager extends ContentObserver {
|
|||
|
||||
androidContactsCache.clear();
|
||||
} else {
|
||||
Log.w("[Permission] Read contacts permission wasn't granted, only fetch LinphoneFriends");
|
||||
Log.w("[Permission] Read contacts permission wasn't granted, only fetch Friends");
|
||||
}
|
||||
|
||||
Collections.sort(contacts);
|
||||
|
@ -427,9 +430,9 @@ public class ContactsManager extends ContentObserver {
|
|||
|
||||
if (LinphonePreferences.instance() != null && LinphonePreferences.instance().isFriendlistsubscriptionEnabled()) {
|
||||
if (getString(R.string.rls_uri) != null) {
|
||||
LinphoneManager.getLc().getFriendLists()[0].setRLSUri(getString(R.string.rls_uri));
|
||||
LinphoneManager.getLc().getFriendsLists()[0].setRlsUri(getString(R.string.rls_uri));
|
||||
}
|
||||
LinphoneManager.getLc().getFriendLists()[0].updateSubscriptions();
|
||||
LinphoneManager.getLc().getFriendsLists()[0].updateSubscriptions();
|
||||
}
|
||||
for (ContactsUpdatedListener listener : contactsUpdatedListeners) {
|
||||
listener.onContactsUpdated();
|
||||
|
|
|
@ -31,7 +31,7 @@ import android.view.ViewGroup;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.ui.AddressAware;
|
||||
import org.linphone.ui.AddressText;
|
||||
|
@ -69,7 +69,7 @@ public class DialerFragment extends Fragment {
|
|||
mCall.setImageResource(R.drawable.call_add);
|
||||
}
|
||||
} else {
|
||||
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getVideoAutoInitiatePolicy()) {
|
||||
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getVideoActivationPolicy().getAutomaticallyInitiate()) {
|
||||
mCall.setImageResource(R.drawable.call_video_start);
|
||||
} else {
|
||||
mCall.setImageResource(R.drawable.call_audio_start);
|
||||
|
@ -99,7 +99,7 @@ public class DialerFragment extends Fragment {
|
|||
transferListener = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
Core lc = LinphoneManager.getLc();
|
||||
if (lc.getCurrentCall() == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ public class DialerFragment extends Fragment {
|
|||
return;
|
||||
}
|
||||
isCallTransferOngoing = LinphoneActivity.instance().isCallTransfer();
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ public class DialerFragment extends Fragment {
|
|||
mAddContact.setImageResource(R.drawable.call_alt_back);
|
||||
mAddContact.setOnClickListener(cancelListener);
|
||||
} else {
|
||||
if (LinphoneManager.getLc().getVideoAutoInitiatePolicy()) {
|
||||
if (LinphoneManager.getLc().getVideoActivationPolicy().getAutomaticallyInitiate()) {
|
||||
mCall.setImageResource(R.drawable.call_video_start);
|
||||
} else {
|
||||
mCall.setImageResource(R.drawable.call_audio_start);
|
||||
|
|
|
@ -19,8 +19,8 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.content.Context;
|
||||
|
@ -38,9 +38,9 @@ public class DozeReceiver extends android.content.BroadcastReceiver {
|
|||
if (!LinphoneService.isReady()) return;
|
||||
|
||||
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
||||
LinphoneCoreFactory.instance().enableLogCollection(isDebugEnabled);
|
||||
LinphoneCoreFactory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name));
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Factory.instance().enableLogCollection(isDebugEnabled);
|
||||
Factory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name));
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc == null) return;
|
||||
|
||||
pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||
|
|
|
@ -29,9 +29,9 @@ import android.view.ViewGroup;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
||||
|
@ -103,12 +103,8 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
Long longDate = Long.parseLong(callDate);
|
||||
date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),longDate,getString(R.string.history_detail_date_format)));
|
||||
|
||||
LinphoneAddress lAddress = null;
|
||||
try {
|
||||
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
Address lAddress = null;
|
||||
lAddress = Factory.instance().createAddress(sipUri);
|
||||
|
||||
if (lAddress != null) {
|
||||
contactAddress.setText(lAddress.asStringUriOnly());
|
||||
|
@ -163,13 +159,9 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
LinphoneActivity.instance().displayChat(sipUri, null, null);
|
||||
} else if (id == R.id.add_contact) {
|
||||
String uri = sipUri;
|
||||
LinphoneAddress addr = null;
|
||||
try {
|
||||
addr = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
||||
uri = addr.asStringUriOnly();
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
Address addr = null;
|
||||
addr = Factory.instance().createAddress(sipUri);
|
||||
uri = addr.asStringUriOnly();
|
||||
if (addr != null && addr.getDisplayName() != null)
|
||||
LinphoneActivity.instance().displayContactsForEdition(addr.asStringUriOnly(), addr.getDisplayName());
|
||||
else
|
||||
|
|
|
@ -25,10 +25,11 @@ import java.util.Arrays;
|
|||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import org.linphone.core.CallDirection;
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCallLog;
|
||||
import org.linphone.core.LinphoneCallLog.CallStatus;
|
||||
import org.linphone.core.Call;
|
||||
import org.linphone.core.Call.Dir;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.CallLog;
|
||||
import org.linphone.core.CallLog.CallStatus;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
|
@ -62,7 +63,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
private View allCallsSelected, missedCallsSelected;
|
||||
private LinearLayout editList, topBar;
|
||||
private boolean onlyDisplayMissedCalls, isEditMode;
|
||||
private List<LinphoneCallLog> mLogs;
|
||||
private List<CallLog> mLogs;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
|
@ -123,11 +124,11 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
|
||||
public void displayFirstLog(){
|
||||
if (mLogs != null && mLogs.size() > 0) {
|
||||
LinphoneCallLog log = mLogs.get(0);
|
||||
if (log.getDirection() == CallDirection.Incoming) {
|
||||
LinphoneActivity.instance().displayHistoryDetail(mLogs.get(0).getFrom().toString(), mLogs.get(0));
|
||||
CallLog log = mLogs.get(0);
|
||||
if (log.getDir() == Call.Dir.Incoming) {
|
||||
LinphoneActivity.instance().displayHistoryDetail(mLogs.get(0).getFromAddress().toString(), mLogs.get(0));
|
||||
} else {
|
||||
LinphoneActivity.instance().displayHistoryDetail(mLogs.get(0).getTo().toString(), mLogs.get(0));
|
||||
LinphoneActivity.instance().displayHistoryDetail(mLogs.get(0).getToAddress().toString(), mLogs.get(0));
|
||||
}
|
||||
} else {
|
||||
LinphoneActivity.instance().displayEmptyFragment();
|
||||
|
@ -138,7 +139,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
int size = historyList.getAdapter().getCount();
|
||||
for(int i=0; i<size; i++) {
|
||||
if(historyList.isItemChecked(i)){
|
||||
LinphoneCallLog log = mLogs.get(i);
|
||||
CallLog log = mLogs.get(i);
|
||||
LinphoneManager.getLc().removeCallLog(log);
|
||||
}
|
||||
}
|
||||
|
@ -167,8 +168,8 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
|
||||
private void removeNotMissedCallsFromLogs() {
|
||||
if (onlyDisplayMissedCalls) {
|
||||
List<LinphoneCallLog> missedCalls = new ArrayList<LinphoneCallLog>();
|
||||
for (LinphoneCallLog log : mLogs) {
|
||||
List<CallLog> missedCalls = new ArrayList<CallLog>();
|
||||
for (CallLog log : mLogs) {
|
||||
if (log.getStatus() == CallStatus.Missed) {
|
||||
missedCalls.add(log);
|
||||
}
|
||||
|
@ -323,7 +324,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
@Override
|
||||
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
|
||||
if (isEditMode) {
|
||||
LinphoneCallLog log = mLogs.get(position);
|
||||
CallLog log = mLogs.get(position);
|
||||
LinphoneManager.getLc().removeCallLog(log);
|
||||
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
|
||||
}
|
||||
|
@ -428,9 +429,9 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
|
||||
if (mLogs == null || mLogs.size() < position) return view;
|
||||
|
||||
final LinphoneCallLog log = mLogs.get(position);
|
||||
long timestamp = log.getTimestamp();
|
||||
LinphoneAddress address;
|
||||
final CallLog log = mLogs.get(position);
|
||||
long timestamp = log.getStartDate();
|
||||
Address address;
|
||||
|
||||
holder.contact.setSelected(true); // For automated horizontal scrolling of long texts
|
||||
|
||||
|
@ -441,8 +442,8 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
separatorText.setText(timestampToHumanDate(logTime));
|
||||
|
||||
if (position > 0) {
|
||||
LinphoneCallLog previousLog = mLogs.get(position-1);
|
||||
long previousTimestamp = previousLog.getTimestamp();
|
||||
CallLog previousLog = mLogs.get(position-1);
|
||||
long previousTimestamp = previousLog.getStartDate();
|
||||
Calendar previousLogTime = Calendar.getInstance();
|
||||
previousLogTime.setTimeInMillis(previousTimestamp);
|
||||
|
||||
|
@ -455,15 +456,15 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
separator.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (log.getDirection() == CallDirection.Incoming) {
|
||||
address = log.getFrom();
|
||||
if (log.getDir() == Call.Dir.Incoming) {
|
||||
address = log.getFromAddress();
|
||||
if (log.getStatus() == CallStatus.Missed) {
|
||||
holder.callDirection.setImageResource(R.drawable.call_status_missed);
|
||||
} else {
|
||||
holder.callDirection.setImageResource(R.drawable.call_status_incoming);
|
||||
}
|
||||
} else {
|
||||
address = log.getTo();
|
||||
address = log.getToAddress();
|
||||
holder.callDirection.setImageResource(R.drawable.call_status_outgoing);
|
||||
}
|
||||
|
||||
|
@ -528,12 +529,12 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
if (LinphoneActivity.isInstanciated()) {
|
||||
LinphoneCallLog log = mLogs.get(position);
|
||||
LinphoneAddress address;
|
||||
if (log.getDirection() == CallDirection.Incoming) {
|
||||
address = log.getFrom();
|
||||
CallLog log = mLogs.get(position);
|
||||
Address address;
|
||||
if (log.getDir() == Call.Dir.Incoming) {
|
||||
address = log.getFromAddress();
|
||||
} else {
|
||||
address = log.getTo();
|
||||
address = log.getToAddress();
|
||||
}
|
||||
LinphoneActivity.instance().setAddresGoToDialerAndCall(address.asStringUriOnly(), address.getDisplayName(), null);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class HookReceiver extends BroadcastReceiver {
|
|||
if(b){
|
||||
//handset on
|
||||
Log.i(" ======>>>>>> HookReceiver - handset ON");
|
||||
LinphoneManager.getLc().enableSpeaker(false);
|
||||
LinphoneManager.getInstance().enableSpeaker(false);
|
||||
if(!LinphoneManager.getInstance().isHansetModeOn())
|
||||
LinphoneManager.getInstance().setHandsetMode(true);
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class HookReceiver extends BroadcastReceiver {
|
|||
}else{
|
||||
//handset off
|
||||
Log.i(" ======>>>>>> HookReceiver - handset OFF");
|
||||
LinphoneManager.getLc().enableSpeaker(true);
|
||||
LinphoneManager.getInstance().enableSpeaker(true);
|
||||
LinphoneManager.getInstance().setHandsetMode(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.app.AlarmManager;
|
||||
|
@ -41,9 +41,9 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
|||
return;
|
||||
} else {
|
||||
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
||||
LinphoneCoreFactory.instance().enableLogCollection(isDebugEnabled);
|
||||
LinphoneCoreFactory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name));
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Factory.instance().enableLogCollection(isDebugEnabled);
|
||||
Factory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name));
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc == null) return;
|
||||
|
||||
String action = intent.getAction();
|
||||
|
|
|
@ -66,21 +66,21 @@ import org.linphone.LinphoneManager.AddressType;
|
|||
import org.linphone.assistant.AssistantActivity;
|
||||
import org.linphone.assistant.RemoteProvisioningLoginActivity;
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.CallDirection;
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneAuthInfo;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCallLog;
|
||||
import org.linphone.core.LinphoneCallLog.CallStatus;
|
||||
import org.linphone.core.LinphoneChatMessage;
|
||||
import org.linphone.core.LinphoneChatRoom;
|
||||
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.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.Call.Dir;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.AuthInfo;
|
||||
import org.linphone.core.Call;
|
||||
import org.linphone.core.Call.State;
|
||||
import org.linphone.core.CallLog;
|
||||
import org.linphone.core.CallLog.CallStatus;
|
||||
import org.linphone.core.ChatMessage;
|
||||
import org.linphone.core.ChatRoom;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Core.RegistrationState;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
import org.linphone.core.Reason;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.purchase.InAppPurchaseActivity;
|
||||
|
@ -130,7 +130,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
private boolean emptyFragment = false;
|
||||
private boolean isTrialAccount = false;
|
||||
private OrientationEventListener mOrientationHelper;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
private CoreListenerStub mListener;
|
||||
private LinearLayout mTabBar;
|
||||
|
||||
private DrawerLayout sideMenu;
|
||||
|
@ -212,16 +212,16 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
currentFragment = (FragmentsAvailable) savedInstanceState.getSerializable("currentFragment");
|
||||
}
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
mListener = new CoreListenerStub(){
|
||||
@Override
|
||||
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
|
||||
public void onMessageReceived(Core lc, ChatRoom cr, ChatMessage message) {
|
||||
displayMissedChats(getUnreadMessageCount());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig proxy, LinphoneCore.RegistrationState state, String smessage) {
|
||||
LinphoneAuthInfo authInfo = lc.findAuthInfo(proxy.getIdentity(), proxy.getRealm(), proxy.getDomain());
|
||||
if (state.equals(RegistrationState.RegistrationCleared)) {
|
||||
public void onRegistrationStateChanged(Core lc, ProxyConfig proxy, Core.RegistrationState state, String smessage) {
|
||||
AuthInfo authInfo = lc.findAuthInfo(proxy.getRealm(), proxy.getIdentityAddress().getUsername(), proxy.getDomain());
|
||||
if (state.equals(RegistrationState.Cleared)) {
|
||||
if (lc != null) {
|
||||
if (authInfo != null)
|
||||
lc.removeAuthInfo(authInfo);
|
||||
|
@ -232,14 +232,14 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
|
||||
if(getResources().getBoolean(R.bool.use_phone_number_validation)
|
||||
&& authInfo != null && authInfo.getDomain().equals(getString(R.string.default_domain))) {
|
||||
if (state.equals(RegistrationState.RegistrationOk)) {
|
||||
if (state.equals(RegistrationState.Ok)) {
|
||||
LinphoneManager.getInstance().isAccountWithAlias();
|
||||
}
|
||||
}
|
||||
|
||||
if(state.equals(RegistrationState.RegistrationFailed) && newProxyConfig) {
|
||||
if(state.equals(RegistrationState.Failed) && newProxyConfig) {
|
||||
newProxyConfig = false;
|
||||
if (proxy.getError() == Reason.BadCredentials) {
|
||||
if (proxy.getError() == Reason.Forbidden) {
|
||||
//displayCustomToast(getString(R.string.error_bad_credentials), Toast.LENGTH_LONG);
|
||||
}
|
||||
if (proxy.getError() == Reason.Unauthorized) {
|
||||
|
@ -252,12 +252,12 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
}
|
||||
|
||||
@Override
|
||||
public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) {
|
||||
public void onCallStateChanged(Core lc, Call call, Call.State state, String message) {
|
||||
if (state == State.IncomingReceived) {
|
||||
startActivity(new Intent(LinphoneActivity.instance(), CallIncomingActivity.class));
|
||||
} else if (state == State.OutgoingInit || state == State.OutgoingProgress) {
|
||||
startActivity(new Intent(LinphoneActivity.instance(), CallOutgoingActivity.class));
|
||||
} else if (state == State.CallEnd || state == State.Error || state == State.CallReleased) {
|
||||
} else if (state == State.End || state == State.Error || state == State.Released) {
|
||||
resetClassicMenuLayoutAndGoBackToCallIfStillRunning();
|
||||
}
|
||||
|
||||
|
@ -536,22 +536,16 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
}
|
||||
}
|
||||
|
||||
public void displayHistoryDetail(String sipUri, LinphoneCallLog log) {
|
||||
LinphoneAddress lAddress;
|
||||
try {
|
||||
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e("Cannot display history details",e);
|
||||
//TODO display error message
|
||||
return;
|
||||
}
|
||||
public void displayHistoryDetail(String sipUri, CallLog log) {
|
||||
Address lAddress;
|
||||
lAddress = Factory.instance().createAddress(sipUri);
|
||||
LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(lAddress);
|
||||
|
||||
String displayName = c != null ? c.getFullName() : LinphoneUtils.getAddressDisplayName(sipUri);
|
||||
String pictureUri = c != null && c.getPhotoUri() != null ? c.getPhotoUri().toString() : null;
|
||||
|
||||
String status;
|
||||
if (log.getDirection() == CallDirection.Outgoing) {
|
||||
if (log.getDir() == Call.Dir.Outgoing) {
|
||||
status = getString(R.string.outgoing);
|
||||
} else {
|
||||
if (log.getStatus() == CallStatus.Missed) {
|
||||
|
@ -561,8 +555,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
}
|
||||
}
|
||||
|
||||
String callTime = secondsToDisplayableString(log.getCallDuration());
|
||||
String callDate = String.valueOf(log.getTimestamp());
|
||||
String callTime = secondsToDisplayableString(log.getDuration());
|
||||
String callDate = String.valueOf(log.getStartDate());
|
||||
|
||||
Fragment fragment2 = getFragmentManager().findFragmentById(R.id.fragmentContainer2);
|
||||
if (fragment2 != null && fragment2.isVisible() && currentFragment == FragmentsAvailable.HISTORY_DETAIL) {
|
||||
|
@ -645,8 +639,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
|
||||
public int getUnreadMessageCount() {
|
||||
int count = 0;
|
||||
LinphoneChatRoom[] chats = LinphoneManager.getLc().getChatRooms();
|
||||
for (LinphoneChatRoom chatroom : chats) {
|
||||
ChatRoom[] chats = LinphoneManager.getLc().getChatRooms();
|
||||
for (ChatRoom chatroom : chats) {
|
||||
count += chatroom.getUnreadMessagesCount();
|
||||
}
|
||||
return count;
|
||||
|
@ -661,15 +655,9 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
String thumbnailUri = null;
|
||||
String displayName = null;
|
||||
|
||||
LinphoneAddress lAddress = null;
|
||||
Address lAddress = null;
|
||||
if(sipUri != null) {
|
||||
try {
|
||||
lAddress = LinphoneManager.getLc().interpretUrl(sipUri);
|
||||
} catch (LinphoneCoreException e) {
|
||||
//TODO display error message
|
||||
Log.e("Cannot display chat", e);
|
||||
return;
|
||||
}
|
||||
lAddress = LinphoneManager.getLc().interpretUrl(sipUri);
|
||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(lAddress);
|
||||
displayName = contact != null ? contact.getFullName() : null;
|
||||
|
||||
|
@ -842,20 +830,20 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
}
|
||||
|
||||
static class ChatRoomContainer{
|
||||
private LinphoneChatRoom mCr;
|
||||
private ChatRoom mCr;
|
||||
long mTime;
|
||||
static public ChatRoomContainer createChatroomContainer(LinphoneChatRoom chatRoom) {
|
||||
static public ChatRoomContainer createChatroomContainer(ChatRoom chatRoom) {
|
||||
if (chatRoom.getHistorySize() <= 0) return null;
|
||||
return new ChatRoomContainer(chatRoom);
|
||||
}
|
||||
public ChatRoomContainer(LinphoneChatRoom chatroom){
|
||||
public ChatRoomContainer(ChatRoom chatroom){
|
||||
mCr = chatroom;
|
||||
LinphoneChatMessage[] lastMsg = chatroom.getHistory(1);
|
||||
ChatMessage[] lastMsg = chatroom.getHistory(1);
|
||||
if (lastMsg != null && lastMsg.length > 0 && lastMsg[0] != null) {
|
||||
mTime = lastMsg[0].getTime();
|
||||
}else mTime = 0;
|
||||
}
|
||||
LinphoneChatRoom getChatRoom(){
|
||||
ChatRoom getChatRoom(){
|
||||
return mCr;
|
||||
}
|
||||
long getTime(){
|
||||
|
@ -865,10 +853,10 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
public List<String> getChatList() {
|
||||
ArrayList<String> chatList = new ArrayList<String>();
|
||||
|
||||
LinphoneChatRoom[] chats = LinphoneManager.getLc().getChatRooms();
|
||||
ChatRoom[] chats = LinphoneManager.getLc().getChatRooms();
|
||||
List<ChatRoomContainer> rooms = new ArrayList<ChatRoomContainer>();
|
||||
|
||||
for (LinphoneChatRoom chatroom : chats) {
|
||||
for (ChatRoom chatroom : chats) {
|
||||
ChatRoomContainer crc = createChatroomContainer(chatroom);
|
||||
if (crc != null) rooms.add(crc);
|
||||
}
|
||||
|
@ -898,7 +886,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
}
|
||||
|
||||
public void removeFromChatList(String sipUri) {
|
||||
LinphoneChatRoom chatroom = LinphoneManager.getLc().getOrCreateChatRoom(sipUri);
|
||||
ChatRoom chatroom = LinphoneManager.getLc().getChatRoomFromUri(sipUri);
|
||||
chatroom.deleteHistory();
|
||||
}
|
||||
|
||||
|
@ -974,7 +962,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
String newPassword = ((EditText) dialog.findViewById(R.id.password)).getText().toString();
|
||||
LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(username, null, newPassword, null, realm, domain);
|
||||
AuthInfo authInfo = Factory.instance().createAuthInfo(username, null, newPassword, null, realm, domain);
|
||||
LinphoneManager.getLc().addAuthInfo(authInfo);
|
||||
LinphoneManager.getLc().refreshRegisters();
|
||||
dialog.dismiss();
|
||||
|
@ -1005,7 +993,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
LinphoneManager.getInstance().newOutgoingCall(address);
|
||||
}
|
||||
|
||||
public void startIncallActivity(LinphoneCall currentCall) {
|
||||
public void startIncallActivity(Call currentCall) {
|
||||
Intent intent = new Intent(this, CallActivity.class);
|
||||
startOrientationSensor();
|
||||
startActivityForResult(intent, CALL_ACTIVITY);
|
||||
|
@ -1049,11 +1037,11 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
|
||||
Log.d("Phone orientation changed to ", degrees);
|
||||
int rotation = (360 - degrees) % 360;
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.setDeviceRotation(rotation);
|
||||
LinphoneCall currentCall = lc.getCurrentCall();
|
||||
if (currentCall != null && currentCall.cameraEnabled() && currentCall.getCurrentParams().getVideoEnabled()) {
|
||||
Call currentCall = lc.getCurrentCall();
|
||||
if (currentCall != null && currentCall.cameraEnabled() && currentCall.getCurrentParams().videoEnabled()) {
|
||||
lc.updateCall(currentCall, null);
|
||||
}
|
||||
}
|
||||
|
@ -1079,8 +1067,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
}
|
||||
|
||||
if (LinphoneManager.isInstanciated() && LinphoneManager.getLc().getCallsNb() > 0) {
|
||||
LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
|
||||
if (call.getState() == LinphoneCall.State.IncomingReceived) {
|
||||
Call call = LinphoneManager.getLc().getCalls()[0];
|
||||
if (call.getState() == Call.State.IncomingReceived) {
|
||||
startActivity(new Intent(LinphoneActivity.this, CallIncomingActivity.class));
|
||||
} else {
|
||||
startIncallActivity(call);
|
||||
|
@ -1166,7 +1154,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
protected void onPause() {
|
||||
getIntent().putExtra("PreviousActivity", 0);
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
@ -1378,7 +1366,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
startService(new Intent(Intent.ACTION_MAIN).setClass(this, LinphoneService.class));
|
||||
}
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(mListener);
|
||||
if (!LinphoneService.instance().displayServiceNotification()) {
|
||||
|
@ -1411,12 +1399,12 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
|
||||
if (getIntent().getIntExtra("PreviousActivity", 0) != CALL_ACTIVITY && !doNotGoToCallActivity) {
|
||||
if (LinphoneManager.getLc().getCalls().length > 0) {
|
||||
LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
|
||||
LinphoneCall.State callState = call.getState();
|
||||
Call call = LinphoneManager.getLc().getCalls()[0];
|
||||
Call.State onCallStateChanged = call.getState();
|
||||
|
||||
if (callState == State.IncomingReceived) {
|
||||
if (onCallStateChanged == State.IncomingReceived) {
|
||||
startActivity(new Intent(this, CallIncomingActivity.class));
|
||||
} else if (callState == State.OutgoingInit || callState == State.OutgoingProgress || callState == State.OutgoingRinging) {
|
||||
} else if (onCallStateChanged == State.OutgoingInit || onCallStateChanged == State.OutgoingProgress || onCallStateChanged == State.OutgoingRinging) {
|
||||
startActivity(new Intent(this, CallOutgoingActivity.class));
|
||||
} else {
|
||||
startIncallActivity(call);
|
||||
|
@ -1496,7 +1484,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
displayInapp();
|
||||
} else if (extras != null && extras.getBoolean("Notification", false)) {
|
||||
if (LinphoneManager.getLc().getCallsNb() > 0) {
|
||||
LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
|
||||
Call call = LinphoneManager.getLc().getCalls()[0];
|
||||
startIncallActivity(call);
|
||||
}
|
||||
}else if (extras != null && extras.getBoolean("StartCall", false)) {
|
||||
|
@ -1528,8 +1516,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
}
|
||||
if (LinphoneManager.getLc().getCalls().length > 0) {
|
||||
// If a call is ringing, start incomingcallactivity
|
||||
Collection<LinphoneCall.State> incoming = new ArrayList<LinphoneCall.State>();
|
||||
incoming.add(LinphoneCall.State.IncomingReceived);
|
||||
Collection<Call.State> incoming = new ArrayList<Call.State>();
|
||||
incoming.add(Call.State.IncomingReceived);
|
||||
if (LinphoneUtils.getCallsInState(LinphoneManager.getLc(), incoming).size() > 0) {
|
||||
if (CallActivity.isInstanciated()) {
|
||||
CallActivity.instance().startIncomingCallActivity();
|
||||
|
@ -1629,13 +1617,13 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
});
|
||||
}
|
||||
|
||||
private int getStatusIconResource(LinphoneCore.RegistrationState state) {
|
||||
private int getStatusIconResource(Core.RegistrationState state) {
|
||||
try {
|
||||
if (state == RegistrationState.RegistrationOk) {
|
||||
if (state == RegistrationState.Ok) {
|
||||
return R.drawable.led_connected;
|
||||
} else if (state == RegistrationState.RegistrationProgress) {
|
||||
} else if (state == RegistrationState.Progress) {
|
||||
return R.drawable.led_inprogress;
|
||||
} else if (state == RegistrationState.RegistrationFailed) {
|
||||
} else if (state == RegistrationState.Failed) {
|
||||
return R.drawable.led_error;
|
||||
} else {
|
||||
return R.drawable.led_disconnected;
|
||||
|
@ -1654,7 +1642,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
TextView displayName = (TextView) defaultAccount.findViewById(R.id.main_account_display_name);
|
||||
|
||||
|
||||
LinphoneProxyConfig proxy = LinphoneManager.getLc().getDefaultProxyConfig();
|
||||
ProxyConfig proxy = LinphoneManager.getLc().getDefaultProxyConfig();
|
||||
if(proxy == null) {
|
||||
displayName.setText(getString(R.string.no_account));
|
||||
status.setVisibility(View.GONE);
|
||||
|
@ -1664,8 +1652,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
|
||||
defaultAccount.setOnClickListener(null);
|
||||
} else {
|
||||
address.setText(proxy.getAddress().asStringUriOnly());
|
||||
displayName.setText(LinphoneUtils.getAddressDisplayName(proxy.getAddress()));
|
||||
address.setText(proxy.getIdentityAddress().asStringUriOnly());
|
||||
displayName.setText(LinphoneUtils.getAddressDisplayName(proxy.getIdentityAddress()));
|
||||
status.setImageResource(getStatusIconResource(proxy.getState()));
|
||||
status.setVisibility(View.VISIBLE);
|
||||
|
||||
|
@ -1706,16 +1694,16 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
}
|
||||
|
||||
class AccountsListAdapter extends BaseAdapter {
|
||||
List<LinphoneProxyConfig> proxy_list;
|
||||
List<ProxyConfig> proxy_list;
|
||||
|
||||
AccountsListAdapter() {
|
||||
proxy_list = new ArrayList<LinphoneProxyConfig>();
|
||||
proxy_list = new ArrayList<ProxyConfig>();
|
||||
refresh();
|
||||
}
|
||||
|
||||
public void refresh(){
|
||||
proxy_list = new ArrayList<LinphoneProxyConfig>();
|
||||
for(LinphoneProxyConfig proxyConfig : LinphoneManager.getLc().getProxyConfigList()){
|
||||
proxy_list = new ArrayList<ProxyConfig>();
|
||||
for(ProxyConfig proxyConfig : LinphoneManager.getLc().getProxyConfigList()){
|
||||
if(proxyConfig != LinphoneManager.getLc().getDefaultProxyConfig()){
|
||||
proxy_list.add(proxyConfig);
|
||||
}
|
||||
|
@ -1740,7 +1728,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
View view = null;
|
||||
LinphoneProxyConfig lpc = (LinphoneProxyConfig) getItem(position);
|
||||
ProxyConfig lpc = (ProxyConfig) getItem(position);
|
||||
if (convertView != null) {
|
||||
view = convertView;
|
||||
} else {
|
||||
|
@ -1749,7 +1737,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
|
||||
ImageView status = (ImageView) view.findViewById(R.id.account_status);
|
||||
TextView address = (TextView) view.findViewById(R.id.account_address);
|
||||
String sipAddress = lpc.getAddress().asStringUriOnly();
|
||||
String sipAddress = lpc.getIdentityAddress().asStringUriOnly();
|
||||
|
||||
address.setText(sipAddress);
|
||||
|
||||
|
|
|
@ -25,12 +25,11 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
import org.linphone.core.LinphoneFriendImpl;
|
||||
import org.linphone.core.LinphoneFriend.SubscribePolicy;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.Friend;
|
||||
import org.linphone.core.Friend.SubscribePolicy;
|
||||
import org.linphone.core.PresenceBasicStatus;
|
||||
import org.linphone.core.PresenceModel;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
@ -47,7 +46,7 @@ import android.provider.ContactsContract.CommonDataKinds;
|
|||
public class LinphoneContact implements Serializable, Comparable<LinphoneContact> {
|
||||
private static final long serialVersionUID = 9015568163905205244L;
|
||||
|
||||
private transient LinphoneFriend friend;
|
||||
private transient Friend friend;
|
||||
private String fullName, firstName, lastName, androidId, androidRawId, androidTagId, organization;
|
||||
private transient Uri photoUri, thumbnailUri;
|
||||
private List<LinphoneNumberOrAddress> addresses;
|
||||
|
@ -258,7 +257,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
}
|
||||
}
|
||||
|
||||
if (isLinphoneFriend()) {
|
||||
if (isFriend()) {
|
||||
if (noa.isSIPAddress()) {
|
||||
if (!noa.getOldValue().startsWith("sip:")) {
|
||||
noa.setOldValue("sip:" + noa.getOldValue());
|
||||
|
@ -364,7 +363,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
}
|
||||
}
|
||||
}
|
||||
if (isLinphoneFriend()) {
|
||||
if (isFriend()) {
|
||||
if (noa.isSIPAddress()) {
|
||||
if (!noa.getValue().startsWith("sip:")) {
|
||||
noa.setValue("sip:" + noa.getValue());
|
||||
|
@ -399,35 +398,35 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
return androidId;
|
||||
}
|
||||
|
||||
public LinphoneFriend getLinphoneFriend() {
|
||||
public Friend getFriend() {
|
||||
return friend;
|
||||
}
|
||||
|
||||
private void createOrUpdateFriend() {
|
||||
boolean created = false;
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
|
||||
if (!isLinphoneFriend()) {
|
||||
if (!isFriend()) {
|
||||
friend = LinphoneManager.getLc().createFriend();
|
||||
friend.enableSubscribes(false);
|
||||
friend.setIncSubscribePolicy(SubscribePolicy.SPDeny);
|
||||
if (isAndroidContact()) {
|
||||
friend.setRefKey(getAndroidId());
|
||||
}
|
||||
((LinphoneFriendImpl)friend).setUserData(this);
|
||||
friend.setUserData(this);
|
||||
created = true;
|
||||
}
|
||||
if (isLinphoneFriend()) {
|
||||
if (isFriend()) {
|
||||
friend.edit();
|
||||
friend.setName(fullName);
|
||||
friend.setFamilyName(lastName);
|
||||
friend.setGivenName(firstName);
|
||||
friend.getVcard().setFamilyName(lastName);
|
||||
friend.getVcard().setGivenName(firstName);
|
||||
if (organization != null) {
|
||||
friend.setOrganization(organization);
|
||||
friend.getVcard().setOrganization(organization);
|
||||
}
|
||||
|
||||
if (!created) {
|
||||
for (LinphoneAddress address : friend.getAddresses()) {
|
||||
for (Address address : friend.getAddresses()) {
|
||||
friend.removeAddress(address);
|
||||
}
|
||||
for (String phone : friend.getPhoneNumbers()) {
|
||||
|
@ -436,13 +435,9 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
}
|
||||
for (LinphoneNumberOrAddress noa : addresses) {
|
||||
if (noa.isSIPAddress()) {
|
||||
try {
|
||||
LinphoneAddress addr = lc.interpretUrl(noa.getValue());
|
||||
if (addr != null) {
|
||||
friend.addAddress(addr);
|
||||
}
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e(e);
|
||||
Address addr = lc.interpretUrl(noa.getValue());
|
||||
if (addr != null) {
|
||||
friend.addAddress(addr);
|
||||
}
|
||||
} else {
|
||||
friend.addPhoneNumber(noa.getValue());
|
||||
|
@ -451,15 +446,11 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
friend.done();
|
||||
}
|
||||
if (created) {
|
||||
try {
|
||||
lc.addFriend(friend);
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
lc.addFriend(friend);
|
||||
}
|
||||
|
||||
if (!ContactsManager.getInstance().hasContactsAccess()) {
|
||||
// This refresh is only needed if app has no contacts permission to refresh the list of LinphoneFriends.
|
||||
// This refresh is only needed if app has no contacts permission to refresh the list of Friends.
|
||||
// Otherwise contacts will be refreshed due to changes in native contact and the handler in ContactsManager
|
||||
ContactsManager.getInstance().fetchContactsAsync();
|
||||
}
|
||||
|
@ -489,14 +480,14 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
save();
|
||||
ContactsManager.getInstance().delete(getAndroidId());
|
||||
}
|
||||
if (isLinphoneFriend()) {
|
||||
if (isFriend()) {
|
||||
deleteFriend();
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteFriend() {
|
||||
if (friend != null) {
|
||||
LinphoneManager.getLcIfManagerNotDestroyedOrNull().removeFriend(friend);
|
||||
//LinphoneManager.getLcIfManagerNotDestroyedOrNull().removeFriend(friend); //TODO FIXME
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -514,18 +505,18 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
for (LinphoneNumberOrAddress noa : getAddressesAndNumbersForAndroidContact()) {
|
||||
addNumberOrAddress(noa);
|
||||
}
|
||||
} else if (isLinphoneFriend()) {
|
||||
} else if (isFriend()) {
|
||||
fullName = friend.getName();
|
||||
lastName = friend.getFamilyName();
|
||||
firstName = friend.getGivenName();
|
||||
lastName = friend.getVcard().getFamilyName();
|
||||
firstName = friend.getVcard().getGivenName();
|
||||
thumbnailUri = null;
|
||||
photoUri = null;
|
||||
hasSipAddress = friend.getAddress() != null;
|
||||
organization = friend.getOrganization();
|
||||
organization = friend.getVcard().getOrganization();
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null && lc.isVCardSupported()) {
|
||||
for (LinphoneAddress addr : friend.getAddresses()) {
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null && lc.vcardSupported()) {
|
||||
for (Address addr : friend.getAddresses()) {
|
||||
if (addr != null) {
|
||||
addNumberOrAddress(new LinphoneNumberOrAddress(addr.asStringUriOnly(), true));
|
||||
}
|
||||
|
@ -536,13 +527,13 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
}
|
||||
}
|
||||
} else {
|
||||
LinphoneAddress addr = friend.getAddress();
|
||||
Address addr = friend.getAddress();
|
||||
addNumberOrAddress(new LinphoneNumberOrAddress(addr.asStringUriOnly(), true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void createOrUpdateLinphoneFriendFromNativeContact() {
|
||||
public void createOrUpdateFriendFromNativeContact() {
|
||||
if (isAndroidContact()) {
|
||||
createOrUpdateFriend();
|
||||
}
|
||||
|
@ -552,14 +543,14 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
return androidId != null;
|
||||
}
|
||||
|
||||
public boolean isLinphoneFriend() {
|
||||
public boolean isFriend() {
|
||||
return friend != null;
|
||||
}
|
||||
|
||||
public boolean isInLinphoneFriendList() {
|
||||
public boolean isInFriendList() {
|
||||
if (friend == null) return false;
|
||||
for (LinphoneNumberOrAddress noa : addresses) {
|
||||
PresenceModel pm = friend.getPresenceModelForUri(noa.getValue());
|
||||
PresenceModel pm = friend.getPresenceModelForUriOrTel(noa.getValue());
|
||||
if (pm != null && pm.getBasicStatus().equals(PresenceBasicStatus.Open)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -567,16 +558,16 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
return false;
|
||||
}
|
||||
|
||||
public String getPresenceModelForUri(String uri) {
|
||||
if (friend != null && friend.getPresenceModelForUri(uri) != null) {
|
||||
return friend.getPresenceModelForUri(uri).getContact();
|
||||
public String getPresenceModelForUriOrTel(String uri) {
|
||||
if (friend != null && friend.getPresenceModelForUriOrTel(uri) != null) {
|
||||
return friend.getPresenceModelForUriOrTel(uri).getContact();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setFriend(LinphoneFriend f) {
|
||||
public void setFriend(Friend f) {
|
||||
friend = f;
|
||||
((LinphoneFriendImpl)friend).setUserData(this);
|
||||
friend.setUserData(this);
|
||||
}
|
||||
|
||||
public void getAndroidIds() {
|
||||
|
@ -590,7 +581,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
if (ContactsManager.getInstance().hasContactsAccess()) {
|
||||
return createAndroidContact();
|
||||
}
|
||||
return createLinphoneFriend();
|
||||
return createFriend();
|
||||
}
|
||||
|
||||
private Uri getContactThumbnailPictureUri() {
|
||||
|
@ -701,14 +692,14 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
return contact;
|
||||
}
|
||||
|
||||
private static LinphoneContact createLinphoneFriend() {
|
||||
private static LinphoneContact createFriend() {
|
||||
LinphoneContact contact = new LinphoneContact();
|
||||
LinphoneFriend friend = LinphoneManager.getLc().createFriend();
|
||||
Friend friend = LinphoneManager.getLc().createFriend();
|
||||
// Disable subscribes for now
|
||||
friend.enableSubscribes(false);
|
||||
friend.setIncSubscribePolicy(SubscribePolicy.SPDeny);
|
||||
contact.friend = friend;
|
||||
((LinphoneFriendImpl)friend).setUserData(contact);
|
||||
friend.setUserData(contact);
|
||||
return contact;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
LinphoneCoreException.java
|
||||
CoreException.java
|
||||
Copyright (C) 2017 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
|
|
|
@ -29,7 +29,6 @@ import android.os.Handler;
|
|||
import org.linphone.assistant.RemoteProvisioningActivity;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.mediastream.Version;
|
||||
import org.linphone.tutorials.TutorialLauncherActivity;
|
||||
|
||||
import static android.content.Intent.ACTION_MAIN;
|
||||
|
||||
|
@ -99,9 +98,9 @@ public class LinphoneLauncherActivity extends Activity {
|
|||
|
||||
protected void onServiceReady() {
|
||||
final Class<? extends Activity> classToStart;
|
||||
if (getResources().getBoolean(R.bool.show_tutorials_instead_of_app)) {
|
||||
/*if (getResources().getBoolean(R.bool.show_tutorials_instead_of_app)) {
|
||||
classToStart = TutorialLauncherActivity.class;
|
||||
} else if (getResources().getBoolean(R.bool.display_sms_remote_provisioning_activity) && LinphonePreferences.instance().isFirstRemoteProvisioning()) {
|
||||
} else */if (getResources().getBoolean(R.bool.display_sms_remote_provisioning_activity) && LinphonePreferences.instance().isFirstRemoteProvisioning()) {
|
||||
classToStart = RemoteProvisioningActivity.class;
|
||||
} else {
|
||||
classToStart = LinphoneActivity.class;
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -24,17 +24,17 @@ import java.lang.reflect.Method;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCallLog.CallStatus;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCore.GlobalState;
|
||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.Call;
|
||||
import org.linphone.core.Call.State;
|
||||
import org.linphone.core.CallLog.CallStatus;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Core.GlobalState;
|
||||
import org.linphone.core.Core.RegistrationState;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.mediastream.Version;
|
||||
import org.linphone.ui.LinphoneOverlay;
|
||||
|
@ -119,7 +119,7 @@ public final class LinphoneService extends Service {
|
|||
private PendingIntent mNotifContentIntent;
|
||||
private String mNotificationTitle;
|
||||
private boolean mDisableRegistrationStatus;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
private CoreListenerStub mListener;
|
||||
public static int notifcationsPriority = (Version.sdkAboveOrEqual(Version.API16_JELLY_BEAN_41) ? Notification.PRIORITY_MIN : 0);
|
||||
private WindowManager mWindowManager;
|
||||
private LinphoneOverlay mOverlay;
|
||||
|
@ -268,11 +268,11 @@ public final class LinphoneService extends Service {
|
|||
public void showServiceNotification() {
|
||||
startForegroundCompat(NOTIF_ID, mNotif);
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc == null) return;
|
||||
LinphoneProxyConfig lpc = lc.getDefaultProxyConfig();
|
||||
ProxyConfig lpc = lc.getDefaultProxyConfig();
|
||||
if (lpc != null) {
|
||||
if (lpc.isRegistered()) {
|
||||
if (lpc.getState() == RegistrationState.Ok) {
|
||||
sendNotification(IC_LEVEL_ORANGE, R.string.notification_registered);
|
||||
} else {
|
||||
sendNotification(IC_LEVEL_ORANGE, R.string.notification_register_failure);
|
||||
|
@ -297,10 +297,10 @@ public final class LinphoneService extends Service {
|
|||
|
||||
// Needed in order for the two next calls to succeed, libraries must have been loaded first
|
||||
LinphonePreferences.instance().setContext(getBaseContext());
|
||||
LinphoneCoreFactory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath());
|
||||
Factory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath());
|
||||
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
||||
LinphoneCoreFactory.instance().enableLogCollection(isDebugEnabled);
|
||||
LinphoneCoreFactory.instance().setDebugMode(isDebugEnabled, getString(R.string.app_name));
|
||||
Factory.instance().enableLogCollection(isDebugEnabled);
|
||||
Factory.instance().setDebugMode(isDebugEnabled, getString(R.string.app_name));
|
||||
|
||||
// Dump some debugging information to the logs
|
||||
Log.i(START_LINPHONE_LOGS);
|
||||
|
@ -336,20 +336,20 @@ public final class LinphoneService extends Service {
|
|||
Log.e(e);
|
||||
}
|
||||
|
||||
LinphoneManager.getLc().addListener(mListener = new LinphoneCoreListenerBase() {
|
||||
LinphoneManager.getLc().addListener(mListener = new CoreListenerStub() {
|
||||
@Override
|
||||
public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) {
|
||||
public void onCallStateChanged(Core lc, Call call, Call.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) {
|
||||
if (state == Call.State.IncomingReceived) {
|
||||
if(! LinphoneManager.getInstance().getCallGsmON())
|
||||
onIncomingReceived();
|
||||
}
|
||||
|
||||
if (state == State.CallEnd || state == State.CallReleased || state == State.Error) {
|
||||
if (state == State.End || state == State.Released || state == State.Error) {
|
||||
if (LinphoneManager.isInstanciated() && LinphoneManager.getLc() != null && LinphoneManager.getLc().getCallsNb() == 0) {
|
||||
if (LinphoneActivity.isInstanciated() && LinphoneActivity.instance().getStatusFragment() != null) {
|
||||
removeSasNotification();
|
||||
|
@ -359,13 +359,13 @@ public final class LinphoneService extends Service {
|
|||
destroyOverlay();
|
||||
}
|
||||
|
||||
if (state == State.CallEnd && call.getCallLog().getStatus() == CallStatus.Missed) {
|
||||
if (state == State.End && call.getCallLog().getStatus() == CallStatus.Missed) {
|
||||
int missedCallCount = LinphoneManager.getLcIfManagerNotDestroyedOrNull().getMissedCallsCount();
|
||||
String body;
|
||||
if (missedCallCount > 1) {
|
||||
body = getString(R.string.missed_calls_notif_body).replace("%i", String.valueOf(missedCallCount));
|
||||
} else {
|
||||
LinphoneAddress address = call.getRemoteAddress();
|
||||
Address address = call.getRemoteAddress();
|
||||
LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(address);
|
||||
if (c != null) {
|
||||
body = c.getFullName();
|
||||
|
@ -396,28 +396,28 @@ public final class LinphoneService extends Service {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void globalState(LinphoneCore lc,LinphoneCore.GlobalState state, String message) {
|
||||
if (state == GlobalState.GlobalOn && displayServiceNotification()) {
|
||||
public void onGlobalStateChanged(Core lc,Core.GlobalState state, String message) {
|
||||
if (state == Core.GlobalState.On && displayServiceNotification()) {
|
||||
sendNotification(IC_LEVEL_ORANGE, R.string.notification_started);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState state, String smessage) {
|
||||
public void onRegistrationStateChanged(Core lc, ProxyConfig cfg, Core.RegistrationState state, String smessage) {
|
||||
// if (instance == null) {
|
||||
// Log.i("Service not ready, discarding registration state change to ",state.toString());
|
||||
// return;
|
||||
// }
|
||||
if (!mDisableRegistrationStatus) {
|
||||
if (displayServiceNotification() && state == RegistrationState.RegistrationOk && LinphoneManager.getLc().getDefaultProxyConfig() != null && LinphoneManager.getLc().getDefaultProxyConfig().isRegistered()) {
|
||||
if (displayServiceNotification() && state == RegistrationState.Ok && LinphoneManager.getLc().getDefaultProxyConfig() != null && LinphoneManager.getLc().getDefaultProxyConfig().getState() == RegistrationState.Ok) {
|
||||
sendNotification(IC_LEVEL_ORANGE, R.string.notification_registered);
|
||||
}
|
||||
|
||||
if (displayServiceNotification() && (state == RegistrationState.RegistrationFailed || state == RegistrationState.RegistrationCleared) && (LinphoneManager.getLc().getDefaultProxyConfig() == null || !LinphoneManager.getLc().getDefaultProxyConfig().isRegistered())) {
|
||||
if (displayServiceNotification() && (state == RegistrationState.Failed || state == RegistrationState.Cleared) && (LinphoneManager.getLc().getDefaultProxyConfig() == null || !(LinphoneManager.getLc().getDefaultProxyConfig().getState() == RegistrationState.Ok))) {
|
||||
sendNotification(IC_LEVEL_ORANGE, R.string.notification_register_failure);
|
||||
}
|
||||
|
||||
if (displayServiceNotification() && state == RegistrationState.RegistrationNone) {
|
||||
if (displayServiceNotification() && state == RegistrationState.None) {
|
||||
sendNotification(IC_LEVEL_ORANGE, R.string.notification_started);
|
||||
}
|
||||
}
|
||||
|
@ -462,8 +462,8 @@ public final class LinphoneService extends Service {
|
|||
public void createOverlay() {
|
||||
if (mOverlay != null) destroyOverlay();
|
||||
|
||||
LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
|
||||
if (call == null || !call.getCurrentParams().getVideoEnabled()) return;
|
||||
Call call = LinphoneManager.getLc().getCurrentCall();
|
||||
if (call == null || !call.getCurrentParams().videoEnabled()) return;
|
||||
|
||||
mOverlay = new LinphoneOverlay(this);
|
||||
WindowManager.LayoutParams params = mOverlay.getWindowManagerLayoutParams();
|
||||
|
@ -517,11 +517,11 @@ public final class LinphoneService extends Service {
|
|||
return;
|
||||
}
|
||||
|
||||
LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
|
||||
String userName = call.getRemoteAddress().getUserName();
|
||||
Call call = LinphoneManager.getLc().getCalls()[0];
|
||||
String userName = call.getRemoteAddress().getUsername();
|
||||
String domain = call.getRemoteAddress().getDomain();
|
||||
String displayName = call.getRemoteAddress().getDisplayName();
|
||||
LinphoneAddress address = LinphoneCoreFactory.instance().createLinphoneAddress(userName,domain,null);
|
||||
Address address = Factory.instance().createAddress(userName + "@" + domain);
|
||||
address.setDisplayName(displayName);
|
||||
|
||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address);
|
||||
|
@ -532,7 +532,7 @@ public final class LinphoneService extends Service {
|
|||
} catch (Exception e) {
|
||||
bm = BitmapFactory.decodeResource(getResources(), R.drawable.avatar);
|
||||
}
|
||||
String name = address.getDisplayName() == null ? address.getUserName() : address.getDisplayName();
|
||||
String name = address.getDisplayName() == null ? address.getUsername() : address.getDisplayName();
|
||||
Intent notifIntent = new Intent(this, incomingReceivedActivity);
|
||||
notifIntent.putExtra("Notification", true);
|
||||
mNotifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
@ -545,10 +545,10 @@ public final class LinphoneService extends Service {
|
|||
}
|
||||
}
|
||||
|
||||
public void refreshIncallIcon(LinphoneCall currentCall) {
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
public void refreshIncallIcon(Call currentCall) {
|
||||
Core lc = LinphoneManager.getLc();
|
||||
if (currentCall != null) {
|
||||
if (currentCall.getCurrentParams().getVideoEnabled() && currentCall.cameraEnabled()) {
|
||||
if (currentCall.getCurrentParams().videoEnabled() && currentCall.cameraEnabled()) {
|
||||
// checking first current params is mandatory
|
||||
setIncallIcon(IncallIconState.VIDEO);
|
||||
} else {
|
||||
|
@ -556,7 +556,7 @@ public final class LinphoneService extends Service {
|
|||
}
|
||||
} else if (lc.getCallsNb() == 0) {
|
||||
setIncallIcon(IncallIconState.IDLE);
|
||||
} else if (lc.isInConference()) {
|
||||
} else if (lc.getConference() != null) {
|
||||
setIncallIcon(IncallIconState.INCALL);
|
||||
} else {
|
||||
setIncallIcon(IncallIconState.PAUSE);
|
||||
|
@ -590,7 +590,7 @@ public final class LinphoneService extends Service {
|
|||
resetIntentLaunchedOnNotificationClick();
|
||||
}
|
||||
|
||||
public void displayMessageNotification(String to, String fromSipUri, String fromName, String message) {
|
||||
public void removedNotification(String to, String fromSipUri, String fromName, String message) {
|
||||
Intent notifIntent = new Intent(this, LinphoneActivity.class);
|
||||
notifIntent.putExtra("GoToChat", true);
|
||||
notifIntent.putExtra("ChatContactSipUri", fromSipUri);
|
||||
|
@ -608,13 +608,9 @@ public final class LinphoneService extends Service {
|
|||
}
|
||||
|
||||
Uri pictureUri = null;
|
||||
try {
|
||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(LinphoneCoreFactory.instance().createLinphoneAddress(fromSipUri));
|
||||
if (contact != null)
|
||||
pictureUri = contact.getThumbnailUri();
|
||||
} catch (LinphoneCoreException e1) {
|
||||
Log.e("Cannot parse from address ", e1);
|
||||
}
|
||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(Factory.instance().createAddress(fromSipUri));
|
||||
if (contact != null)
|
||||
pictureUri = contact.getThumbnailUri();
|
||||
|
||||
Bitmap bm = null;
|
||||
if (pictureUri != null) {
|
||||
|
@ -764,8 +760,8 @@ public final class LinphoneService extends Service {
|
|||
String text = getString(textId);
|
||||
if (text.contains("%s") && LinphoneManager.getLc() != null) {
|
||||
// Test for null lc is to avoid a NPE when Android mess up badly with the String resources.
|
||||
LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
|
||||
String id = lpc != null ? lpc.getIdentity() : "";
|
||||
ProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
|
||||
String id = lpc != null ? lpc.getIdentityAddress().asString() : "";
|
||||
text = String.format(text, id);
|
||||
}
|
||||
|
||||
|
@ -805,7 +801,7 @@ public final class LinphoneService extends Service {
|
|||
|
||||
// If push is enabled, don't unregister account, otherwise do unregister
|
||||
if (LinphonePreferences.instance().isPushNotificationEnabled()) {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) lc.setNetworkReachable(false);
|
||||
}
|
||||
stopSelf();
|
||||
|
@ -822,7 +818,7 @@ public final class LinphoneService extends Service {
|
|||
}
|
||||
|
||||
destroyOverlay();
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
@ -877,7 +873,7 @@ public final class LinphoneService extends Service {
|
|||
public void tryingNewOutgoingCallButWrongDestinationAddress() {
|
||||
}
|
||||
|
||||
public void onCallEncryptionChanged(final LinphoneCall call, final boolean encrypted,
|
||||
public void onCallEncryptionChanged(final Call call, final boolean encrypted,
|
||||
final String authenticationToken) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,15 +52,15 @@ import android.widget.TextView;
|
|||
import android.widget.Toast;
|
||||
|
||||
import org.linphone.core.DialPlan;
|
||||
import org.linphone.core.LinphoneAccountCreator;
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneChatMessage;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.AccountCreator;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.Call;
|
||||
import org.linphone.core.Call.State;
|
||||
import org.linphone.core.ChatMessage;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
||||
|
||||
|
@ -104,16 +104,12 @@ public final class LinphoneUtils {
|
|||
//private static final String strictSipAddressRegExp = "^sip:(\\+)?[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\\.-][a-z0-9]+)*)+\\.[a-z]{2,}$";
|
||||
|
||||
public static boolean isSipAddress(String numberOrAddress) {
|
||||
try {
|
||||
LinphoneCoreFactory.instance().createLinphoneAddress(numberOrAddress);
|
||||
return true;
|
||||
} catch (LinphoneCoreException e) {
|
||||
return false;
|
||||
}
|
||||
Factory.instance().createAddress(numberOrAddress);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isNumberAddress(String numberOrAddress) {
|
||||
LinphoneProxyConfig proxy = LinphoneManager.getLc().createProxyConfig();
|
||||
ProxyConfig proxy = LinphoneManager.getLc().createProxyConfig();
|
||||
return proxy.normalizePhoneNumber(numberOrAddress) != null;
|
||||
}
|
||||
|
||||
|
@ -122,21 +118,17 @@ public final class LinphoneUtils {
|
|||
}
|
||||
|
||||
public static String getAddressDisplayName(String uri){
|
||||
LinphoneAddress lAddress;
|
||||
try {
|
||||
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(uri);
|
||||
return getAddressDisplayName(lAddress);
|
||||
} catch (LinphoneCoreException e) {
|
||||
return null;
|
||||
}
|
||||
Address lAddress;
|
||||
lAddress = Factory.instance().createAddress(uri);
|
||||
return getAddressDisplayName(lAddress);
|
||||
}
|
||||
|
||||
public static String getAddressDisplayName(LinphoneAddress address){
|
||||
public static String getAddressDisplayName(Address address){
|
||||
if(address.getDisplayName() != null) {
|
||||
return address.getDisplayName();
|
||||
} else {
|
||||
if(address.getUserName() != null){
|
||||
return address.getUserName();
|
||||
if(address.getUsername() != null){
|
||||
return address.getUsername();
|
||||
} else {
|
||||
return address.asStringUriOnly();
|
||||
}
|
||||
|
@ -289,33 +281,33 @@ public final class LinphoneUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static final List<LinphoneCall> getLinphoneCallsNotInConf(LinphoneCore lc) {
|
||||
List<LinphoneCall> l=new ArrayList<LinphoneCall>();
|
||||
for(LinphoneCall c : lc.getCalls()){
|
||||
if (!c.isInConference()){
|
||||
public static final List<Call> getCallsNotInConf(Core lc) {
|
||||
List<Call> l=new ArrayList<Call>();
|
||||
for(Call c : lc.getCalls()){
|
||||
if (!(c.getConference() != null)){
|
||||
l.add(c);
|
||||
}
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
public static final List<LinphoneCall> getLinphoneCallsInConf(LinphoneCore lc) {
|
||||
List<LinphoneCall> l=new ArrayList<LinphoneCall>();
|
||||
for(LinphoneCall c : lc.getCalls()){
|
||||
if (c.isInConference()){
|
||||
public static final List<Call> getCallsInConf(Core lc) {
|
||||
List<Call> l=new ArrayList<Call>();
|
||||
for(Call c : lc.getCalls()){
|
||||
if ((c.getConference() != null)){
|
||||
l.add(c);
|
||||
}
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
public static final List<LinphoneCall> getLinphoneCalls(LinphoneCore lc) {
|
||||
public static final List<Call> getCalls(Core lc) {
|
||||
// return a modifiable list
|
||||
return new ArrayList<LinphoneCall>(Arrays.asList(lc.getCalls()));
|
||||
return new ArrayList<Call>(Arrays.asList(lc.getCalls()));
|
||||
}
|
||||
|
||||
public static final boolean hasExistingResumeableCall(LinphoneCore lc) {
|
||||
for (LinphoneCall c : getLinphoneCalls(lc)) {
|
||||
public static final boolean hasExistingResumeableCall(Core lc) {
|
||||
for (Call c : getCalls(lc)) {
|
||||
if (c.getState() == State.Paused) {
|
||||
return true;
|
||||
}
|
||||
|
@ -323,32 +315,32 @@ public final class LinphoneUtils {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static final List<LinphoneCall> getCallsInState(LinphoneCore lc, Collection<State> states) {
|
||||
List<LinphoneCall> foundCalls = new ArrayList<LinphoneCall>();
|
||||
for (LinphoneCall call : getLinphoneCalls(lc)) {
|
||||
public static final List<Call> getCallsInState(Core lc, Collection<State> states) {
|
||||
List<Call> foundCalls = new ArrayList<Call>();
|
||||
for (Call call : getCalls(lc)) {
|
||||
if (states.contains(call.getState())) {
|
||||
foundCalls.add(call);
|
||||
}
|
||||
}
|
||||
return foundCalls;
|
||||
}
|
||||
public static final List<LinphoneCall> getRunningOrPausedCalls(LinphoneCore lc) {
|
||||
public static final List<Call> getRunningOrPausedCalls(Core lc) {
|
||||
return getCallsInState(lc, Arrays.asList(
|
||||
State.Paused,
|
||||
State.PausedByRemote,
|
||||
State.StreamsRunning));
|
||||
}
|
||||
|
||||
public static final int countConferenceCalls(LinphoneCore lc) {
|
||||
public static final int countConferenceCalls(Core lc) {
|
||||
int count = lc.getConferenceSize();
|
||||
if (lc.isInConference()) count--;
|
||||
if ((lc.getConference() != null)) count--;
|
||||
return count;
|
||||
}
|
||||
|
||||
public static int countVirtualCalls(LinphoneCore lc) {
|
||||
public static int countVirtualCalls(Core lc) {
|
||||
return lc.getCallsNb() - countConferenceCalls(lc);
|
||||
}
|
||||
public static int countNonConferenceCalls(LinphoneCore lc) {
|
||||
public static int countNonConferenceCalls(Core lc) {
|
||||
return lc.getCallsNb() - countConferenceCalls(lc);
|
||||
}
|
||||
|
||||
|
@ -368,32 +360,32 @@ public final class LinphoneUtils {
|
|||
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) pixels, res.getDisplayMetrics());
|
||||
}
|
||||
|
||||
public static boolean isCallRunning(LinphoneCall call)
|
||||
public static boolean isCallRunning(Call call)
|
||||
{
|
||||
if (call == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LinphoneCall.State state = call.getState();
|
||||
Call.State state = call.getState();
|
||||
|
||||
return state == LinphoneCall.State.Connected ||
|
||||
state == LinphoneCall.State.CallUpdating ||
|
||||
state == LinphoneCall.State.CallUpdatedByRemote ||
|
||||
state == LinphoneCall.State.StreamsRunning ||
|
||||
state == LinphoneCall.State.Resuming;
|
||||
return state == Call.State.Connected ||
|
||||
state == Call.State.Updating ||
|
||||
state == Call.State.UpdatedByRemote ||
|
||||
state == Call.State.StreamsRunning ||
|
||||
state == Call.State.Resuming;
|
||||
}
|
||||
|
||||
public static boolean isCallEstablished(LinphoneCall call) {
|
||||
public static boolean isCallEstablished(Call call) {
|
||||
if (call == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LinphoneCall.State state = call.getState();
|
||||
Call.State state = call.getState();
|
||||
|
||||
return isCallRunning(call) ||
|
||||
state == LinphoneCall.State.Paused ||
|
||||
state == LinphoneCall.State.PausedByRemote ||
|
||||
state == LinphoneCall.State.Pausing;
|
||||
state == Call.State.Paused ||
|
||||
state == Call.State.PausedByRemote ||
|
||||
state == Call.State.Pausing;
|
||||
}
|
||||
|
||||
public static boolean isHighBandwidthConnection(Context context){
|
||||
|
@ -523,7 +515,7 @@ public final class LinphoneUtils {
|
|||
|
||||
public static String getDisplayableUsernameFromAddress(String sipAddress) {
|
||||
String username = sipAddress;
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc == null) return username;
|
||||
|
||||
if (username.startsWith("sip:")) {
|
||||
|
@ -532,7 +524,7 @@ public final class LinphoneUtils {
|
|||
|
||||
if (username.contains("@")) {
|
||||
String domain = username.split("@")[1];
|
||||
LinphoneProxyConfig lpc = lc.getDefaultProxyConfig();
|
||||
ProxyConfig lpc = lc.getDefaultProxyConfig();
|
||||
if (lpc != null) {
|
||||
if (domain.equals(lpc.getDomain())) {
|
||||
return username.split("@")[0];
|
||||
|
@ -548,7 +540,7 @@ public final class LinphoneUtils {
|
|||
|
||||
public static String getFullAddressFromUsername(String username) {
|
||||
String sipAddress = username;
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc == null) return sipAddress;
|
||||
|
||||
if (!sipAddress.startsWith("sip:")) {
|
||||
|
@ -556,7 +548,7 @@ public final class LinphoneUtils {
|
|||
}
|
||||
|
||||
if (!sipAddress.contains("@")) {
|
||||
LinphoneProxyConfig lpc = lc.getDefaultProxyConfig();
|
||||
ProxyConfig lpc = lc.getDefaultProxyConfig();
|
||||
if (lpc != null) {
|
||||
sipAddress = sipAddress + "@" + lpc.getDomain();
|
||||
} else {
|
||||
|
@ -566,9 +558,9 @@ public final class LinphoneUtils {
|
|||
return sipAddress;
|
||||
}
|
||||
|
||||
public static void storeImage(Context context, LinphoneChatMessage msg) {
|
||||
if (msg == null || msg.getFileTransferInformation() == null || msg.getAppData() == null) return;
|
||||
File file = new File(Environment.getExternalStorageDirectory(), msg.getAppData());
|
||||
public static void storeImage(Context context, ChatMessage msg) {
|
||||
if (msg == null || msg.getFileTransferInformation() == null || msg.getAppdata() == null) return;
|
||||
File file = new File(Environment.getExternalStorageDirectory(), msg.getAppdata());
|
||||
Bitmap bm = BitmapFactory.decodeFile(file.getPath());
|
||||
if (bm == null) return;
|
||||
|
||||
|
@ -592,7 +584,7 @@ public final class LinphoneUtils {
|
|||
file.delete();
|
||||
bm.recycle();
|
||||
|
||||
msg.setAppData(path.toString());
|
||||
msg.setAppdata(path.toString());
|
||||
} catch (FileNotFoundException e) {
|
||||
Log.e(e);
|
||||
} catch (IOException e) {
|
||||
|
@ -619,83 +611,83 @@ public final class LinphoneUtils {
|
|||
public static String errorForPhoneNumberStatus(int status) {
|
||||
Context ctxt = getContext();
|
||||
if (ctxt != null) {
|
||||
if (LinphoneAccountCreator.PhoneNumberCheck.CountryCodeInvalid.value()
|
||||
== (status & LinphoneAccountCreator.PhoneNumberCheck.CountryCodeInvalid.value()))
|
||||
if (AccountCreator.PhoneNumberStatus.InvalidCountryCode.toInt()
|
||||
== (status & AccountCreator.PhoneNumberStatus.InvalidCountryCode.toInt()))
|
||||
return ctxt.getString(R.string.country_code_invalid);
|
||||
if (LinphoneAccountCreator.PhoneNumberCheck.TooShort.value()
|
||||
== (status & LinphoneAccountCreator.PhoneNumberCheck.TooShort.value()))
|
||||
if (AccountCreator.PhoneNumberStatus.TooShort.toInt()
|
||||
== (status & AccountCreator.PhoneNumberStatus.TooShort.toInt()))
|
||||
return ctxt.getString(R.string.phone_number_too_short);
|
||||
if (LinphoneAccountCreator.PhoneNumberCheck.TooLong.value()
|
||||
== (status & LinphoneAccountCreator.PhoneNumberCheck.TooLong.value()))
|
||||
if (AccountCreator.PhoneNumberStatus.TooLong.toInt()
|
||||
== (status & AccountCreator.PhoneNumberStatus.TooLong.toInt()))
|
||||
return ctxt.getString(R.string.phone_number_too_long);
|
||||
if (LinphoneAccountCreator.PhoneNumberCheck.Invalid.value()
|
||||
== (status & LinphoneAccountCreator.PhoneNumberCheck.Invalid.value()))
|
||||
if (AccountCreator.PhoneNumberStatus.Invalid.toInt()
|
||||
== (status & AccountCreator.PhoneNumberStatus.Invalid.toInt()))
|
||||
return ctxt.getString(R.string.phone_number_invalid);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String errorForEmailStatus(LinphoneAccountCreator.EmailCheck status) {
|
||||
public static String errorForEmailStatus(AccountCreator.EmailStatus status) {
|
||||
Context ctxt = getContext();
|
||||
if (ctxt != null) {
|
||||
if (status.equals(LinphoneAccountCreator.EmailCheck.InvalidCharacters)
|
||||
|| status.equals(LinphoneAccountCreator.EmailCheck.Malformed))
|
||||
if (status.equals(AccountCreator.EmailStatus.InvalidCharacters)
|
||||
|| status.equals(AccountCreator.EmailStatus.Malformed))
|
||||
return ctxt.getString(R.string.invalid_email);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String errorForUsernameStatus(LinphoneAccountCreator.UsernameCheck status) {
|
||||
public static String errorForUsernameStatus(AccountCreator.UsernameStatus status) {
|
||||
Context ctxt = getContext();
|
||||
if (ctxt != null) {
|
||||
if (status.equals(LinphoneAccountCreator.UsernameCheck.InvalidCharacters))
|
||||
if (status.equals(AccountCreator.UsernameStatus.InvalidCharacters))
|
||||
return ctxt.getString(R.string.invalid_username);
|
||||
if (status.equals(LinphoneAccountCreator.UsernameCheck.TooShort))
|
||||
if (status.equals(AccountCreator.UsernameStatus.TooShort))
|
||||
return ctxt.getString(R.string.username_too_short);
|
||||
if (status.equals(LinphoneAccountCreator.UsernameCheck.TooLong))
|
||||
if (status.equals(AccountCreator.UsernameStatus.TooLong))
|
||||
return ctxt.getString(R.string.username_too_long);
|
||||
if (status.equals(LinphoneAccountCreator.UsernameCheck.Invalid))
|
||||
if (status.equals(AccountCreator.UsernameStatus.Invalid))
|
||||
return ctxt.getString(R.string.username_invalid_size);
|
||||
if (status.equals(LinphoneAccountCreator.UsernameCheck.InvalidCharacters))
|
||||
if (status.equals(AccountCreator.UsernameStatus.InvalidCharacters))
|
||||
return ctxt.getString(R.string.invalid_display_name);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String errorForPasswordStatus(LinphoneAccountCreator.PasswordCheck status) {
|
||||
public static String errorForPasswordStatus(AccountCreator.PasswordStatus status) {
|
||||
Context ctxt = getContext();
|
||||
if (ctxt != null) {
|
||||
if (status.equals(LinphoneAccountCreator.PasswordCheck.TooShort))
|
||||
if (status.equals(AccountCreator.PasswordStatus.TooShort))
|
||||
return ctxt.getString(R.string.password_too_short);
|
||||
if (status.equals(LinphoneAccountCreator.PasswordCheck.TooLong))
|
||||
if (status.equals(AccountCreator.PasswordStatus.TooLong))
|
||||
return ctxt.getString(R.string.password_too_long);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String errorForRequestStatus(LinphoneAccountCreator.RequestStatus status) {
|
||||
public static String errorForStatus(AccountCreator.Status status) {
|
||||
Context ctxt = getContext();
|
||||
if (ctxt != null) {
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.Failed))
|
||||
if (status.equals(AccountCreator.Status.RequestFailed))
|
||||
return ctxt.getString(R.string.request_failed);
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.ErrorServer))
|
||||
if (status.equals(AccountCreator.Status.ServerError))
|
||||
return ctxt.getString(R.string.wizard_failed);
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AccountExist)
|
||||
|| status.equals(LinphoneAccountCreator.RequestStatus.AccountExistWithAlias))
|
||||
if (status.equals(AccountCreator.Status.AccountExist)
|
||||
|| status.equals(AccountCreator.Status.AccountExistWithAlias))
|
||||
return ctxt.getString(R.string.account_already_exist);
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AliasIsAccount)
|
||||
|| status.equals(LinphoneAccountCreator.RequestStatus.AliasExist))
|
||||
if (status.equals(AccountCreator.Status.AliasIsAccount)
|
||||
|| status.equals(AccountCreator.Status.AliasExist))
|
||||
return ctxt.getString(R.string.assistant_phone_number_unavailable);
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AccountNotExist))
|
||||
if (status.equals(AccountCreator.Status.AccountNotExist))
|
||||
return ctxt.getString(R.string.assistant_error_bad_credentials);
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AliasNotExist))
|
||||
if (status.equals(AccountCreator.Status.AliasNotExist))
|
||||
return ctxt.getString(R.string.phone_number_not_exist);
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AliasNotExist)
|
||||
|| status.equals(LinphoneAccountCreator.RequestStatus.AccountNotActivated)
|
||||
|| status.equals(LinphoneAccountCreator.RequestStatus.AccountAlreadyActivated)
|
||||
|| status.equals(LinphoneAccountCreator.RequestStatus.AccountActivated)
|
||||
|| status.equals(LinphoneAccountCreator.RequestStatus.AccountNotCreated)
|
||||
|| status.equals(LinphoneAccountCreator.RequestStatus.Ok))
|
||||
if (status.equals(AccountCreator.Status.AliasNotExist)
|
||||
|| status.equals(AccountCreator.Status.AccountNotActivated)
|
||||
|| status.equals(AccountCreator.Status.AccountAlreadyActivated)
|
||||
|| status.equals(AccountCreator.Status.AccountActivated)
|
||||
|| status.equals(AccountCreator.Status.AccountNotCreated)
|
||||
|| status.equals(AccountCreator.Status.RequestOk))
|
||||
return "";
|
||||
}
|
||||
return null;
|
||||
|
@ -714,8 +706,8 @@ public final class LinphoneUtils {
|
|||
|
||||
public static void setCountry(DialPlan c, EditText dialCode, Button selectCountry, int countryCode) {
|
||||
if( c != null && dialCode != null && selectCountry != null) {
|
||||
dialCode.setText(c.getCountryCode());
|
||||
selectCountry.setText(c.getCountryName());
|
||||
dialCode.setText(c.getCountryCallingCode());
|
||||
selectCountry.setText(c.getCountry());
|
||||
} else {
|
||||
if(countryCode != -1){
|
||||
dialCode.setText("+" + countryCode);
|
||||
|
@ -798,7 +790,7 @@ public final class LinphoneUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static String getTimestamp() {
|
||||
public static String getStartDate() {
|
||||
try {
|
||||
return new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.ROOT).format(new Date());
|
||||
} catch (RuntimeException e) {
|
||||
|
@ -808,7 +800,7 @@ public final class LinphoneUtils {
|
|||
|
||||
public static File createFile(Context context, String imageFileName, String type) throws IOException {
|
||||
if (TextUtils.isEmpty(imageFileName))
|
||||
imageFileName = getTimestamp()+"."+type; // make random filename if you want.
|
||||
imageFileName = getStartDate()+"."+type; // make random filename if you want.
|
||||
|
||||
final File root;
|
||||
imageFileName = imageFileName;
|
||||
|
|
|
@ -20,10 +20,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
|
||||
import org.linphone.LinphonePreferences.AccountBuilder;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.LpConfig;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
import org.linphone.core.Config;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.content.Context;
|
||||
|
@ -44,7 +44,7 @@ public class PreferencesMigrator {
|
|||
}
|
||||
|
||||
public boolean isEchoMigratioNeeded() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class PreferencesMigrator {
|
|||
return false;
|
||||
}
|
||||
|
||||
return (!lc.needsEchoCalibration() && mNewPrefs.isEchoCancellationEnabled());
|
||||
return (!lc.isEchoCancellerCalibrationRequired() && mNewPrefs.echoCancellationEnabled());
|
||||
}
|
||||
|
||||
public boolean isMigrationNeeded() {
|
||||
|
@ -99,9 +99,9 @@ public class PreferencesMigrator {
|
|||
}
|
||||
|
||||
private void doAccountsMigration() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
lc.clearAuthInfos();
|
||||
lc.clearProxyConfigs();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
lc.clearAllAuthInfo();
|
||||
lc.clearProxyConfig();
|
||||
|
||||
for (int i = 0; i < mOldPrefs.getInt(getString(R.string.pref_extra_accounts), 1); i++) {
|
||||
doAccountMigration(i, i == getPrefInt(R.string.pref_default_account_key, 0));
|
||||
|
@ -121,10 +121,10 @@ public class PreferencesMigrator {
|
|||
|
||||
AccountBuilder builder = new AccountBuilder(LinphoneManager.getLc())
|
||||
.setUsername(username)
|
||||
.setUserId(userid)
|
||||
.setUserid(userid)
|
||||
.setDomain(domain)
|
||||
.setPassword(password)
|
||||
.setProxy(proxy)
|
||||
.setServerAddr(proxy)
|
||||
.setExpires(expire);
|
||||
|
||||
if (getPrefBoolean(getString(R.string.pref_enable_outbound_proxy_key) + key, false)) {
|
||||
|
@ -141,7 +141,7 @@ public class PreferencesMigrator {
|
|||
|
||||
try {
|
||||
builder.saveNewAccount();
|
||||
} catch (LinphoneCoreException e) {
|
||||
} catch (CoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
|
||||
|
@ -152,10 +152,10 @@ public class PreferencesMigrator {
|
|||
}
|
||||
|
||||
public void doPresenceMigrationIfNeeded() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
LpConfig cfg = lc.getConfig();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Config cfg = lc.getConfig();
|
||||
if (cfg.getString("app", "friendlist_subscription_enabled", null) == null){
|
||||
LinphoneProxyConfig proxy = lc.getDefaultProxyConfig();
|
||||
ProxyConfig proxy = lc.getDefaultProxyConfig();
|
||||
if (proxy != null) {
|
||||
String domain = proxy.getDomain();
|
||||
if (domain!=null && domain.equals(getString(R.string.default_domain))) {
|
||||
|
|
|
@ -23,19 +23,21 @@ import java.io.File;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
||||
import org.linphone.core.LinphoneCore.LinphoneLimeState;
|
||||
import org.linphone.core.LinphoneCore.MediaEncryption;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Core.EcCalibratorStatus;
|
||||
import org.linphone.core.Core.LimeState;
|
||||
import org.linphone.core.Core.MediaEncryption;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
import org.linphone.core.PayloadType;
|
||||
import org.linphone.core.VideoDefinition;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.mediastream.Version;
|
||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||
import org.linphone.tools.OpenH264DownloadHelper;
|
||||
import org.linphone.core.tools.OpenH264DownloadHelper;
|
||||
import org.linphone.ui.LedPreference;
|
||||
import org.linphone.ui.PreferencesListFragment;
|
||||
|
||||
|
@ -64,7 +66,7 @@ import android.provider.Settings;
|
|||
public class SettingsFragment extends PreferencesListFragment {
|
||||
private LinphonePreferences mPrefs;
|
||||
private Handler mHandler = new Handler();
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
private CoreListenerStub mListener;
|
||||
private PreferenceScreen currentPreferenceScreen;
|
||||
private Preference.OnPreferenceClickListener prefClickListener = new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
|
@ -92,9 +94,9 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
mPrefs = LinphonePreferences.instance();
|
||||
removePreviousPreferencesFile(); // Required when updating the preferences order
|
||||
|
||||
mListener = new LinphoneCoreListenerBase() {
|
||||
mListener = new CoreListenerStub() {
|
||||
@Override
|
||||
public void ecCalibrationStatus(LinphoneCore lc, final EcCalibratorStatus status, final int delayMs, Object data) {
|
||||
public void onEcCalibrationResult(Core lc, Core.EcCalibratorStatus status, int delayMs) {
|
||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||
|
||||
CheckBoxPreference echoCancellation = (CheckBoxPreference) findPreference(getString(R.string.pref_echo_cancellation_key));
|
||||
|
@ -107,7 +109,7 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
((AudioManager)getActivity().getSystemService(Context.AUDIO_SERVICE)).setMode(AudioManager.MODE_NORMAL);
|
||||
Log.i("Set audio mode on 'Normal'");
|
||||
} else if (status == EcCalibratorStatus.Done) {
|
||||
echoCancellerCalibration.setSummary(String.format(getString(R.string.ec_calibrated), delayMs));
|
||||
echoCancellerCalibration.setSummary(String.format(getString(R.string.ec_calibrated), String.valueOf(delayMs)));
|
||||
echoCancellation.setChecked(true);
|
||||
LinphonePreferences.instance().setEchoCancellation(true);
|
||||
((AudioManager)getActivity().getSystemService(Context.AUDIO_SERVICE)).setMode(AudioManager.MODE_NORMAL);
|
||||
|
@ -194,7 +196,7 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
hidePreference(R.string.pref_push_notification_key);
|
||||
}
|
||||
|
||||
if (!Version.isVideoCapable() || !LinphoneManager.getLcIfManagerNotDestroyedOrNull().isVideoSupported()) {
|
||||
if (!Version.isVideoCapable() || !LinphoneManager.getLcIfManagerNotDestroyedOrNull().videoSupported()) {
|
||||
emptyAndHidePreference(R.string.pref_video_key);
|
||||
} else {
|
||||
if (!AndroidCameraConfiguration.hasFrontCamera()) {
|
||||
|
@ -202,7 +204,7 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
}
|
||||
}
|
||||
|
||||
if (!LinphoneManager.getLc().isTunnelAvailable()) {
|
||||
if (!LinphoneManager.getLc().tunnelAvailable()) {
|
||||
emptyAndHidePreference(R.string.pref_tunnel_key);
|
||||
}
|
||||
|
||||
|
@ -276,20 +278,20 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
}
|
||||
|
||||
private void initTunnelSettings() {
|
||||
if (!LinphoneManager.isInstanciated() || !LinphoneManager.getLc().isTunnelAvailable()) {
|
||||
if (!LinphoneManager.isInstanciated() || !LinphoneManager.getLc().tunnelAvailable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_host_key, mPrefs.getTunnelHost());
|
||||
/*setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_host_key, mPrefs.getTunnelHost());
|
||||
setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_port_key, String.valueOf(mPrefs.getTunnelPort()));
|
||||
ListPreference tunnelModePref = (ListPreference) findPreference(getString(R.string.pref_tunnel_mode_key));
|
||||
String tunnelMode = mPrefs.getTunnelMode();
|
||||
tunnelModePref.setSummary(tunnelMode);
|
||||
tunnelModePref.setValue(tunnelMode);
|
||||
tunnelModePref.setValue(tunnelMode);*/
|
||||
}
|
||||
|
||||
private void setTunnelPreferencesListener() {
|
||||
findPreference(getString(R.string.pref_tunnel_host_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||
/*findPreference(getString(R.string.pref_tunnel_host_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
String host = newValue.toString();
|
||||
|
@ -319,7 +321,7 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
preference.setSummary(mode);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
});*/
|
||||
}
|
||||
|
||||
private void initAccounts() {
|
||||
|
@ -366,14 +368,14 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
}
|
||||
|
||||
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) {
|
||||
for (LinphoneProxyConfig lpc : LinphoneManager.getLc().getProxyConfigList()) {
|
||||
LinphoneAddress addr = lpc.getAddress();
|
||||
if (addr.getUserName().equals(username) && addr.getDomain().equals(domain)) {
|
||||
if (lpc.getState() == LinphoneCore.RegistrationState.RegistrationOk) {
|
||||
for (ProxyConfig lpc : LinphoneManager.getLc().getProxyConfigList()) {
|
||||
Address addr = lpc.getIdentityAddress();
|
||||
if (addr.getUsername().equals(username) && addr.getDomain().equals(domain)) {
|
||||
if (lpc.getState() == Core.RegistrationState.Ok) {
|
||||
me.setLed(R.drawable.led_connected);
|
||||
} else if (lpc.getState() == LinphoneCore.RegistrationState.RegistrationFailed) {
|
||||
} else if (lpc.getState() == Core.RegistrationState.Failed) {
|
||||
me.setLed(R.drawable.led_error);
|
||||
} else if (lpc.getState() == LinphoneCore.RegistrationState.RegistrationProgress) {
|
||||
} else if (lpc.getState() == Core.RegistrationState.Progress) {
|
||||
me.setLed(R.drawable.led_inprogress);
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
|
@ -396,7 +398,7 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
entries.add(getString(R.string.pref_none));
|
||||
values.add(getString(R.string.pref_media_encryption_key_none));
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc == null || getResources().getBoolean(R.bool.disable_all_security_features_for_markets)) {
|
||||
setListPreferenceValues(pref, entries, values);
|
||||
return;
|
||||
|
@ -441,9 +443,9 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
private void initializePreferredVideoSizePreferences(ListPreference pref) {
|
||||
List<CharSequence> entries = new ArrayList<CharSequence>();
|
||||
List<CharSequence> values = new ArrayList<CharSequence>();
|
||||
for (String name : LinphoneManager.getLc().getSupportedVideoSizes()) {
|
||||
entries.add(name);
|
||||
values.add(name);
|
||||
for (VideoDefinition vd : Factory.instance().getSupportedVideoDefinitions()) {
|
||||
entries.add(vd.getName());
|
||||
values.add(vd.getName());
|
||||
}
|
||||
|
||||
setListPreferenceValues(pref, entries, values);
|
||||
|
@ -476,27 +478,27 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
List<CharSequence> entries = new ArrayList<CharSequence>();
|
||||
List<CharSequence> values = new ArrayList<CharSequence>();
|
||||
entries.add(getString(R.string.lime_encryption_entry_disabled));
|
||||
values.add(LinphoneLimeState.Disabled.toString());
|
||||
values.add(LimeState.Disabled.toString());
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc == null || !lc.isLimeEncryptionAvailable()) {
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc == null || !lc.limeAvailable()) {
|
||||
setListPreferenceValues(pref, entries, values);
|
||||
pref.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
entries.add(getString(R.string.lime_encryption_entry_mandatory));
|
||||
values.add(LinphoneLimeState.Mandatory.toString());
|
||||
values.add(LimeState.Mandatory.toString());
|
||||
entries.add(getString(R.string.lime_encryption_entry_preferred));
|
||||
values.add(LinphoneLimeState.Preferred.toString());
|
||||
values.add(LimeState.Preferred.toString());
|
||||
setListPreferenceValues(pref, entries, values);
|
||||
|
||||
LinphoneLimeState lime = mPrefs.getLimeEncryption();
|
||||
if (lime == LinphoneLimeState.Disabled) {
|
||||
LimeState lime = mPrefs.limeEnabled();
|
||||
if (lime == LimeState.Disabled) {
|
||||
pref.setSummary(getString(R.string.lime_encryption_entry_disabled));
|
||||
} else if (lime == LinphoneLimeState.Mandatory) {
|
||||
} else if (lime == LimeState.Mandatory) {
|
||||
pref.setSummary(getString(R.string.lime_encryption_entry_mandatory));
|
||||
} else if (lime == LinphoneLimeState.Preferred) {
|
||||
} else if (lime == LimeState.Preferred) {
|
||||
pref.setSummary(getString(R.string.lime_encryption_entry_preferred));
|
||||
}
|
||||
pref.setValue(lime.toString());
|
||||
|
@ -515,37 +517,29 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
PreferenceCategory codecs = (PreferenceCategory) findPreference(getString(R.string.pref_codecs_key));
|
||||
codecs.removeAll();
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
for (final PayloadType pt : lc.getAudioCodecs()) {
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
for (final PayloadType pt : lc.getAudioPayloadTypes()) {
|
||||
CheckBoxPreference codec = new CheckBoxPreference(getActivity());
|
||||
codec.setTitle(pt.getMime());
|
||||
codec.setTitle(pt.getMimeType());
|
||||
/* Special case */
|
||||
if (pt.getMime().equals("mpeg4-generic")) {
|
||||
if (pt.getMimeType().equals("mpeg4-generic")) {
|
||||
if (android.os.Build.VERSION.SDK_INT < 16) {
|
||||
/* Make sure AAC is disabled */
|
||||
try {
|
||||
lc.enablePayloadType(pt, false);
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
pt.enable(false);
|
||||
continue;
|
||||
} else {
|
||||
codec.setTitle("AAC-ELD");
|
||||
}
|
||||
}
|
||||
|
||||
codec.setSummary(pt.getRate() + " Hz");
|
||||
codec.setChecked(lc.isPayloadTypeEnabled(pt));
|
||||
codec.setSummary(pt.getClockRate() + " Hz");
|
||||
codec.setChecked(pt.enabled());
|
||||
|
||||
codec.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
boolean enable = (Boolean) newValue;
|
||||
try {
|
||||
LinphoneManager.getLcIfManagerNotDestroyedOrNull().enablePayloadType(pt, enable);
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
pt.enable(enable);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@ -554,15 +548,15 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
}
|
||||
|
||||
CheckBoxPreference echoCancellation = (CheckBoxPreference) findPreference(getString(R.string.pref_echo_cancellation_key));
|
||||
echoCancellation.setChecked(mPrefs.isEchoCancellationEnabled());
|
||||
echoCancellation.setChecked(mPrefs.echoCancellationEnabled());
|
||||
|
||||
if (mPrefs.isEchoCancellationEnabled()) {
|
||||
if (mPrefs.echoCancellationEnabled()) {
|
||||
Preference echoCalibration = findPreference(getString(R.string.pref_echo_canceller_calibration_key));
|
||||
echoCalibration.setSummary(String.format(getString(R.string.ec_calibrated), mPrefs.getEchoCalibration()));
|
||||
echoCalibration.setSummary(String.format(getString(R.string.ec_calibrated), String.valueOf(mPrefs.getEchoCalibration())));
|
||||
}
|
||||
|
||||
CheckBoxPreference adaptiveRateControl = (CheckBoxPreference) findPreference(getString(R.string.pref_adaptive_rate_control_key));
|
||||
adaptiveRateControl.setChecked(mPrefs.isAdaptiveRateControlEnabled());
|
||||
adaptiveRateControl.setChecked(mPrefs.adaptiveRateControlEnabled());
|
||||
|
||||
ListPreference bitrateLimit = (ListPreference) findPreference(getString(R.string.pref_codec_bitrate_limit_key));
|
||||
bitrateLimit.setSummary(String.valueOf(mPrefs.getCodecBitrateLimit()));
|
||||
|
@ -592,12 +586,12 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
mPrefs.setCodecBitrateLimit(Integer.parseInt(newValue.toString()));
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
int bitrate = Integer.parseInt(newValue.toString());
|
||||
|
||||
for (final PayloadType pt : lc.getAudioCodecs()) {
|
||||
if (lc.payloadTypeIsVbr(pt)) {
|
||||
lc.setPayloadTypeBitrate(pt, bitrate);
|
||||
for (final PayloadType pt : lc.getAudioPayloadTypes()) {
|
||||
if (pt.isVbr()) {
|
||||
pt.setNormalBitrate(bitrate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -648,7 +642,7 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
if (LinphoneManager.getInstance().startEchoTester() > 0) {
|
||||
preference.setSummary("Is running");
|
||||
}
|
||||
} catch (LinphoneCoreException e) {
|
||||
} catch (CoreException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -659,7 +653,7 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
if (LinphoneManager.getInstance().stopEchoTester() > 0) {
|
||||
preference.setSummary("Is stopped");
|
||||
}
|
||||
} catch (LinphoneCoreException e) {
|
||||
} catch (CoreException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -669,7 +663,7 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
if (LinphoneManager.getInstance().getEchoTesterStatus())
|
||||
stopEchoTester();
|
||||
LinphoneManager.getInstance().startEcCalibration(mListener);
|
||||
} catch (LinphoneCoreException e) {
|
||||
} catch (CoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
}
|
||||
|
@ -694,19 +688,19 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
PreferenceCategory codecs = (PreferenceCategory) findPreference(getString(R.string.pref_video_codecs_key));
|
||||
codecs.removeAll();
|
||||
|
||||
final LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
final Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
|
||||
final OpenH264DownloadHelper mCodecDownloader = LinphoneManager.getInstance().getOpenH264DownloadHelper();
|
||||
|
||||
for (final PayloadType pt : lc.getVideoCodecs()) {
|
||||
for (final PayloadType pt : lc.getVideoPayloadTypes()) {
|
||||
final CheckBoxPreference codec = new CheckBoxPreference(getActivity());
|
||||
codec.setTitle(pt.getMime());
|
||||
codec.setTitle(pt.getMimeType());
|
||||
|
||||
if (!pt.getMime().equals("VP8")) {
|
||||
if (!pt.getMimeType().equals("VP8")) {
|
||||
if (getResources().getBoolean(R.bool.disable_all_patented_codecs_for_markets)) {
|
||||
continue;
|
||||
} else {
|
||||
if (!Version.hasFastCpuWithAsmOptim() && pt.getMime().equals("H264"))
|
||||
if (!Version.hasFastCpuWithAsmOptim() && pt.getMimeType().equals("H264"))
|
||||
{
|
||||
// Android without neon doesn't support H264
|
||||
Log.w("CPU does not have asm optimisations available, disabling H264");
|
||||
|
@ -714,49 +708,45 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (lc.downloadOpenH264Enabled()) {
|
||||
if (pt.getMime().equals("H264") && mCodecDownloader.isCodecFound()) {
|
||||
if (OpenH264DownloadHelper.isOpenH264DownloadEnabled()) {
|
||||
if (pt.getMimeType().equals("H264") && mCodecDownloader.isCodecFound()) {
|
||||
codec.setSummary(mCodecDownloader.getLicenseMessage());
|
||||
codec.setTitle("OpenH264");
|
||||
}
|
||||
}
|
||||
codec.setChecked(lc.isPayloadTypeEnabled(pt));
|
||||
codec.setChecked(pt.enabled());
|
||||
|
||||
codec.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
boolean enable = (Boolean) newValue;
|
||||
try {
|
||||
if (lc.downloadOpenH264Enabled()) {
|
||||
if (enable && Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86")
|
||||
&& pt.getMime().equals("H264") && !mCodecDownloader.isCodecFound()) {
|
||||
mCodecDownloader.setOpenH264HelperListener(LinphoneManager.getInstance().getOpenH264HelperListener());
|
||||
mCodecDownloader.setUserData(0, LinphoneManager.getInstance().getContext());
|
||||
mCodecDownloader.setUserData(1, codec);
|
||||
if (OpenH264DownloadHelper.isOpenH264DownloadEnabled()) {
|
||||
if (enable && Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86")
|
||||
&& pt.getMimeType().equals("H264") && !mCodecDownloader.isCodecFound()) {
|
||||
mCodecDownloader.setOpenH264HelperListener(LinphoneManager.getInstance().getOpenH264HelperListener());
|
||||
mCodecDownloader.setUserData(0, LinphoneManager.getInstance().getContext());
|
||||
mCodecDownloader.setUserData(1, codec);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(LinphoneManager.getInstance().getContext());
|
||||
builder.setCancelable(false);
|
||||
builder.setMessage("Do you agree to download " + mCodecDownloader.getLicenseMessage()).setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (which == DialogInterface.BUTTON_POSITIVE)
|
||||
mCodecDownloader.downloadCodec();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(LinphoneManager.getInstance().getContext());
|
||||
builder.setCancelable(false);
|
||||
builder.setMessage("Do you agree to download " + mCodecDownloader.getLicenseMessage()).setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (which == DialogInterface.BUTTON_POSITIVE)
|
||||
mCodecDownloader.downloadCodec();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (which == DialogInterface.BUTTON_NEGATIVE) {
|
||||
// Disable H264
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (which == DialogInterface.BUTTON_NEGATIVE) {
|
||||
// Disable H264
|
||||
}
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
LinphoneManager.getLcIfManagerNotDestroyedOrNull().enablePayloadType(pt, enable);
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
pt.enable(enable);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@ -1053,20 +1043,20 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
String value = newValue.toString();
|
||||
LinphoneLimeState lime = LinphoneLimeState.Disabled;
|
||||
if (value.equals(LinphoneLimeState.Mandatory.toString()))
|
||||
lime = LinphoneLimeState.Mandatory;
|
||||
else if (value.equals(LinphoneLimeState.Preferred.toString()))
|
||||
lime = LinphoneLimeState.Preferred;
|
||||
mPrefs.setLimeEncryption(lime);
|
||||
LimeState lime = LimeState.Disabled;
|
||||
if (value.equals(LimeState.Mandatory.toString()))
|
||||
lime = LimeState.Mandatory;
|
||||
else if (value.equals(LimeState.Preferred.toString()))
|
||||
lime = LimeState.Preferred;
|
||||
mPrefs.enableLime(lime);
|
||||
|
||||
lime = mPrefs.getLimeEncryption();
|
||||
if (lime == LinphoneLimeState.Disabled) {
|
||||
lime = mPrefs.limeEnabled();
|
||||
if (lime == LimeState.Disabled) {
|
||||
preference.setSummary(getString(R.string.lime_encryption_entry_disabled));
|
||||
} else if (lime == LinphoneLimeState.Mandatory) {
|
||||
} else if (lime == LimeState.Mandatory) {
|
||||
setEncryptionZrtp();
|
||||
preference.setSummary(getString(R.string.lime_encryption_entry_mandatory));
|
||||
} else if (lime == LinphoneLimeState.Preferred) {
|
||||
} else if (lime == LimeState.Preferred) {
|
||||
setEncryptionZrtp();
|
||||
preference.setSummary(getString(R.string.lime_encryption_entry_preferred));
|
||||
}
|
||||
|
|
|
@ -18,15 +18,15 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
import org.linphone.assistant.AssistantActivity;
|
||||
import org.linphone.core.CallDirection;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
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.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphoneEvent;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.Call.Dir;
|
||||
import org.linphone.core.Call;
|
||||
import org.linphone.core.Content;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Core.MediaEncryption;
|
||||
import org.linphone.core.Core.RegistrationState;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.core.Event;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.app.Activity;
|
||||
|
@ -54,7 +54,7 @@ public class StatusFragment extends Fragment {
|
|||
private ImageView statusLed, callQuality, encryption, menu, voicemail;
|
||||
private Runnable mCallQualityUpdater;
|
||||
private boolean isInCall, isAttached = false, isZrtpAsk;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
private CoreListenerStub mListener;
|
||||
private Dialog ZRTPdialog = null;
|
||||
private int mDisplayedQuality = -1;
|
||||
|
||||
|
@ -74,9 +74,9 @@ public class StatusFragment extends Fragment {
|
|||
// We create it once to not delay the first display
|
||||
populateSliderContent();
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
mListener = new CoreListenerStub(){
|
||||
@Override
|
||||
public void registrationState(final LinphoneCore lc, final LinphoneProxyConfig proxy, final LinphoneCore.RegistrationState state, String smessage) {
|
||||
public void onRegistrationStateChanged(final Core lc, final ProxyConfig proxy, final Core.RegistrationState state, String smessage) {
|
||||
if (!isAttached || !LinphoneService.isReady()) {
|
||||
return;
|
||||
}
|
||||
|
@ -107,15 +107,15 @@ public class StatusFragment extends Fragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void notifyReceived(LinphoneCore lc, LinphoneEvent ev, String eventName, LinphoneContent content) {
|
||||
public void onNotifyReceived(Core lc, Event ev, String eventName, Content content) {
|
||||
|
||||
if(!content.getType().equals("application")) return;
|
||||
if(!content.getSubtype().equals("simple-message-summary")) return;
|
||||
|
||||
if (content.getData() == null) return;
|
||||
if (content.getSize() == 0) return;
|
||||
|
||||
int unreadCount = -1;
|
||||
String data = content.getDataAsString();
|
||||
String data = content.getStringBuffer();
|
||||
String[] voiceMail = data.split("voice-message: ");
|
||||
final String[] intToParse = voiceMail[1].split("/",0);
|
||||
|
||||
|
@ -149,14 +149,14 @@ public class StatusFragment extends Fragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
public void setLinphoneCoreListener() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
public void setCoreListener() {
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(mListener);
|
||||
|
||||
LinphoneProxyConfig lpc = lc.getDefaultProxyConfig();
|
||||
ProxyConfig lpc = lc.getDefaultProxyConfig();
|
||||
if (lpc != null) {
|
||||
mListener.registrationState(lc, lpc, lpc.getState(), null);
|
||||
mListener.onRegistrationStateChanged(lc, lpc, lpc.getState(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ public class StatusFragment extends Fragment {
|
|||
voicemailCount.setVisibility(View.GONE);
|
||||
|
||||
if (isInCall && isAttached) {
|
||||
//LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
|
||||
//Call call = LinphoneManager.getLc().getCurrentCall();
|
||||
//initCallStatsRefresher(call, callStats);
|
||||
} else if (!isInCall) {
|
||||
voicemailCount.setVisibility(View.VISIBLE);
|
||||
|
@ -198,15 +198,15 @@ public class StatusFragment extends Fragment {
|
|||
menu.setEnabled(enabled);
|
||||
}
|
||||
|
||||
private int getStatusIconResource(LinphoneCore.RegistrationState state, boolean isDefaultAccount) {
|
||||
private int getStatusIconResource(Core.RegistrationState state, boolean isDefaultAccount) {
|
||||
try {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
boolean defaultAccountConnected = (isDefaultAccount && lc != null && lc.getDefaultProxyConfig() != null && lc.getDefaultProxyConfig().isRegistered()) || !isDefaultAccount;
|
||||
if (state == RegistrationState.RegistrationOk && defaultAccountConnected) {
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
boolean defaultAccountConnected = (isDefaultAccount && lc != null && lc.getDefaultProxyConfig() != null && lc.getDefaultProxyConfig().getState() == RegistrationState.Ok) || !isDefaultAccount;
|
||||
if (state == RegistrationState.Ok && defaultAccountConnected) {
|
||||
return R.drawable.led_connected;
|
||||
} else if (state == RegistrationState.RegistrationProgress) {
|
||||
} else if (state == RegistrationState.Progress) {
|
||||
return R.drawable.led_inprogress;
|
||||
} else if (state == RegistrationState.RegistrationFailed) {
|
||||
} else if (state == RegistrationState.Failed) {
|
||||
return R.drawable.led_error;
|
||||
} else {
|
||||
return R.drawable.led_disconnected;
|
||||
|
@ -218,7 +218,7 @@ public class StatusFragment extends Fragment {
|
|||
return R.drawable.led_disconnected;
|
||||
}
|
||||
|
||||
private String getStatusIconText(LinphoneCore.RegistrationState state) {
|
||||
private String getStatusIconText(Core.RegistrationState state) {
|
||||
Context context = getActivity();
|
||||
if (!isAttached && LinphoneActivity.isInstanciated())
|
||||
context = LinphoneActivity.instance();
|
||||
|
@ -226,11 +226,11 @@ public class StatusFragment extends Fragment {
|
|||
context = LinphoneService.instance();
|
||||
|
||||
try {
|
||||
if (state == RegistrationState.RegistrationOk && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getDefaultProxyConfig().isRegistered()) {
|
||||
if (state == RegistrationState.Ok && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getDefaultProxyConfig().getState() == RegistrationState.Ok) {
|
||||
return context.getString(R.string.status_connected);
|
||||
} else if (state == RegistrationState.RegistrationProgress) {
|
||||
} else if (state == RegistrationState.Progress) {
|
||||
return context.getString(R.string.status_in_progress);
|
||||
} else if (state == RegistrationState.RegistrationFailed) {
|
||||
} else if (state == RegistrationState.Failed) {
|
||||
return context.getString(R.string.status_error);
|
||||
} else {
|
||||
return context.getString(R.string.status_not_connected);
|
||||
|
@ -246,7 +246,7 @@ public class StatusFragment extends Fragment {
|
|||
private void startCallQuality() {
|
||||
callQuality.setVisibility(View.VISIBLE);
|
||||
refreshHandler.postDelayed(mCallQualityUpdater = new Runnable() {
|
||||
LinphoneCall mCurrentCall = LinphoneManager.getLc()
|
||||
Call mCurrentCall = LinphoneManager.getLc()
|
||||
.getCurrentCall();
|
||||
|
||||
public void run() {
|
||||
|
@ -297,19 +297,19 @@ public class StatusFragment extends Fragment {
|
|||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(mListener);
|
||||
LinphoneProxyConfig lpc = lc.getDefaultProxyConfig();
|
||||
ProxyConfig lpc = lc.getDefaultProxyConfig();
|
||||
if (lpc != null) {
|
||||
mListener.registrationState(lc, lpc, lpc.getState(), null);
|
||||
mListener.onRegistrationStateChanged(lc, lpc, lpc.getState(), null);
|
||||
}
|
||||
|
||||
LinphoneCall call = lc.getCurrentCall();
|
||||
Call call = lc.getCurrentCall();
|
||||
if (isInCall && (call != null || lc.getConferenceSize() > 1 || lc.getCallsNb() > 0)) {
|
||||
if (call != null) {
|
||||
startCallQuality();
|
||||
refreshStatusItems(call, call.getCurrentParams().getVideoEnabled());
|
||||
refreshStatusItems(call, call.getCurrentParams().videoEnabled());
|
||||
}
|
||||
menu.setVisibility(View.INVISIBLE);
|
||||
encryption.setVisibility(View.VISIBLE);
|
||||
|
@ -334,7 +334,7 @@ public class StatusFragment extends Fragment {
|
|||
public void onPause() {
|
||||
super.onPause();
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ public class StatusFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
public void refreshStatusItems(final LinphoneCall call, boolean isVideoEnabled) {
|
||||
public void refreshStatusItems(final Call call, boolean isVideoEnabled) {
|
||||
if (call != null) {
|
||||
voicemailCount.setVisibility(View.GONE);
|
||||
MediaEncryption mediaEncryption = call.getCurrentParams().getMediaEncryption();
|
||||
|
@ -356,9 +356,9 @@ public class StatusFragment extends Fragment {
|
|||
//background.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (mediaEncryption == MediaEncryption.SRTP || (mediaEncryption == MediaEncryption.ZRTP && call.isAuthenticationTokenVerified()) || mediaEncryption == MediaEncryption.DTLS) {
|
||||
if (mediaEncryption == MediaEncryption.SRTP || (mediaEncryption == MediaEncryption.ZRTP && call.getAuthenticationTokenVerified()) || mediaEncryption == MediaEncryption.DTLS) {
|
||||
encryption.setImageResource(R.drawable.security_ok);
|
||||
} else if (mediaEncryption == MediaEncryption.ZRTP && !call.isAuthenticationTokenVerified()) {
|
||||
} else if (mediaEncryption == MediaEncryption.ZRTP && !call.getAuthenticationTokenVerified()) {
|
||||
encryption.setImageResource(R.drawable.security_pending);
|
||||
} else {
|
||||
encryption.setImageResource(R.drawable.security_ko);
|
||||
|
@ -377,7 +377,7 @@ public class StatusFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
public void showZRTPDialog(final LinphoneCall call) {
|
||||
public void showZRTPDialog(final Call call) {
|
||||
if (getActivity() == null) {
|
||||
Log.w("Can't display ZRTP popup, no Activity");
|
||||
return;
|
||||
|
@ -405,7 +405,7 @@ public class StatusFragment extends Fragment {
|
|||
String zrtpToRead, zrtpToListen;
|
||||
isZrtpAsk = true;
|
||||
|
||||
if (call.getDirection().equals(CallDirection.Incoming)) {
|
||||
if (call.getDir().equals(Call.Dir.Incoming)) {
|
||||
zrtpToRead = token.substring(0,2);
|
||||
zrtpToListen = token.substring(2);
|
||||
} else {
|
||||
|
|
|
@ -32,20 +32,21 @@ import org.linphone.LinphoneService;
|
|||
import org.linphone.LinphoneUtils;
|
||||
import org.linphone.R;
|
||||
import org.linphone.StatusFragment;
|
||||
import org.linphone.core.AccountCreatorListener;
|
||||
import org.linphone.core.DialPlan;
|
||||
import org.linphone.core.LinphoneAccountCreator;
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneAddress.TransportType;
|
||||
import org.linphone.core.LinphoneAuthInfo;
|
||||
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.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.AccountCreator;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.Address.TransportType;
|
||||
import org.linphone.core.AuthInfo;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Core.RegistrationState;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.mediastream.Version;
|
||||
import org.linphone.tools.OpenH264DownloadHelper;
|
||||
import org.linphone.core.tools.OpenH264DownloadHelper;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
|
@ -81,7 +82,7 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class AssistantActivity extends Activity implements OnClickListener, ActivityCompat.OnRequestPermissionsResultCallback, LinphoneAccountCreator.LinphoneAccountCreatorListener {
|
||||
public class AssistantActivity extends Activity implements OnClickListener, ActivityCompat.OnRequestPermissionsResultCallback, AccountCreatorListener {
|
||||
private static AssistantActivity instance;
|
||||
private ImageView back, cancel;
|
||||
private AssistantFragmentsEnum currentFragment;
|
||||
|
@ -90,15 +91,15 @@ private static AssistantActivity instance;
|
|||
private Fragment fragment;
|
||||
private LinphonePreferences mPrefs;
|
||||
private boolean accountCreated = false, newAccount = false, isLink = false, fromPref = false;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
private LinphoneAddress address;
|
||||
private CoreListenerStub mListener;
|
||||
private Address address;
|
||||
private StatusFragment status;
|
||||
private ProgressDialog progress;
|
||||
private Dialog dialog;
|
||||
private boolean remoteProvisioningInProgress;
|
||||
private boolean echoCancellerAlreadyDone;
|
||||
private static final int PERMISSIONS_REQUEST_RECORD_AUDIO = 201;
|
||||
private LinphoneAccountCreator accountCreator;
|
||||
private AccountCreator accountCreator;
|
||||
private CountryListAdapter countryListAdapter;
|
||||
|
||||
public DialPlan country;
|
||||
|
@ -138,49 +139,49 @@ private static AssistantActivity instance;
|
|||
mPrefs = LinphonePreferences.instance();
|
||||
status.enableSideMenu(false);
|
||||
|
||||
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl());
|
||||
accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
|
||||
accountCreator.setListener(this);
|
||||
|
||||
countryListAdapter = new CountryListAdapter(getApplicationContext());
|
||||
mListener = new LinphoneCoreListenerBase() {
|
||||
mListener = new CoreListenerStub() {
|
||||
|
||||
@Override
|
||||
public void configuringStatus(LinphoneCore lc, final LinphoneCore.RemoteProvisioningState state, String message) {
|
||||
public void onConfiguringStatus(Core lc, final Core.ConfiguringState state, String message) {
|
||||
if (progress != null) progress.dismiss();
|
||||
if (state == LinphoneCore.RemoteProvisioningState.ConfiguringSuccessful) {
|
||||
if (state == Core.ConfiguringState.Successful) {
|
||||
goToLinphoneActivity();
|
||||
} else if (state == LinphoneCore.RemoteProvisioningState.ConfiguringFailed) {
|
||||
} else if (state == Core.ConfiguringState.Failed) {
|
||||
Toast.makeText(AssistantActivity.instance(), getString(R.string.remote_provisioning_failure), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, RegistrationState state, String smessage) {
|
||||
public void onRegistrationStateChanged(Core lc, ProxyConfig cfg, RegistrationState state, String smessage) {
|
||||
if (remoteProvisioningInProgress) {
|
||||
if (progress != null) progress.dismiss();
|
||||
if (state == RegistrationState.RegistrationOk) {
|
||||
if (state == RegistrationState.Ok) {
|
||||
remoteProvisioningInProgress = false;
|
||||
success();
|
||||
}
|
||||
} else if (accountCreated && !newAccount){
|
||||
if (address != null && address.asString().equals(cfg.getAddress().asString()) ) {
|
||||
if (state == RegistrationState.RegistrationOk) {
|
||||
if (address != null && address.asString().equals(cfg.getIdentityAddress().asString()) ) {
|
||||
if (state == RegistrationState.Ok) {
|
||||
if (progress != null) progress.dismiss();
|
||||
if (getResources().getBoolean(R.bool.use_phone_number_validation)
|
||||
&& cfg.getDomain().equals(getString(R.string.default_domain))
|
||||
&& LinphoneManager.getLc().getDefaultProxyConfig() != null) {
|
||||
accountCreator.isAccountUsed();
|
||||
accountCreator.isAccountExist();
|
||||
} else {
|
||||
success();
|
||||
}
|
||||
} else if (state == RegistrationState.RegistrationFailed) {
|
||||
} else if (state == RegistrationState.Failed) {
|
||||
if (progress != null) progress.dismiss();
|
||||
if (dialog == null || !dialog.isShowing()) {
|
||||
dialog = createErrorDialog(cfg, smessage);
|
||||
dialog.setCancelable(false);
|
||||
dialog.show();
|
||||
}
|
||||
} else if(!(state == RegistrationState.RegistrationProgress)) {
|
||||
} else if(!(state == RegistrationState.Progress)) {
|
||||
if (progress != null) progress.dismiss();
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +195,7 @@ private static AssistantActivity instance;
|
|||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
|
@ -202,7 +203,7 @@ private static AssistantActivity instance;
|
|||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
@ -344,70 +345,66 @@ private static AssistantActivity instance;
|
|||
}
|
||||
}
|
||||
|
||||
public void configureLinphoneProxyConfig(LinphoneAccountCreator accountCreator) {
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
LinphoneProxyConfig proxyConfig = lc.createProxyConfig();
|
||||
LinphoneAddress addr;
|
||||
LinphoneAuthInfo authInfo;
|
||||
public void configureProxyConfig(AccountCreator accountCreator) {
|
||||
Core lc = LinphoneManager.getLc();
|
||||
ProxyConfig proxyConfig = lc.createProxyConfig();
|
||||
Address addr;
|
||||
AuthInfo authInfo;
|
||||
|
||||
try {
|
||||
String identity = proxyConfig.getIdentity();
|
||||
if (identity == null || accountCreator.getUsername() == null) {
|
||||
LinphoneUtils.displayErrorAlert(getString(R.string.error), this);
|
||||
return;
|
||||
}
|
||||
identity = identity.replace("?", accountCreator.getUsername());
|
||||
addr = LinphoneCoreFactory.instance().createLinphoneAddress(identity);
|
||||
addr.setDisplayName(accountCreator.getUsername());
|
||||
address = addr;
|
||||
proxyConfig.edit();
|
||||
|
||||
|
||||
proxyConfig.setIdentity(addr.asString());
|
||||
|
||||
if (LinphonePreferences.instance() != null)
|
||||
proxyConfig.setContactUriParameters(LinphonePreferences.instance().getPushNotificationRegistrationID());
|
||||
|
||||
if (accountCreator.getPhoneNumber() != null && accountCreator.getPhoneNumber().length() > 0)
|
||||
proxyConfig.setDialPrefix(accountCreator.getPrefix(accountCreator.getPhoneNumber()));
|
||||
|
||||
proxyConfig.done();
|
||||
|
||||
authInfo = LinphoneCoreFactory.instance().createAuthInfo(
|
||||
accountCreator.getUsername(),
|
||||
null,
|
||||
accountCreator.getPassword(),
|
||||
accountCreator.getHa1(),
|
||||
proxyConfig.getRealm(),
|
||||
proxyConfig.getDomain());
|
||||
|
||||
|
||||
lc.addProxyConfig(proxyConfig);
|
||||
|
||||
lc.addAuthInfo(authInfo);
|
||||
|
||||
lc.setDefaultProxyConfig(proxyConfig);
|
||||
|
||||
if (ContactsManager.getInstance() != null)
|
||||
ContactsManager.getInstance().fetchContactsAsync();
|
||||
|
||||
if (LinphonePreferences.instance() != null)
|
||||
mPrefs.enabledFriendlistSubscription(getResources().getBoolean(R.bool.use_friendlist_subscription));
|
||||
|
||||
LinphoneManager.getInstance().subscribeFriendList(getResources().getBoolean(R.bool.use_friendlist_subscription));
|
||||
|
||||
if (!newAccount) {
|
||||
displayRegistrationInProgressDialog();
|
||||
}
|
||||
accountCreated = true;
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e("Can't configure proxy config ", e);
|
||||
String identity = proxyConfig.getIdentityAddress().asStringUriOnly();
|
||||
if (identity == null || accountCreator.getUsername() == null) {
|
||||
LinphoneUtils.displayErrorAlert(getString(R.string.error), this);
|
||||
return;
|
||||
}
|
||||
identity = identity.replace("?", accountCreator.getUsername());
|
||||
addr = Factory.instance().createAddress(identity);
|
||||
addr.setDisplayName(accountCreator.getUsername());
|
||||
address = addr;
|
||||
proxyConfig.edit();
|
||||
|
||||
|
||||
proxyConfig.setIdentityAddress(addr);
|
||||
|
||||
if (LinphonePreferences.instance() != null)
|
||||
proxyConfig.setContactUriParameters(LinphonePreferences.instance().getPushNotificationRegistrationID());
|
||||
|
||||
if (accountCreator.getPhoneNumber() != null && accountCreator.getPhoneNumber().length() > 0)
|
||||
proxyConfig.setDialPrefix(org.linphone.core.Utils.getPrefixFromE164(accountCreator.getPhoneNumber()));
|
||||
|
||||
proxyConfig.done();
|
||||
|
||||
authInfo = Factory.instance().createAuthInfo(
|
||||
accountCreator.getUsername(),
|
||||
null,
|
||||
accountCreator.getPassword(),
|
||||
accountCreator.getHa1(),
|
||||
proxyConfig.getRealm(),
|
||||
proxyConfig.getDomain());
|
||||
|
||||
|
||||
lc.addProxyConfig(proxyConfig);
|
||||
|
||||
lc.addAuthInfo(authInfo);
|
||||
|
||||
lc.setDefaultProxyConfig(proxyConfig);
|
||||
|
||||
if (ContactsManager.getInstance() != null)
|
||||
ContactsManager.getInstance().fetchContactsAsync();
|
||||
|
||||
if (LinphonePreferences.instance() != null)
|
||||
mPrefs.enabledFriendlistSubscription(getResources().getBoolean(R.bool.use_friendlist_subscription));
|
||||
|
||||
LinphoneManager.getInstance().subscribeFriendList(getResources().getBoolean(R.bool.use_friendlist_subscription));
|
||||
|
||||
if (!newAccount) {
|
||||
displayRegistrationInProgressDialog();
|
||||
}
|
||||
accountCreated = true;
|
||||
}
|
||||
|
||||
public void linphoneLogIn(LinphoneAccountCreator accountCreator) {
|
||||
LinphoneManager.getLc().getConfig().loadXmlFile(LinphoneManager.getInstance().getmDynamicConfigFile());
|
||||
configureLinphoneProxyConfig(accountCreator);
|
||||
public void linphoneLogIn(AccountCreator accountCreator) {
|
||||
LinphoneManager.getLc().getConfig().loadFromXmlFile(LinphoneManager.getInstance().getmDynamicConfigFile());
|
||||
configureProxyConfig(accountCreator);
|
||||
}
|
||||
|
||||
public void genericLogIn(String username, String userid, String password, String prefix, String domain, TransportType transport) {
|
||||
|
@ -482,8 +479,8 @@ private static AssistantActivity instance;
|
|||
}
|
||||
|
||||
private void launchDownloadCodec() {
|
||||
if (LinphoneManager.getLc().downloadOpenH264Enabled()) {
|
||||
OpenH264DownloadHelper downloadHelper = LinphoneCoreFactory.instance().createOpenH264DownloadHelper();
|
||||
if (OpenH264DownloadHelper.isOpenH264DownloadEnabled()) {
|
||||
OpenH264DownloadHelper downloadHelper = Factory.instance().createOpenH264DownloadHelper(this);
|
||||
if (Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86") && !downloadHelper.isCodecFound()) {
|
||||
CodecDownloaderFragment codecFragment = new CodecDownloaderFragment();
|
||||
changeFragment(codecFragment);
|
||||
|
@ -503,7 +500,7 @@ private static AssistantActivity instance;
|
|||
|
||||
public String getPhoneWithCountry() {
|
||||
if(country == null || phone_number == null) return "";
|
||||
String phoneNumberWithCountry = country.getCountryCode() + phone_number.replace("\\D", "");
|
||||
String phoneNumberWithCountry = country.getCountryCallingCode() + phone_number.replace("\\D", "");
|
||||
return phoneNumberWithCountry;
|
||||
}
|
||||
|
||||
|
@ -513,17 +510,13 @@ private static AssistantActivity instance;
|
|||
domain = LinphoneUtils.getDisplayableUsernameFromAddress(domain);
|
||||
|
||||
String identity = "sip:" + username + "@" + domain;
|
||||
try {
|
||||
address = LinphoneCoreFactory.instance().createLinphoneAddress(identity);
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
address = Factory.instance().createAddress(identity);
|
||||
|
||||
AccountBuilder builder = new AccountBuilder(LinphoneManager.getLc())
|
||||
.setUsername(username)
|
||||
.setDomain(domain)
|
||||
.setHa1(ha1)
|
||||
.setUserId(userid)
|
||||
.setUserid(userid)
|
||||
.setPassword(password);
|
||||
|
||||
if (prefix != null) {
|
||||
|
@ -532,9 +525,9 @@ private static AssistantActivity instance;
|
|||
|
||||
String forcedProxy = "";
|
||||
if (!TextUtils.isEmpty(forcedProxy)) {
|
||||
builder.setProxy(forcedProxy)
|
||||
builder.setServerAddr(forcedProxy)
|
||||
.setOutboundProxyEnabled(true)
|
||||
.setAvpfRRInterval(5);
|
||||
.setAvpfRrInterval(5);
|
||||
}
|
||||
if (transport != null) {
|
||||
builder.setTransport(transport);
|
||||
|
@ -546,7 +539,7 @@ private static AssistantActivity instance;
|
|||
displayRegistrationInProgressDialog();
|
||||
}
|
||||
accountCreated = true;
|
||||
} catch (LinphoneCoreException e) {
|
||||
} catch (CoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
}
|
||||
|
@ -628,7 +621,7 @@ private static AssistantActivity instance;
|
|||
launchDownloadCodec();
|
||||
}
|
||||
|
||||
public Dialog createErrorDialog(LinphoneProxyConfig proxy, String message){
|
||||
public Dialog createErrorDialog(ProxyConfig proxy, String message){
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
if(message.equals("Forbidden")) {
|
||||
message = getString(R.string.assistant_error_bad_credentials);
|
||||
|
@ -652,7 +645,7 @@ private static AssistantActivity instance;
|
|||
}
|
||||
|
||||
public void success() {
|
||||
boolean needsEchoCalibration = LinphoneManager.getLc().needsEchoCalibration();
|
||||
boolean needsEchoCalibration = LinphoneManager.getLc().isEchoCancellerCalibrationRequired();
|
||||
if (needsEchoCalibration && mPrefs.isFirstLaunch()) {
|
||||
launchEchoCancellerCalibration(true);
|
||||
} else {
|
||||
|
@ -666,13 +659,13 @@ private static AssistantActivity instance;
|
|||
finish();
|
||||
}
|
||||
|
||||
public void setLinphoneCoreListener() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
public void setCoreListener() {
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
if (status != null) {
|
||||
status.setLinphoneCoreListener();
|
||||
status.setCoreListener();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -692,8 +685,8 @@ private static AssistantActivity instance;
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
if(status.equals(LinphoneAccountCreator.RequestStatus.AccountExistWithAlias)){
|
||||
public void onIsAccountExist(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
if(status.equals(AccountCreator.Status.AccountExistWithAlias)){
|
||||
success();
|
||||
} else {
|
||||
isLink = true;
|
||||
|
@ -703,47 +696,47 @@ private static AssistantActivity instance;
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onCreateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onActivateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onLinkAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onActivateAlias(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onIsAccountActivated(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onRecoverAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onIsAccountLinked(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onIsAliasUsed(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onUpdateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -764,7 +757,7 @@ private static AssistantActivity instance;
|
|||
|
||||
public CountryListAdapter(Context ctx) {
|
||||
context = ctx;
|
||||
allCountries = LinphoneCoreFactory.instance().getAllDialPlan();
|
||||
allCountries = Factory.instance().getDialPlans();
|
||||
filteredCountries = new ArrayList<DialPlan>(Arrays.asList(allCountries));
|
||||
}
|
||||
|
||||
|
@ -810,7 +803,7 @@ private static AssistantActivity instance;
|
|||
DialPlan c = filteredCountries.get(position);
|
||||
|
||||
TextView name = (TextView) view.findViewById(R.id.country_name);
|
||||
name.setText(c.getCountryName());
|
||||
name.setText(c.getCountry());
|
||||
|
||||
TextView dial_code = (TextView) view.findViewById(R.id.country_prefix);
|
||||
if (context != null)
|
||||
|
@ -827,7 +820,7 @@ private static AssistantActivity instance;
|
|||
protected FilterResults performFiltering(CharSequence constraint) {
|
||||
ArrayList<DialPlan> filteredCountries = new ArrayList<DialPlan>();
|
||||
for (DialPlan c : allCountries) {
|
||||
if (c.getCountryName().toLowerCase().contains(constraint)
|
||||
if (c.getCountry().toLowerCase().contains(constraint)
|
||||
|| c.getCountryCallingCode().contains(constraint)) {
|
||||
filteredCountries.add(c);
|
||||
}
|
||||
|
|
|
@ -21,10 +21,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.OpenH264DownloadHelperListener;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.tools.OpenH264DownloadHelperListener;
|
||||
import org.linphone.core.PayloadType;
|
||||
import org.linphone.tools.OpenH264DownloadHelper;
|
||||
import org.linphone.core.tools.OpenH264DownloadHelper;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Build;
|
||||
|
@ -195,14 +195,14 @@ public class CodecDownloaderFragment extends Fragment {
|
|||
|
||||
private void enabledH264(boolean enable) {
|
||||
PayloadType h264 = null;
|
||||
for (PayloadType pt : LinphoneManager.getLc().getVideoCodecs()) {
|
||||
if (pt.getMime().equals("H264")) h264 = pt;
|
||||
for (PayloadType pt : LinphoneManager.getLc().getVideoPayloadTypes()) {
|
||||
if (pt.getMimeType().equals("H264")) h264 = pt;
|
||||
}
|
||||
|
||||
if (h264 != null) {
|
||||
try {
|
||||
LinphoneManager.getLc().enablePayloadType(h264, enable);
|
||||
} catch (LinphoneCoreException e) {
|
||||
} catch (CoreException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,23 +30,22 @@ import android.widget.Toast;
|
|||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneAccountCreator;
|
||||
import org.linphone.core.LinphoneAccountCreator.LinphoneAccountCreatorListener;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.AccountCreator;
|
||||
import org.linphone.core.AccountCreatorListener;
|
||||
import org.linphone.core.Factory;
|
||||
|
||||
public class CreateAccountActivationFragment extends Fragment implements OnClickListener, LinphoneAccountCreatorListener {
|
||||
public class CreateAccountActivationFragment extends Fragment implements OnClickListener, AccountCreatorListener {
|
||||
private String username, password;
|
||||
private Button checkAccount;
|
||||
private TextView email;
|
||||
private LinphoneAccountCreator accountCreator;
|
||||
private AccountCreator accountCreator;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.assistant_account_creation_email_activation, container, false);
|
||||
|
||||
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc()
|
||||
, LinphonePreferences.instance().getXmlrpcUrl());
|
||||
accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
|
||||
accountCreator.setListener(this);
|
||||
|
||||
username = getArguments().getString("Username");
|
||||
|
@ -73,33 +72,33 @@ public class CreateAccountActivationFragment extends Fragment implements OnClick
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onIsAccountExist(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onCreateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onActivateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onLinkAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onActivateAlias(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onIsAccountActivated(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
return;
|
||||
}
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AccountNotActivated)) {
|
||||
if (status.equals(AccountCreator.Status.AccountNotActivated)) {
|
||||
Toast.makeText(getActivity(), getString(R.string.assistant_account_not_validated), Toast.LENGTH_LONG).show();
|
||||
} else if (status.equals(LinphoneAccountCreator.RequestStatus.AccountActivated)) {
|
||||
} else if (status.equals(AccountCreator.Status.AccountActivated)) {
|
||||
AssistantActivity.instance().linphoneLogIn(accountCreator);
|
||||
AssistantActivity.instance().isAccountVerified(username);
|
||||
} else {
|
||||
|
@ -109,19 +108,19 @@ public class CreateAccountActivationFragment extends Fragment implements OnClick
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onRecoverAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onIsAccountLinked(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onIsAliasUsed(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onUpdateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,9 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneAccountCreator;
|
||||
import org.linphone.core.LinphoneAccountCreator.LinphoneAccountCreatorListener;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.AccountCreator;
|
||||
import org.linphone.core.AccountCreatorListener;
|
||||
import org.linphone.core.Factory;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
|
@ -39,7 +39,7 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class CreateAccountCodeActivationFragment extends Fragment implements LinphoneAccountCreatorListener {
|
||||
public class CreateAccountCodeActivationFragment extends Fragment implements AccountCreatorListener {
|
||||
private String username, phone, dialcode;
|
||||
private TextView title, phonenumber;
|
||||
private EditText code;
|
||||
|
@ -47,7 +47,7 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
|
|||
private int code_length, accountNumber;
|
||||
private ImageView back;
|
||||
private Button checkAccount;
|
||||
private LinphoneAccountCreator accountCreator;
|
||||
private AccountCreator accountCreator;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
|
@ -62,7 +62,7 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
|
|||
accountNumber = getArguments().getInt("AccountNumber");
|
||||
|
||||
code_length = LinphonePreferences.instance().getCodeLength();
|
||||
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl());
|
||||
accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
|
||||
accountCreator.setListener(this);
|
||||
accountCreator.setUsername(username);
|
||||
accountCreator.setPhoneNumber(phone, dialcode);
|
||||
|
@ -121,7 +121,7 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
|
|||
private void linkAccount(){
|
||||
accountCreator.setUsername(LinphonePreferences.instance().getAccountUsername(accountNumber));
|
||||
accountCreator.setHa1(LinphonePreferences.instance().getAccountHa1(accountNumber));
|
||||
accountCreator.activatePhoneNumberLink();
|
||||
accountCreator.activateAlias();
|
||||
}
|
||||
|
||||
private void activateAccount() {
|
||||
|
@ -132,19 +132,19 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onIsAccountExist(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onCreateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onActivateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
return;
|
||||
}
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AccountActivated)) {
|
||||
if (status.equals(AccountCreator.Status.AccountActivated)) {
|
||||
checkAccount.setEnabled(true);
|
||||
if (accountCreator.getUsername() != null) {
|
||||
AssistantActivity.instance().linphoneLogIn(accountCreator);
|
||||
|
@ -161,7 +161,7 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
|
|||
AssistantActivity.instance().success();
|
||||
}
|
||||
}
|
||||
} else if (status.equals(LinphoneAccountCreator.RequestStatus.Failed)) {
|
||||
} else if (status.equals(AccountCreator.Status.RequestFailed)) {
|
||||
Toast.makeText(getActivity(), getString(R.string.wizard_server_unavailable), Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), getString(R.string.assistant_error_confirmation_code), Toast.LENGTH_LONG).show();
|
||||
|
@ -170,17 +170,17 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onLinkAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onActivateAlias(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
return;
|
||||
}
|
||||
if(status.equals(LinphoneAccountCreator.RequestStatus.AccountActivated)){
|
||||
LinphonePreferences.instance().setPrefix(accountNumber, accountCreator.getPrefix(accountCreator.getPhoneNumber()));
|
||||
if(status.equals(AccountCreator.Status.AccountActivated)){
|
||||
LinphonePreferences.instance().setPrefix(accountNumber, org.linphone.core.Utils.getPrefixFromE164(accountCreator.getPhoneNumber()));
|
||||
LinphonePreferences.instance().setLinkPopupTime("");
|
||||
AssistantActivity.instance().hideKeyboard();
|
||||
AssistantActivity.instance().success();
|
||||
|
@ -188,26 +188,26 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onIsAccountActivated(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onRecoverAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onIsAccountLinked(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onIsAliasUsed(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onUpdateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,11 +28,11 @@ import org.linphone.LinphonePreferences;
|
|||
import org.linphone.LinphoneUtils;
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.DialPlan;
|
||||
import org.linphone.core.LinphoneAccountCreator;
|
||||
import org.linphone.core.LinphoneAccountCreator.LinphoneAccountCreatorListener;
|
||||
import org.linphone.core.LinphoneAccountCreator.RequestStatus;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.AccountCreator;
|
||||
import org.linphone.core.AccountCreatorListener;
|
||||
import org.linphone.core.AccountCreator.Status;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
|
@ -59,7 +59,7 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
|
||||
public class CreateAccountFragment extends Fragment implements CompoundButton.OnCheckedChangeListener
|
||||
, OnClickListener, LinphoneAccountCreatorListener {
|
||||
, OnClickListener, AccountCreatorListener {
|
||||
private EditText phoneNumberEdit, usernameEdit, passwordEdit, passwordConfirmEdit
|
||||
, emailEdit, dialCode;
|
||||
private TextView phoneNumberError, passwordError, passwordConfirmError
|
||||
|
@ -76,15 +76,14 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
private int countryCode;
|
||||
private LinearLayout phoneNumberLayout, usernameLayout, emailLayout, passwordLayout, passwordConfirmLayout;
|
||||
private final Pattern UPPER_CASE_REGEX = Pattern.compile("[A-Z]");
|
||||
private LinphoneAccountCreator accountCreator;
|
||||
private AccountCreator accountCreator;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.assistant_account_creation, container, false);
|
||||
|
||||
//Initialize accountCreator
|
||||
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc()
|
||||
, LinphonePreferences.instance().getXmlrpcUrl());
|
||||
accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
|
||||
accountCreator.setListener(this);
|
||||
|
||||
instruction = (TextView) view.findViewById(R.id.message_create_account);
|
||||
|
@ -131,8 +130,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
(TelephonyManager) getActivity().getApplicationContext().getSystemService(
|
||||
Context.TELEPHONY_SERVICE);
|
||||
String countryIso = tm.getNetworkCountryIso();
|
||||
LinphoneProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig();
|
||||
countryCode = proxyConfig.lookupCCCFromIso(countryIso.toUpperCase());
|
||||
ProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig();
|
||||
countryCode = org.linphone.core.Utils.getCccFromIso(countryIso.toUpperCase());
|
||||
|
||||
phoneNumberLayout.setVisibility(View.VISIBLE);
|
||||
|
||||
|
@ -145,14 +144,14 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
DialPlan c = AssistantActivity.instance().country;
|
||||
if (c != null) {
|
||||
selectCountry.setText(c.getCountryName());
|
||||
selectCountry.setText(c.getCountry());
|
||||
dialCode.setText(c.getCountryCallingCode().contains("+") ?
|
||||
c.getCountryCallingCode() : "+" + c.getCountryCallingCode());
|
||||
} else {
|
||||
c = AssistantActivity.instance().getCountryListAdapter()
|
||||
.getCountryFromCountryCode(String.valueOf(countryCode));
|
||||
if (c != null) {
|
||||
selectCountry.setText(c.getCountryName());
|
||||
selectCountry.setText(c.getCountry());
|
||||
dialCode.setText(c.getCountryCallingCode().contains("+") ?
|
||||
c.getCountryCallingCode() : "+" + c.getCountryCallingCode());
|
||||
}
|
||||
|
@ -325,9 +324,9 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
} else {
|
||||
if (useEmail.isChecked()) accountCreator.setPhoneNumber(null, null);
|
||||
if (!getResources().getBoolean(R.bool.isTablet) || getUsername().length() > 0) {
|
||||
accountCreator.isAccountUsed();
|
||||
accountCreator.isAccountExist();
|
||||
} else {
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForUsernameStatus(LinphoneAccountCreator.UsernameCheck.TooShort)
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForUsernameStatus(AccountCreator.UsernameStatus.TooShort)
|
||||
, AssistantActivity.instance());
|
||||
createAccount.setEnabled(true);
|
||||
}
|
||||
|
@ -350,9 +349,9 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
);
|
||||
int status = accountCreator.setPhoneNumber(
|
||||
phoneNumberEdit.getText().toString(), LinphoneUtils.getCountryCode(dialCode));
|
||||
boolean isOk = status == LinphoneAccountCreator.PhoneNumberCheck.Ok.value();
|
||||
boolean isOk = status == AccountCreator.PhoneNumberStatus.Ok.toInt();
|
||||
if (isOk) {
|
||||
accountCreator.linkPhoneNumberWithAccount();
|
||||
accountCreator.linkAccount();
|
||||
} else {
|
||||
createAccount.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForPhoneNumberStatus(status), AssistantActivity.instance());
|
||||
|
@ -363,8 +362,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
private void createAccount() {
|
||||
if ((getResources().getBoolean(R.bool.isTablet) || !getResources().getBoolean(R.bool.use_phone_number_validation))
|
||||
&& useEmail.isChecked()) {
|
||||
LinphoneAccountCreator.EmailCheck emailStatus;
|
||||
LinphoneAccountCreator.PasswordCheck passwordStatus;
|
||||
AccountCreator.EmailStatus emailStatus;
|
||||
AccountCreator.PasswordStatus passwordStatus;
|
||||
|
||||
passwordStatus = accountCreator.setPassword(passwordEdit.getText().toString());
|
||||
emailStatus = accountCreator.setEmail(emailEdit.getText().toString());
|
||||
|
@ -395,7 +394,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
boolean isOk;
|
||||
phoneStatus = accountCreator.setPhoneNumber(
|
||||
phoneNumberEdit.getText().toString(), LinphoneUtils.getCountryCode(dialCode));
|
||||
isOk = phoneStatus == LinphoneAccountCreator.PhoneNumberCheck.Ok.value();
|
||||
isOk = phoneStatus == AccountCreator.PhoneNumberStatus.Ok.toInt();
|
||||
if (!useUsername.isChecked() && accountCreator.getUsername() == null) {
|
||||
accountCreator.setUsername(accountCreator.getPhoneNumber());
|
||||
} else {
|
||||
|
@ -432,7 +431,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
|
||||
if (!useEmail.isChecked() && getResources().getBoolean(R.bool.use_phone_number_validation)) {
|
||||
int status = getPhoneNumberStatus();
|
||||
boolean isOk = (status == LinphoneAccountCreator.PhoneNumberCheck.Ok.value());
|
||||
boolean isOk = (status == AccountCreator.PhoneNumberStatus.Ok.toInt());
|
||||
LinphoneUtils.displayError(isOk, phoneNumberError, LinphoneUtils.errorForPhoneNumberStatus(status));
|
||||
|
||||
// Username or phone number
|
||||
|
@ -441,7 +440,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
|
||||
if (!isOk) {
|
||||
if (status == LinphoneAccountCreator.PhoneNumberCheck.CountryCodeInvalid.value()) {
|
||||
if (status == AccountCreator.PhoneNumberStatus.InvalidCountryCode.toInt()) {
|
||||
dialCode.setBackgroundResource(R.drawable.resizable_textfield_error);
|
||||
phoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield);
|
||||
} else {
|
||||
|
@ -475,7 +474,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
.getCountryFromCountryCode(dialCode.getText().toString());
|
||||
if (c != null) {
|
||||
AssistantActivity.instance().country = c;
|
||||
selectCountry.setText(c.getCountryName());
|
||||
selectCountry.setText(c.getCountry());
|
||||
} else {
|
||||
selectCountry.setText(R.string.select_your_country);
|
||||
}
|
||||
|
@ -513,8 +512,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
field.addTextChangedListener(new TextWatcher() {
|
||||
public void afterTextChanged(Editable s) {
|
||||
emailOk = false;
|
||||
LinphoneAccountCreator.EmailCheck status = accountCreator.setEmail(field.getText().toString());
|
||||
if (status.equals(LinphoneAccountCreator.EmailCheck.Ok)) {
|
||||
AccountCreator.EmailStatus status = accountCreator.setEmail(field.getText().toString());
|
||||
if (status.equals(AccountCreator.EmailStatus.Ok)) {
|
||||
emailOk = true;
|
||||
LinphoneUtils.displayError(emailOk, emailError, "");
|
||||
}
|
||||
|
@ -536,7 +535,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
TextWatcher passwordListener = new TextWatcher() {
|
||||
public void afterTextChanged(Editable s) {
|
||||
passwordOk = false;
|
||||
LinphoneAccountCreator.PasswordCheck status = accountCreator.setPassword(field1.getText().toString());
|
||||
AccountCreator.PasswordStatus status = accountCreator.setPassword(field1.getText().toString());
|
||||
if (isPasswordCorrect(field1.getText().toString())) {
|
||||
passwordOk = true;
|
||||
LinphoneUtils.displayError(passwordOk, passwordError, "");
|
||||
|
@ -584,14 +583,14 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, final RequestStatus status) {
|
||||
if (status.equals(RequestStatus.AccountExist) || status.equals(RequestStatus.AccountExistWithAlias)) {
|
||||
public void onIsAccountExist(AccountCreator accountCreator, final Status status, String resp) {
|
||||
if (status.equals(Status.AccountExist) || status.equals(Status.AccountExistWithAlias)) {
|
||||
if (useEmail.isChecked()) {
|
||||
createAccount.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status)
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status)
|
||||
, AssistantActivity.instance());
|
||||
} else {
|
||||
accountCreator.isPhoneNumberUsed();
|
||||
accountCreator.isAliasUsed();
|
||||
}
|
||||
} else {
|
||||
createAccount();
|
||||
|
@ -599,8 +598,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, RequestStatus status) {
|
||||
if (status.equals(RequestStatus.AccountCreated)) {
|
||||
public void onCreateAccount(AccountCreator accountCreator, Status status, String resp) {
|
||||
if (status.equals(Status.AccountCreated)) {
|
||||
if (useEmail.isChecked() || !getResources().getBoolean(R.bool.use_phone_number_validation)) {
|
||||
AssistantActivity.instance().displayAssistantConfirm(getUsername()
|
||||
, passwordEdit.getText().toString(), emailEdit.getText().toString());
|
||||
|
@ -611,21 +610,21 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
} else {
|
||||
createAccount.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status)
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status)
|
||||
, AssistantActivity.instance());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, RequestStatus status) {
|
||||
public void onActivateAccount(AccountCreator accountCreator, Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, RequestStatus status) {
|
||||
public void onLinkAccount(AccountCreator accountCreator, Status status, String resp) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
return;
|
||||
}
|
||||
if (status.equals(RequestStatus.Ok)) {
|
||||
if (status.equals(Status.RequestOk)) {
|
||||
AssistantActivity.instance().displayAssistantCodeConfirm(getUsername()
|
||||
, phoneNumberEdit.getText().toString()
|
||||
, LinphoneUtils.getCountryCode(dialCode), false);
|
||||
|
@ -633,11 +632,11 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, RequestStatus status) {
|
||||
public void onActivateAlias(AccountCreator accountCreator, Status status, String resp) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
return;
|
||||
}
|
||||
if (status.equals(RequestStatus.Ok)) {
|
||||
if (status.equals(Status.RequestOk)) {
|
||||
AssistantActivity.instance().displayAssistantCodeConfirm(getUsername()
|
||||
, phoneNumberEdit.getText().toString()
|
||||
, LinphoneUtils.getCountryCode(dialCode), false);
|
||||
|
@ -645,30 +644,30 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, RequestStatus status) {
|
||||
public void onIsAccountActivated(AccountCreator accountCreator, Status status, String resp) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
return;
|
||||
}
|
||||
if (status.equals(RequestStatus.AccountNotActivated)) {
|
||||
if (status.equals(Status.AccountNotActivated)) {
|
||||
if (getResources().getBoolean(R.bool.isTablet)
|
||||
|| !getResources().getBoolean(R.bool.use_phone_number_validation)) {
|
||||
//accountCreator.activateAccount(); // Resend email TODO
|
||||
} else {
|
||||
accountCreator.recoverPhoneAccount(); // Resend SMS
|
||||
accountCreator.recoverAccount(); // Resend SMS
|
||||
}
|
||||
} else {
|
||||
createAccount.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status)
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status)
|
||||
, AssistantActivity.instance());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, RequestStatus status) {
|
||||
public void onRecoverAccount(AccountCreator accountCreator, Status status, String resp) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
return;
|
||||
}
|
||||
if (status.equals(RequestStatus.Ok)) {
|
||||
if (status.equals(Status.RequestOk)) {
|
||||
AssistantActivity.instance().displayAssistantCodeConfirm(getUsername()
|
||||
, phoneNumberEdit.getText().toString(), dialCode.getText().toString(), false);
|
||||
} else {
|
||||
|
@ -680,21 +679,21 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, RequestStatus status) {
|
||||
public void onIsAccountLinked(AccountCreator accountCreator, Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator ac, RequestStatus status) {
|
||||
public void onIsAliasUsed(AccountCreator ac, Status status, String resp) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
return;
|
||||
}
|
||||
if (status.equals(RequestStatus.AliasIsAccount) || status.equals(RequestStatus.AliasExist)) {
|
||||
if (status.equals(Status.AliasIsAccount) || status.equals(Status.AliasExist)) {
|
||||
if (accountCreator.getPhoneNumber() != null && accountCreator.getUsername() != null
|
||||
&& accountCreator.getPhoneNumber().compareTo(accountCreator.getUsername()) == 0) {
|
||||
accountCreator.isAccountActivated();
|
||||
} else {
|
||||
createAccount.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status)
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status)
|
||||
, AssistantActivity.instance());
|
||||
}
|
||||
} else {
|
||||
|
@ -703,7 +702,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, RequestStatus status) {
|
||||
public void onUpdateAccount(AccountCreator accountCreator, Status status, String resp) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,15 +22,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphoneXmlRpcRequest;
|
||||
import org.linphone.core.LinphoneXmlRpcRequest.LinphoneXmlRpcRequestListener;
|
||||
import org.linphone.core.LinphoneXmlRpcRequestImpl;
|
||||
import org.linphone.core.LinphoneXmlRpcSession;
|
||||
import org.linphone.core.LinphoneXmlRpcSessionImpl;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Core.EcCalibratorStatus;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.core.XmlRpcRequest;
|
||||
import org.linphone.core.XmlRpcRequestListener;
|
||||
//import org.linphone.core.XmlRpcRequestImpl;
|
||||
import org.linphone.core.XmlRpcSession;
|
||||
//import org.linphone.core.XmlRpcSessionImpl;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.app.Fragment;
|
||||
|
@ -41,12 +41,12 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
public class EchoCancellerCalibrationFragment extends Fragment implements LinphoneXmlRpcRequestListener {
|
||||
public class EchoCancellerCalibrationFragment extends Fragment implements XmlRpcRequestListener {
|
||||
private Handler mHandler = new Handler();
|
||||
private boolean mSendEcCalibrationResult = false;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
private LinphoneXmlRpcSession xmlRpcSession;
|
||||
private LinphoneXmlRpcRequest xmlRpcRequest;
|
||||
private CoreListenerStub mListener;
|
||||
private XmlRpcSession xmlRpcSession;
|
||||
private XmlRpcRequest xmlRpcRequest;
|
||||
private Runnable runFinished;
|
||||
|
||||
@Override
|
||||
|
@ -54,9 +54,9 @@ public class EchoCancellerCalibrationFragment extends Fragment implements Linpho
|
|||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.assistant_ec_calibration, container, false);
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
mListener = new CoreListenerStub(){
|
||||
@Override
|
||||
public void ecCalibrationStatus(LinphoneCore lc, LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data) {
|
||||
public void onEcCalibrationResult(Core lc, Core.EcCalibratorStatus status, int delay_ms, Object data) {
|
||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||
if (mSendEcCalibrationResult) {
|
||||
sendEcCalibrationResult(status, delay_ms);
|
||||
|
@ -71,13 +71,13 @@ public class EchoCancellerCalibrationFragment extends Fragment implements Linpho
|
|||
}
|
||||
};
|
||||
|
||||
xmlRpcSession = new LinphoneXmlRpcSessionImpl(LinphoneManager.getLcIfManagerNotDestroyedOrNull(), LinphonePreferences.instance().getXmlrpcUrl());
|
||||
xmlRpcRequest = new LinphoneXmlRpcRequestImpl("add_ec_calibration_result", LinphoneXmlRpcRequest.ArgType.None);
|
||||
xmlRpcSession = LinphoneManager.getLcIfManagerNotDestroyedOrNull().createXmlRpcSession(LinphonePreferences.instance().getXmlrpcUrl());
|
||||
xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.None, "add_ec_calibration_result");
|
||||
xmlRpcRequest.setListener(this);
|
||||
|
||||
try {
|
||||
LinphoneManager.getInstance().startEcCalibration(mListener);
|
||||
} catch (LinphoneCoreException e) {
|
||||
} catch (CoreException e) {
|
||||
Log.e(e, "Unable to calibrate EC");
|
||||
AssistantActivity.instance().isEchoCalibrationFinished();
|
||||
}
|
||||
|
@ -89,12 +89,12 @@ public class EchoCancellerCalibrationFragment extends Fragment implements Linpho
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||
public void onResponse(XmlRpcRequest request) {
|
||||
mHandler.post(runFinished);
|
||||
}
|
||||
|
||||
private void sendEcCalibrationResult(EcCalibratorStatus status, int delayMs) {
|
||||
Boolean hasBuiltInEchoCanceler = LinphoneManager.getLc().hasBuiltInEchoCanceler();
|
||||
Boolean hasBuiltInEchoCanceler = LinphoneManager.getLc().hasBuiltinEchoCanceller();
|
||||
Log.i("Add echo canceller calibration result: manufacturer=" + Build.MANUFACTURER + " model=" + Build.MODEL + " status=" + status + " delay=" + delayMs + "ms" + " hasBuiltInEchoCanceler " + hasBuiltInEchoCanceler);
|
||||
xmlRpcRequest.addStringArg(Build.MANUFACTURER);
|
||||
xmlRpcRequest.addStringArg(Build.MODEL);
|
||||
|
|
|
@ -24,10 +24,11 @@ import org.linphone.LinphonePreferences;
|
|||
import org.linphone.LinphoneUtils;
|
||||
import org.linphone.R;
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.AccountCreatorListener;
|
||||
import org.linphone.core.DialPlan;
|
||||
import org.linphone.core.LinphoneAccountCreator;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.AccountCreator;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Fragment;
|
||||
|
@ -50,14 +51,14 @@ import android.widget.ImageView;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class LinphoneLoginFragment extends Fragment implements CompoundButton.OnCheckedChangeListener, OnClickListener, TextWatcher, LinphoneAccountCreator.LinphoneAccountCreatorListener {
|
||||
public class LinphoneLoginFragment extends Fragment implements CompoundButton.OnCheckedChangeListener, OnClickListener, TextWatcher, AccountCreatorListener {
|
||||
private EditText login, password, phoneNumberEdit, dialCode;
|
||||
private Button apply, selectCountry;
|
||||
private CheckBox useUsername;
|
||||
private LinearLayout phoneNumberLayout, usernameLayout, passwordLayout;
|
||||
private TextView forgotPassword, messagePhoneNumber, phoneNumberError;
|
||||
private Boolean recoverAccount;
|
||||
private LinphoneAccountCreator accountCreator;
|
||||
private AccountCreator accountCreator;
|
||||
private int countryCode;
|
||||
private String phone, dialcode, username, pwd;
|
||||
private ImageView phoneNumberInfo;
|
||||
|
@ -67,7 +68,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
|||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.assistant_linphone_login, container, false);
|
||||
|
||||
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl());
|
||||
accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
|
||||
accountCreator.setListener(this);
|
||||
|
||||
String url = "http://linphone.org/free-sip-service.html&action=recover";
|
||||
|
@ -110,20 +111,20 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
|||
(TelephonyManager) getActivity().getApplicationContext().getSystemService(
|
||||
Context.TELEPHONY_SERVICE);
|
||||
String countryIso = tm.getNetworkCountryIso();
|
||||
LinphoneProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig();
|
||||
countryCode = proxyConfig.lookupCCCFromIso(countryIso.toUpperCase());
|
||||
ProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig();
|
||||
countryCode = org.linphone.core.Utils.getCccFromIso(countryIso.toUpperCase());
|
||||
|
||||
|
||||
DialPlan c = AssistantActivity.instance().country;
|
||||
if (c != null) {
|
||||
selectCountry.setText(c.getCountryName());
|
||||
selectCountry.setText(c.getCountry());
|
||||
dialCode.setText(c.getCountryCallingCode().contains("+") ?
|
||||
c.getCountryCallingCode() : "+" + c.getCountryCallingCode());
|
||||
} else {
|
||||
c = AssistantActivity.instance().getCountryListAdapter()
|
||||
.getCountryFromCountryCode(String.valueOf(countryCode));
|
||||
if (c != null) {
|
||||
selectCountry.setText(c.getCountryName());
|
||||
selectCountry.setText(c.getCountry());
|
||||
dialCode.setText(c.getCountryCallingCode().contains("+") ?
|
||||
c.getCountryCallingCode() : "+" + c.getCountryCallingCode());
|
||||
}
|
||||
|
@ -195,7 +196,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
accountCreator.setUsername(login.getText().toString());
|
||||
accountCreator.setPassword(password.getText().toString());
|
||||
accountCreator.isAccountUsed();
|
||||
accountCreator.isAccountExist();
|
||||
}
|
||||
|
||||
private int getPhoneNumberStatus() {
|
||||
|
@ -209,7 +210,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
|||
DialPlan c = AssistantActivity.instance().getCountryListAdapter().getCountryFromCountryCode(dialCode.getText().toString());
|
||||
if (c != null) {
|
||||
AssistantActivity.instance().country = c;
|
||||
selectCountry.setText(c.getCountryName());
|
||||
selectCountry.setText(c.getCountry());
|
||||
} else {
|
||||
selectCountry.setText(R.string.select_your_country);
|
||||
}
|
||||
|
@ -260,10 +261,10 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
|||
private void recoverAccount() {
|
||||
if (phoneNumberEdit.length() > 0 || dialCode.length() > 1) {
|
||||
int status = getPhoneNumberStatus();
|
||||
boolean isOk = status == LinphoneAccountCreator.PhoneNumberCheck.Ok.value();
|
||||
boolean isOk = status == AccountCreator.PhoneNumberStatus.Ok.toInt();
|
||||
if (isOk) {
|
||||
LinphoneManager.getLc().getConfig().loadXmlFile(LinphoneManager.getInstance().getmDynamicConfigFile());
|
||||
accountCreator.isPhoneNumberUsed();
|
||||
LinphoneManager.getLc().getConfig().loadFromXmlFile(LinphoneManager.getInstance().getmDynamicConfigFile());
|
||||
accountCreator.isAliasUsed();
|
||||
} else {
|
||||
apply.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForPhoneNumberStatus(status),
|
||||
|
@ -282,10 +283,10 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
|||
|
||||
public void onTextChanged2() {
|
||||
int status = getPhoneNumberStatus();
|
||||
boolean isOk = status == LinphoneAccountCreator.PhoneNumberCheck.Ok.value();
|
||||
boolean isOk = status == AccountCreator.PhoneNumberStatus.Ok.toInt();
|
||||
LinphoneUtils.displayError(isOk, phoneNumberError, LinphoneUtils.errorForPhoneNumberStatus(status));
|
||||
if (!isOk) {
|
||||
if ((1 == (status & LinphoneAccountCreator.PhoneNumberCheck.CountryCodeInvalid.value()))) {
|
||||
if ((1 == (status & AccountCreator.PhoneNumberStatus.InvalidCountryCode.toInt()))) {
|
||||
dialCode.setBackgroundResource(R.drawable.resizable_textfield_error);
|
||||
phoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield);
|
||||
} else {
|
||||
|
@ -329,47 +330,47 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onIsAccountExist(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
apply.setEnabled(true);
|
||||
return;
|
||||
}
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AccountExist) || status.equals(LinphoneAccountCreator.RequestStatus.AccountExistWithAlias)) {
|
||||
if (status.equals(AccountCreator.Status.AccountExist) || status.equals(AccountCreator.Status.AccountExistWithAlias)) {
|
||||
AssistantActivity.instance().linphoneLogIn(accountCreator);
|
||||
} else {
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status), AssistantActivity.instance());
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), AssistantActivity.instance());
|
||||
}
|
||||
apply.setEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onCreateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onActivateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onLinkAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onActivateAlias(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onIsAccountActivated(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onRecoverAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
apply.setEnabled(true);
|
||||
return;
|
||||
}
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.ErrorServer)) {
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(LinphoneAccountCreator.RequestStatus.Failed), AssistantActivity.instance());
|
||||
if (status.equals(AccountCreator.Status.ServerError)) {
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(AccountCreator.Status.RequestFailed), AssistantActivity.instance());
|
||||
apply.setEnabled(true);
|
||||
} else {
|
||||
AssistantActivity.instance().displayAssistantCodeConfirm(accountCreator.getUsername(), phoneNumberEdit.getText().toString(), LinphoneUtils.getCountryCode(dialCode), true);
|
||||
|
@ -377,25 +378,25 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onIsAccountLinked(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onIsAliasUsed(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
apply.setEnabled(true);
|
||||
return;
|
||||
}
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AliasIsAccount) || status.equals(LinphoneAccountCreator.RequestStatus.AliasExist)) {
|
||||
accountCreator.recoverPhoneAccount();
|
||||
if (status.equals(AccountCreator.Status.AliasIsAccount) || status.equals(AccountCreator.Status.AliasExist)) {
|
||||
accountCreator.recoverAccount();
|
||||
} else {
|
||||
apply.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status), AssistantActivity.instance());
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), AssistantActivity.instance());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
public void onUpdateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneAddress.TransportType;
|
||||
import org.linphone.core.Address.TransportType;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
|
@ -71,12 +71,12 @@ public class LoginFragment extends Fragment implements OnClickListener, TextWatc
|
|||
|
||||
TransportType transport;
|
||||
if(transports.getCheckedRadioButtonId() == R.id.transport_udp){
|
||||
transport = TransportType.LinphoneTransportUdp;
|
||||
transport = TransportType.Udp;
|
||||
} else {
|
||||
if(transports.getCheckedRadioButtonId() == R.id.transport_tcp){
|
||||
transport = TransportType.LinphoneTransportTcp;
|
||||
transport = TransportType.Tcp;
|
||||
} else {
|
||||
transport = TransportType.LinphoneTransportTls;
|
||||
transport = TransportType.Tls;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,9 +27,9 @@ import org.linphone.LinphoneManager;
|
|||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.LinphoneService;
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCore.RemoteProvisioningState;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Core.ConfiguringState;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.app.Activity;
|
||||
|
@ -47,7 +47,7 @@ public class RemoteProvisioningActivity extends Activity {
|
|||
private Handler mHandler = new Handler();
|
||||
private String configUriParam = null;
|
||||
private ProgressBar spinner;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
private CoreListenerStub mListener;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -55,13 +55,13 @@ public class RemoteProvisioningActivity extends Activity {
|
|||
setContentView(R.layout.remote_provisioning);
|
||||
spinner = (ProgressBar) findViewById(R.id.spinner);
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
mListener = new CoreListenerStub(){
|
||||
@Override
|
||||
public void configuringStatus(LinphoneCore lc, final RemoteProvisioningState state, String message) {
|
||||
public void onConfiguringStatus(Core lc, final ConfiguringState state, String message) {
|
||||
if (spinner != null) spinner.setVisibility(View.GONE);
|
||||
if (state == RemoteProvisioningState.ConfiguringSuccessful) {
|
||||
if (state == ConfiguringState.Successful) {
|
||||
goToLinphoneActivity();
|
||||
} else if (state == RemoteProvisioningState.ConfiguringFailed) {
|
||||
} else if (state == ConfiguringState.Failed) {
|
||||
Toast.makeText(RemoteProvisioningActivity.this, R.string.remote_provisioning_failure, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class RemoteProvisioningActivity extends Activity {
|
|||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public class RemoteProvisioningActivity extends Activity {
|
|||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ public class RemoteProvisioningActivity extends Activity {
|
|||
mHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
LinphoneManager.getInstance().restartLinphoneCore();
|
||||
LinphoneManager.getInstance().restartCore();
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
|
|
@ -60,8 +60,8 @@ public class RemoteProvisioningFragment extends Fragment implements OnClickListe
|
|||
String url = remoteProvisioningUrl.getText().toString();
|
||||
AssistantActivity.instance().displayRemoteProvisioningInProgressDialog();
|
||||
LinphonePreferences.instance().setRemoteProvisioningUrl(url);
|
||||
LinphoneManager.getInstance().restartLinphoneCore();
|
||||
AssistantActivity.instance().setLinphoneCoreListener();
|
||||
LinphoneManager.getInstance().restartCore();
|
||||
AssistantActivity.instance().setCoreListener();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.xmlrpc.XmlRpcHelper;
|
||||
import org.linphone.xmlrpc.XmlRpcListenerBase;
|
||||
|
||||
|
@ -37,7 +37,7 @@ import android.widget.Toast;
|
|||
public class RemoteProvisioningLoginActivity extends Activity implements OnClickListener {
|
||||
private EditText login, password, domain;
|
||||
private Button connect;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
private CoreListenerStub mListener;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -57,12 +57,12 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
|||
domain.setEnabled(false);
|
||||
}
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
mListener = new CoreListenerStub(){
|
||||
@Override
|
||||
public void configuringStatus(LinphoneCore lc, final LinphoneCore.RemoteProvisioningState state, String message) {
|
||||
if (state == LinphoneCore.RemoteProvisioningState.ConfiguringSuccessful) {
|
||||
public void onConfiguringStatus(Core lc, final Core.ConfiguringState state, String message) {
|
||||
if (state == Core.ConfiguringState.Successful) {
|
||||
//TODO
|
||||
} else if (state == LinphoneCore.RemoteProvisioningState.ConfiguringFailed) {
|
||||
} else if (state == Core.ConfiguringState.Failed) {
|
||||
Toast.makeText(RemoteProvisioningLoginActivity.this, R.string.remote_provisioning_failure, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
|||
@Override
|
||||
public void onRemoteProvisioningFilenameSent(String result) {
|
||||
LinphonePreferences.instance().setRemoteProvisioningUrl(result);
|
||||
LinphoneManager.getInstance().restartLinphoneCore();
|
||||
LinphoneManager.getInstance().restartCore();
|
||||
}
|
||||
}, username.toString(), password.toString(), domain.toString());
|
||||
|
||||
|
@ -91,16 +91,16 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
|||
setResult(Activity.RESULT_OK);
|
||||
finish();
|
||||
/*String identity = "sip:" + username + "@" + domain;
|
||||
LinphoneProxyConfig prxCfg = lc.createProxyConfig();
|
||||
ProxyConfig prxCfg = lc.createProxyConfig();
|
||||
try {
|
||||
prxCfg.setIdentity(identity);
|
||||
prxCfg.setIdentityAddress(identity);
|
||||
lc.addProxyConfig(prxCfg);
|
||||
} catch (LinphoneCoreException e) {
|
||||
} catch (CoreException e) {
|
||||
Log.e(e);
|
||||
return false;
|
||||
}
|
||||
|
||||
LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(username, null, password, null, null, domain);
|
||||
AuthInfo authInfo = Factory.instance().createAuthInfo(username, null, password, null, null, domain);
|
||||
lc.addAuthInfo(authInfo);
|
||||
|
||||
if (LinphonePreferences.instance().getAccountCount() == 1)
|
||||
|
@ -112,7 +112,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
|||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
|||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.linphone.LinphonePreferences;
|
|||
import org.linphone.LinphoneService;
|
||||
import org.linphone.R;
|
||||
import org.linphone.UIThreadDispatcher;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.content.Context;
|
||||
|
@ -43,8 +43,8 @@ public class GCMService extends GCMBaseIntentService {
|
|||
private void initLogger(Context context) {
|
||||
LinphonePreferences.instance().setContext(context);
|
||||
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
||||
LinphoneCoreFactory.instance().enableLogCollection(isDebugEnabled);
|
||||
LinphoneCoreFactory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name));
|
||||
Factory.instance().enableLogCollection(isDebugEnabled);
|
||||
Factory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class GCMService extends GCMBaseIntentService {
|
|||
Log.d("[Push Notification] Received");
|
||||
|
||||
if (!LinphoneService.isReady()) {
|
||||
startService(new Intent(ACTION_MAIN).setClass(this, LinphoneService.class));
|
||||
context.startService(new Intent(ACTION_MAIN).setClass(context, LinphoneService.class));
|
||||
} else if (LinphoneManager.isInstanciated() && LinphoneManager.getLc().getCallsNb() == 0) {
|
||||
UIThreadDispatcher.dispatch(new Runnable(){
|
||||
@Override
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.Locale;
|
|||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
|
@ -116,7 +116,7 @@ public class InAppPurchaseFragment extends Fragment implements View.OnClickListe
|
|||
}
|
||||
|
||||
private boolean isUsernameCorrect(String username) {
|
||||
LinphoneProxyConfig lpc = LinphoneManager.getLc().createProxyConfig();
|
||||
ProxyConfig lpc = LinphoneManager.getLc().createProxyConfig();
|
||||
return lpc.isPhoneNumber(username);
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ public class InAppPurchaseFragment extends Fragment implements View.OnClickListe
|
|||
|
||||
private String getUsername() {
|
||||
String username = this.username.getText().toString();
|
||||
LinphoneProxyConfig lpc = LinphoneManager.getLc().createProxyConfig();
|
||||
ProxyConfig lpc = LinphoneManager.getLc().createProxyConfig();
|
||||
username = lpc.normalizePhoneNumber(username);
|
||||
return username.toLowerCase(Locale.getDefault());
|
||||
}
|
||||
|
|
|
@ -22,10 +22,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.CallDirection;
|
||||
import org.linphone.core.LinphoneCallLog;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.Call;
|
||||
import org.linphone.core.Call.Dir;
|
||||
import org.linphone.core.CallLog;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
@ -54,10 +55,10 @@ public class CallButton extends ImageView implements OnClickListener, AddressAwa
|
|||
LinphoneManager.getInstance().newOutgoingCall(mAddress);
|
||||
} else {
|
||||
if (LinphonePreferences.instance().isBisFeatureEnabled()) {
|
||||
LinphoneCallLog[] logs = LinphoneManager.getLc().getCallLogs();
|
||||
LinphoneCallLog log = null;
|
||||
for (LinphoneCallLog l : logs) {
|
||||
if (l.getDirection() == CallDirection.Outgoing) {
|
||||
CallLog[] logs = LinphoneManager.getLc().getCallLogs();
|
||||
CallLog log = null;
|
||||
for (CallLog l : logs) {
|
||||
if (l.getDir() == Call.Dir.Outgoing) {
|
||||
log = l;
|
||||
break;
|
||||
}
|
||||
|
@ -66,18 +67,18 @@ public class CallButton extends ImageView implements OnClickListener, AddressAwa
|
|||
return;
|
||||
}
|
||||
|
||||
LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
|
||||
if (lpc != null && log.getTo().getDomain().equals(lpc.getDomain())) {
|
||||
mAddress.setText(log.getTo().getUserName());
|
||||
ProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
|
||||
if (lpc != null && log.getToAddress().getDomain().equals(lpc.getDomain())) {
|
||||
mAddress.setText(log.getToAddress().getUsername());
|
||||
} else {
|
||||
mAddress.setText(log.getTo().asStringUriOnly());
|
||||
mAddress.setText(log.getToAddress().asStringUriOnly());
|
||||
}
|
||||
mAddress.setSelection(mAddress.getText().toString().length());
|
||||
mAddress.setDisplayedName(log.getTo().getDisplayName());
|
||||
mAddress.setDisplayedName(log.getToAddress().getDisplayName());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (LinphoneCoreException e) {
|
||||
} catch (CoreException e) {
|
||||
LinphoneManager.getInstance().terminateCall();
|
||||
onWrongDestinationAddress();
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ import org.linphone.LinphoneManager;
|
|||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.LinphoneService;
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
|
@ -106,11 +106,11 @@ public class Digit extends Button implements AddressAware {
|
|||
public void onClick(View v) {
|
||||
if (mPlayDtmf) {
|
||||
if (!linphoneServiceReady()) return;
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
Core lc = LinphoneManager.getLc();
|
||||
lc.stopDtmf();
|
||||
mIsDtmfStarted =false;
|
||||
if (lc.isIncall()) {
|
||||
lc.sendDtmf(mKeyCode);
|
||||
if (lc.inCall()) {
|
||||
lc.getCurrentCall().sendDtmf(mKeyCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,10 +138,10 @@ public class Digit extends Button implements AddressAware {
|
|||
public void onClick(DialogInterface dialog, int which) {
|
||||
if(which == 0){
|
||||
LinphonePreferences.instance().setDebugEnabled(false);
|
||||
LinphoneCoreFactory.instance().enableLogCollection(false);
|
||||
Factory.instance().enableLogCollection(false);
|
||||
}
|
||||
if(which == 1) {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.uploadLogCollection();
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ public class Digit extends Button implements AddressAware {
|
|||
public void onClick(DialogInterface dialog, int which) {
|
||||
if(which == 0) {
|
||||
LinphonePreferences.instance().setDebugEnabled(true);
|
||||
LinphoneCoreFactory.instance().enableLogCollection(true);
|
||||
Factory.instance().enableLogCollection(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -171,7 +171,7 @@ public class Digit extends Button implements AddressAware {
|
|||
CallActivity.instance().resetControlsHidingCallBack();
|
||||
}
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
Core lc = LinphoneManager.getLc();
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN && !mIsDtmfStarted) {
|
||||
LinphoneManager.getInstance().playDtmf(getContext().getContentResolver(), mKeyCode);
|
||||
mIsDtmfStarted = true;
|
||||
|
@ -186,7 +186,7 @@ public class Digit extends Button implements AddressAware {
|
|||
|
||||
public boolean onLongClick(View v) {
|
||||
int id = v.getId();
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
Core lc = LinphoneManager.getLc();
|
||||
|
||||
if (mPlayDtmf) {
|
||||
if (!linphoneServiceReady()) return true;
|
||||
|
|
|
@ -22,8 +22,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
import org.linphone.LinphoneActivity;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphoneService;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCallParams;
|
||||
import org.linphone.core.Call;
|
||||
import org.linphone.core.CallParams;
|
||||
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
||||
|
||||
import android.content.Context;
|
||||
|
@ -63,7 +63,7 @@ public class LinphoneOverlay extends org.linphone.mediastream.video.display.GL2J
|
|||
|
||||
androidVideoWindowImpl = new AndroidVideoWindowImpl(this, null, new AndroidVideoWindowImpl.VideoWindowListener() {
|
||||
public void onVideoRenderingSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) {
|
||||
LinphoneManager.getLc().setVideoWindow(vw);
|
||||
LinphoneManager.getLc().setNativeVideoWindowId(vw);
|
||||
}
|
||||
|
||||
public void onVideoRenderingSurfaceDestroyed(AndroidVideoWindowImpl vw) {
|
||||
|
@ -77,11 +77,11 @@ public class LinphoneOverlay extends org.linphone.mediastream.video.display.GL2J
|
|||
}
|
||||
});
|
||||
|
||||
LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
|
||||
LinphoneCallParams callParams = call.getCurrentParams();
|
||||
params.width = callParams.getReceivedVideoSize().width;
|
||||
params.height = callParams.getReceivedVideoSize().height;
|
||||
LinphoneManager.getLc().setVideoWindow(androidVideoWindowImpl);
|
||||
Call call = LinphoneManager.getLc().getCurrentCall();
|
||||
CallParams callParams = call.getCurrentParams();
|
||||
params.width = callParams.getReceivedVideoDefinition().width;
|
||||
params.height = callParams.getReceivedVideoDefinition().height;
|
||||
LinphoneManager.getLc().setNativeVideoWindowId(androidVideoWindowImpl);
|
||||
|
||||
setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -218,6 +218,7 @@ public class SlidingDrawer extends ViewGroup {
|
|||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mHandle = findViewById(mHandleId);
|
||||
if (mHandle == null) {
|
||||
throw new IllegalArgumentException(
|
||||
|
|
|
@ -21,11 +21,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.core.LinphoneXmlRpcRequest;
|
||||
import org.linphone.core.LinphoneXmlRpcRequest.LinphoneXmlRpcRequestListener;
|
||||
import org.linphone.core.LinphoneXmlRpcRequestImpl;
|
||||
import org.linphone.core.LinphoneXmlRpcSession;
|
||||
import org.linphone.core.LinphoneXmlRpcSessionImpl;
|
||||
import org.linphone.core.XmlRpcRequest;
|
||||
import org.linphone.core.XmlRpcRequestListener;
|
||||
//import org.linphone.core.XmlRpcRequestImpl;
|
||||
import org.linphone.core.XmlRpcSession;
|
||||
//import org.linphone.core.XmlRpcSessionImpl;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
public class XmlRpcHelper {
|
||||
|
@ -43,26 +43,26 @@ public class XmlRpcHelper {
|
|||
public static final String CLIENT_ERROR_INVALID_SERVER_URL = "INVALID_SERVER_URL";
|
||||
public static final String CLIENT_ERROR_SERVER_NOT_REACHABLE = "SERVER_NOT_REACHABLE";
|
||||
|
||||
private LinphoneXmlRpcSession xmlRpcSession;
|
||||
private XmlRpcSession xmlRpcSession;
|
||||
|
||||
public XmlRpcHelper() {
|
||||
xmlRpcSession = new LinphoneXmlRpcSessionImpl(LinphoneManager.getLcIfManagerNotDestroyedOrNull(), LinphonePreferences.instance().getInAppPurchaseValidatingServerUrl());
|
||||
xmlRpcSession = LinphoneManager.getLcIfManagerNotDestroyedOrNull().createXmlRpcSession(LinphonePreferences.instance().getInAppPurchaseValidatingServerUrl());
|
||||
}
|
||||
|
||||
public void createAccountAsync(final XmlRpcListener listener, String username, String email, String password) {
|
||||
LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("create_account", LinphoneXmlRpcRequest.ArgType.String);
|
||||
xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
|
||||
XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "create_account");
|
||||
xmlRpcRequest.setListener(new XmlRpcRequestListener() {
|
||||
@Override
|
||||
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||
public void onResponse(XmlRpcRequest request) {
|
||||
String result = request.getStringResponse();
|
||||
if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
|
||||
if (request.getStatus() == XmlRpcRequest.Status.Ok) {
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
return;
|
||||
}
|
||||
listener.onAccountCreated(result);
|
||||
} else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
|
||||
} else if (request.getStatus() == XmlRpcRequest.Status.Failed) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
}
|
||||
|
@ -75,19 +75,19 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
public void getAccountExpireAsync(final XmlRpcListener listener, String username, String password) {
|
||||
LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("get_account_expiration", LinphoneXmlRpcRequest.ArgType.String);
|
||||
xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
|
||||
XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "get_account_expiration");
|
||||
xmlRpcRequest.setListener(new XmlRpcRequestListener() {
|
||||
@Override
|
||||
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||
public void onResponse(XmlRpcRequest request) {
|
||||
String result = request.getStringResponse();
|
||||
if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
|
||||
if (request.getStatus() == XmlRpcRequest.Status.Ok) {
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
return;
|
||||
}
|
||||
listener.onAccountExpireFetched(result);
|
||||
} else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
|
||||
} else if (request.getStatus() == XmlRpcRequest.Status.Failed) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
}
|
||||
|
@ -99,19 +99,19 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
public void updateAccountExpireAsync(final XmlRpcListener listener, String username, String password, String domain, String payload, String signature) {
|
||||
LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("update_expiration_date", LinphoneXmlRpcRequest.ArgType.String);
|
||||
xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
|
||||
XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "update_expiration_date");
|
||||
xmlRpcRequest.setListener(new XmlRpcRequestListener() {
|
||||
@Override
|
||||
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||
public void onResponse(XmlRpcRequest request) {
|
||||
String result = request.getStringResponse();
|
||||
if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
|
||||
if (request.getStatus() == XmlRpcRequest.Status.Ok) {
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
return;
|
||||
}
|
||||
listener.onAccountExpireUpdated(result);
|
||||
} else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
|
||||
} else if (request.getStatus() == XmlRpcRequest.Status.Failed) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
}
|
||||
|
@ -126,19 +126,19 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
public void activateAccountAsync(final XmlRpcListener listener, String username, String password) {
|
||||
LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("activate_account", LinphoneXmlRpcRequest.ArgType.String);
|
||||
xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
|
||||
XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "activate_account");
|
||||
xmlRpcRequest.setListener(new XmlRpcRequestListener() {
|
||||
@Override
|
||||
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||
public void onResponse(XmlRpcRequest request) {
|
||||
String result = request.getStringResponse();
|
||||
if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
|
||||
if (request.getStatus() == XmlRpcRequest.Status.Ok) {
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
return;
|
||||
}
|
||||
listener.onAccountActivated(result);
|
||||
} else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
|
||||
} else if (request.getStatus() == XmlRpcRequest.Status.Failed) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
}
|
||||
|
@ -150,12 +150,12 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
public void isAccountActivatedAsync(final XmlRpcListener listener, String username) {
|
||||
LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("check_account_activated", LinphoneXmlRpcRequest.ArgType.String);
|
||||
xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
|
||||
XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "check_account_activated");
|
||||
xmlRpcRequest.setListener(new XmlRpcRequestListener() {
|
||||
@Override
|
||||
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||
public void onResponse(XmlRpcRequest request) {
|
||||
String result = request.getStringResponse();
|
||||
if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
|
||||
if (request.getStatus() == XmlRpcRequest.Status.Ok) {
|
||||
if ("OK".equals(result)) {
|
||||
listener.onAccountActivatedFetched(true);
|
||||
return;
|
||||
|
@ -164,7 +164,7 @@ public class XmlRpcHelper {
|
|||
listener.onError(result);
|
||||
}
|
||||
listener.onAccountActivatedFetched(false);
|
||||
} else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
|
||||
} else if (request.getStatus() == XmlRpcRequest.Status.Failed) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
}
|
||||
|
@ -175,17 +175,17 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
public void isTrialAccountAsync(final XmlRpcListener listener, String username, String password) {
|
||||
LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("is_account_trial", LinphoneXmlRpcRequest.ArgType.String);
|
||||
xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
|
||||
XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "is_account_trial");
|
||||
xmlRpcRequest.setListener(new XmlRpcRequestListener() {
|
||||
@Override
|
||||
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||
public void onResponse(XmlRpcRequest request) {
|
||||
String result = request.getStringResponse();
|
||||
if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
|
||||
if (request.getStatus() == XmlRpcRequest.Status.Ok) {
|
||||
if (!"NOK".equals(result) && !"OK".equals(result)) {
|
||||
listener.onError(result);
|
||||
}
|
||||
listener.onTrialAccountFetched("OK".equals(result));
|
||||
} else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
|
||||
} else if (request.getStatus() == XmlRpcRequest.Status.Failed) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
}
|
||||
|
@ -197,12 +197,12 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
public void isAccountAsync(final XmlRpcListener listener, String username) {
|
||||
LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("check_account_activated", LinphoneXmlRpcRequest.ArgType.String);
|
||||
xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
|
||||
XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "check_account_activated");
|
||||
xmlRpcRequest.setListener(new XmlRpcRequestListener() {
|
||||
@Override
|
||||
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||
public void onResponse(XmlRpcRequest request) {
|
||||
String result = request.getStringResponse();
|
||||
if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
|
||||
if (request.getStatus() == XmlRpcRequest.Status.Ok) {
|
||||
if ("OK".equals(result)) {
|
||||
listener.onAccountFetched(true);
|
||||
return;
|
||||
|
@ -211,7 +211,7 @@ public class XmlRpcHelper {
|
|||
listener.onError(result);
|
||||
}
|
||||
listener.onAccountFetched(false);
|
||||
} else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
|
||||
} else if (request.getStatus() == XmlRpcRequest.Status.Failed) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
}
|
||||
|
@ -222,12 +222,12 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
public void changeAccountEmailAsync(final XmlRpcListener listener, String username, String password, String newEmail) {
|
||||
LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("change_email", LinphoneXmlRpcRequest.ArgType.String);
|
||||
xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
|
||||
XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "change_email");
|
||||
xmlRpcRequest.setListener(new XmlRpcRequestListener() {
|
||||
@Override
|
||||
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||
public void onResponse(XmlRpcRequest request) {
|
||||
String result = request.getStringResponse();
|
||||
if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
|
||||
if (request.getStatus() == XmlRpcRequest.Status.Ok) {
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
|
@ -235,7 +235,7 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
listener.onAccountEmailChanged(result);
|
||||
} else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
|
||||
} else if (request.getStatus() == XmlRpcRequest.Status.Failed) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
}
|
||||
|
@ -248,12 +248,12 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
public void changeAccountPasswordAsync(final XmlRpcListener listener, String username, String oldPassword, String newPassword) {
|
||||
LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("change_password", LinphoneXmlRpcRequest.ArgType.String);
|
||||
xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
|
||||
XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "change_password");
|
||||
xmlRpcRequest.setListener(new XmlRpcRequestListener() {
|
||||
@Override
|
||||
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||
public void onResponse(XmlRpcRequest request) {
|
||||
String result = request.getStringResponse();
|
||||
if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
|
||||
if (request.getStatus() == XmlRpcRequest.Status.Ok) {
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
|
@ -261,7 +261,7 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
listener.onAccountPasswordChanged(result);
|
||||
} else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
|
||||
} else if (request.getStatus() == XmlRpcRequest.Status.Failed) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
}
|
||||
|
@ -274,12 +274,12 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
public void changeAccountHashPasswordAsync(final XmlRpcListener listener, String username, String oldPassword, String newPassword) {
|
||||
LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("change_hash", LinphoneXmlRpcRequest.ArgType.String);
|
||||
xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
|
||||
XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "change_hash");
|
||||
xmlRpcRequest.setListener(new XmlRpcRequestListener() {
|
||||
@Override
|
||||
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||
public void onResponse(XmlRpcRequest request) {
|
||||
String result = request.getStringResponse();
|
||||
if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
|
||||
if (request.getStatus() == XmlRpcRequest.Status.Ok) {
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
|
@ -287,7 +287,7 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
listener.onAccountPasswordChanged(result);
|
||||
} else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
|
||||
} else if (request.getStatus() == XmlRpcRequest.Status.Failed) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
}
|
||||
|
@ -300,12 +300,12 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
public void sendRecoverPasswordLinkByEmailAsync(final XmlRpcListener listener, String usernameOrEmail) {
|
||||
LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("send_reset_account_password_email", LinphoneXmlRpcRequest.ArgType.String);
|
||||
xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
|
||||
XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "send_reset_account_password_email");
|
||||
xmlRpcRequest.setListener(new XmlRpcRequestListener() {
|
||||
@Override
|
||||
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||
public void onResponse(XmlRpcRequest request) {
|
||||
String result = request.getStringResponse();
|
||||
if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
|
||||
if (request.getStatus() == XmlRpcRequest.Status.Ok) {
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
|
@ -313,7 +313,7 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
listener.onRecoverPasswordLinkSent(result);
|
||||
} else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
|
||||
} else if (request.getStatus() == XmlRpcRequest.Status.Failed) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
}
|
||||
|
@ -324,12 +324,12 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
public void sendActivateAccountLinkByEmailAsync(final XmlRpcListener listener, String usernameOrEmail) {
|
||||
LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("resend_activation_email", LinphoneXmlRpcRequest.ArgType.String);
|
||||
xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
|
||||
XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "resend_activation_email");
|
||||
xmlRpcRequest.setListener(new XmlRpcRequestListener() {
|
||||
@Override
|
||||
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||
public void onResponse(XmlRpcRequest request) {
|
||||
String result = request.getStringResponse();
|
||||
if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
|
||||
if (request.getStatus() == XmlRpcRequest.Status.Ok) {
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
|
@ -337,7 +337,7 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
listener.onActivateAccountLinkSent(result);
|
||||
} else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
|
||||
} else if (request.getStatus() == XmlRpcRequest.Status.Failed) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
}
|
||||
|
@ -348,12 +348,12 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
public void sendUsernameByEmailAsync(final XmlRpcListener listener, String email) {
|
||||
LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("recover_username_from_email", LinphoneXmlRpcRequest.ArgType.String);
|
||||
xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
|
||||
XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "recover_username_from_email");
|
||||
xmlRpcRequest.setListener(new XmlRpcRequestListener() {
|
||||
@Override
|
||||
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||
public void onResponse(XmlRpcRequest request) {
|
||||
String result = request.getStringResponse();
|
||||
if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
|
||||
if (request.getStatus() == XmlRpcRequest.Status.Ok) {
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
|
@ -361,7 +361,7 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
listener.onUsernameSent(result);
|
||||
} else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
|
||||
} else if (request.getStatus() == XmlRpcRequest.Status.Failed) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
}
|
||||
|
@ -372,12 +372,12 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
public void verifySignatureAsync(final XmlRpcListener listener, String payload, String signature) {
|
||||
LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("check_payload_signature", LinphoneXmlRpcRequest.ArgType.String);
|
||||
xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
|
||||
XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "check_payload_signature");
|
||||
xmlRpcRequest.setListener(new XmlRpcRequestListener() {
|
||||
@Override
|
||||
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||
public void onResponse(XmlRpcRequest request) {
|
||||
String result = request.getStringResponse();
|
||||
if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
|
||||
if (request.getStatus() == XmlRpcRequest.Status.Ok) {
|
||||
Log.w(result);
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
|
@ -386,7 +386,7 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
listener.onSignatureVerified("OK".equals(result));
|
||||
} else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
|
||||
} else if (request.getStatus() == XmlRpcRequest.Status.Failed) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
}
|
||||
|
@ -398,12 +398,12 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
public void getRemoteProvisioningFilenameAsync(final XmlRpcListener listener,String username, String domain, String password) {
|
||||
LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("get_remote_provisioning_filename", LinphoneXmlRpcRequest.ArgType.String);
|
||||
xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
|
||||
XmlRpcRequest xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.String, "get_remote_provisioning_filename");
|
||||
xmlRpcRequest.setListener(new XmlRpcRequestListener() {
|
||||
@Override
|
||||
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||
public void onResponse(XmlRpcRequest request) {
|
||||
String result = request.getStringResponse();
|
||||
if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
|
||||
if (request.getStatus() == XmlRpcRequest.Status.Ok) {
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
|
@ -411,7 +411,7 @@ public class XmlRpcHelper {
|
|||
}
|
||||
|
||||
listener.onRemoteProvisioningFilenameSent(result);
|
||||
} else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
|
||||
} else if (request.getStatus() == XmlRpcRequest.Status.Failed) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e10297ba6df500b3154f539b11e4c44ded4a227a
|
||||
Subproject commit 2a9d4afef2530dac32a07dd60180ef3f929e39b1
|
|
@ -19,11 +19,11 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import org.linphone.core.tutorials.TutorialNotifier;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.linphone.core.tutorials.TutorialNotifier;
|
||||
|
||||
/**
|
||||
* Write notifications to a TextView widget.
|
||||
* This is an helper class, not a test activity.
|
|
@ -18,12 +18,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
package org.linphone.tutorials;
|
||||
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.tutorials.TutorialBuddyStatus;
|
||||
import org.linphone.core.tutorials.TutorialNotifier;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
|
@ -31,6 +25,12 @@ import android.view.View;
|
|||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.tutorials.TutorialBuddyStatus;
|
||||
import org.linphone.core.tutorials.TutorialNotifier;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
/**
|
||||
* Activity for displaying and starting the BuddyStatus example on Android phone.
|
||||
*
|
||||
|
@ -104,7 +104,7 @@ public class TutorialBuddyStatusActivity extends Activity {
|
|||
buttonCall.setEnabled(true);
|
||||
}
|
||||
});
|
||||
} catch (LinphoneCoreException e) {
|
||||
} catch (CoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
}
|
|
@ -19,40 +19,6 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import org.linphone.R;
|
||||
import org.linphone.UIThreadDispatcher;
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneAuthInfo;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCallStats;
|
||||
import org.linphone.core.LinphoneChatMessage;
|
||||
import org.linphone.core.LinphoneChatRoom;
|
||||
import org.linphone.core.LinphoneContent;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCore.AuthMethod;
|
||||
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
||||
import org.linphone.core.LinphoneCore.GlobalState;
|
||||
import org.linphone.core.LinphoneCore.LogCollectionUploadState;
|
||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
import org.linphone.core.LinphoneCore.RemoteProvisioningState;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneCoreListener;
|
||||
import org.linphone.core.LinphoneEvent;
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
import org.linphone.core.LinphoneFriendList;
|
||||
import org.linphone.core.LinphoneFriendList.LinphoneFriendListListener;
|
||||
import org.linphone.core.LinphoneInfoMessage;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.PublishState;
|
||||
import org.linphone.core.SubscriptionState;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
@ -61,15 +27,49 @@ import android.widget.Button;
|
|||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class TutorialCardDavSync extends Activity implements OnClickListener, LinphoneCoreListener, LinphoneFriendListListener {
|
||||
import org.linphone.R;
|
||||
import org.linphone.UIThreadDispatcher;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.AuthInfo;
|
||||
import org.linphone.core.Call;
|
||||
import org.linphone.core.Call.State;
|
||||
import org.linphone.core.CallStats;
|
||||
import org.linphone.core.ChatMessage;
|
||||
import org.linphone.core.ChatRoom;
|
||||
import org.linphone.core.Content;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Core.AuthMethod;
|
||||
import org.linphone.core.Core.ConfiguringState;
|
||||
import org.linphone.core.Core.EcCalibratorStatus;
|
||||
import org.linphone.core.Core.GlobalState;
|
||||
import org.linphone.core.Core.LogCollectionUploadState;
|
||||
import org.linphone.core.Core.RegistrationState;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.CoreListener;
|
||||
import org.linphone.core.Event;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.Friend;
|
||||
import org.linphone.core.FriendList;
|
||||
import org.linphone.core.FriendList.FriendListListener;
|
||||
import org.linphone.core.InfoMessage;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
import org.linphone.core.PublishState;
|
||||
import org.linphone.core.SubscriptionState;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class TutorialCardDavSync extends Activity implements OnClickListener, CoreListener, FriendListListener {
|
||||
private EditText username, password, ha1, server;
|
||||
private Button synchronize;
|
||||
private TextView logs;
|
||||
|
||||
private Timer timer;
|
||||
|
||||
private LinphoneCore lc;
|
||||
private LinphoneFriendList lfl;
|
||||
private Core lc;
|
||||
private FriendList lfl;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -85,9 +85,9 @@ public class TutorialCardDavSync extends Activity implements OnClickListener, Li
|
|||
synchronize = (Button) findViewById(R.id.carddav_synchronize);
|
||||
synchronize.setOnClickListener(this);
|
||||
|
||||
LinphoneCoreFactory.instance().setDebugMode(true, "CardDAV sync tutorial");
|
||||
Factory.instance().setDebugMode(true, "CardDAV sync tutorial");
|
||||
try {
|
||||
lc = LinphoneCoreFactory.instance().createLinphoneCore(this, this);
|
||||
lc = Factory.instance().createCore(this, this);
|
||||
TimerTask lTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -104,13 +104,13 @@ public class TutorialCardDavSync extends Activity implements OnClickListener, Li
|
|||
timer = new Timer("Linphone scheduler");
|
||||
timer.schedule(lTask, 0, 20);
|
||||
|
||||
lfl = lc.createLinphoneFriendList();
|
||||
lfl = lc.createFriendList();
|
||||
lc.addFriendList(lfl);
|
||||
|
||||
LinphoneFriend lf = lc.createFriendWithAddress("sip:ghislain@sip.linphone.org");
|
||||
Friend lf = lc.createFriendWithAddress("sip:ghislain@sip.linphone.org");
|
||||
lf.setName("Ghislain");
|
||||
lfl.addLocalFriend(lf); // This is a local friend, it won't be sent to the CardDAV server and will be removed at the next synchronization
|
||||
} catch (LinphoneCoreException e) {
|
||||
} catch (CoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public class TutorialCardDavSync extends Activity implements OnClickListener, Li
|
|||
protected void onDestroy() {
|
||||
try {
|
||||
lc.removeFriendList(lfl);
|
||||
} catch (LinphoneCoreException e) {
|
||||
} catch (CoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
timer.cancel();
|
||||
|
@ -131,7 +131,7 @@ public class TutorialCardDavSync extends Activity implements OnClickListener, Li
|
|||
public void onClick(View v) {
|
||||
String serverUrl = server.getText().toString();
|
||||
String serverDomain = serverUrl.replace("http://", "").replace("https://", "").split("/")[0]; // We just want the domain name
|
||||
LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(username.getText().toString(), null, password.getText().toString(), ha1.getText().toString(), "SabreDAV", serverDomain);
|
||||
AuthInfo authInfo = Factory.instance().createAuthInfo(username.getText().toString(), null, password.getText().toString(), ha1.getText().toString(), "SabreDAV", serverDomain);
|
||||
lc.addAuthInfo(authInfo);
|
||||
|
||||
lfl.setUri(serverUrl);
|
||||
|
@ -146,273 +146,273 @@ public class TutorialCardDavSync extends Activity implements OnClickListener, Li
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onLinphoneFriendCreated(LinphoneFriendList list,
|
||||
LinphoneFriend lf) {
|
||||
public void onContactCreated(FriendList list,
|
||||
Friend lf) {
|
||||
// TODO Auto-generated method stub
|
||||
String msg = "Friend created " + lf.getAddress();
|
||||
myLog(msg);
|
||||
|
||||
LinphoneFriend[] friends = list.getFriendList();
|
||||
Friend[] friends = list.getFriendsLists();
|
||||
String msg2 = "There are " + friends.length + (friends.length > 1 ? " friends" : " friend") + " in the list";
|
||||
myLog(msg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLinphoneFriendUpdated(LinphoneFriendList list,
|
||||
LinphoneFriend newFriend, LinphoneFriend oldFriend) {
|
||||
public void onContactUpdated(FriendList list,
|
||||
Friend newFriend, Friend oldFriend) {
|
||||
// TODO Auto-generated method stub
|
||||
String msg = "Friend updated " + newFriend.getAddress();
|
||||
myLog(msg);
|
||||
|
||||
LinphoneFriend[] friends = list.getFriendList();
|
||||
Friend[] friends = list.getFriendsLists();
|
||||
String msg2 = "There are " + friends.length + (friends.length > 1 ? " friends" : " friend") + " in the list";
|
||||
myLog(msg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLinphoneFriendDeleted(LinphoneFriendList list,
|
||||
LinphoneFriend lf) {
|
||||
public void onContactDeleted(FriendList list,
|
||||
Friend lf) {
|
||||
// TODO Auto-generated method stub
|
||||
String msg = "Friend removed " + lf.getAddress();
|
||||
myLog(msg);
|
||||
|
||||
LinphoneFriend[] friends = list.getFriendList();
|
||||
Friend[] friends = list.getFriendsLists();
|
||||
String msg2 = "There are " + friends.length + (friends.length > 1 ? " friends" : " friend") + " in the list";
|
||||
myLog(msg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLinphoneFriendSyncStatusChanged(LinphoneFriendList list, LinphoneFriendList.State status, String message) {
|
||||
public void onSyncStatusChanged(FriendList list, FriendList.State status, String message) {
|
||||
// TODO Auto-generated method stub
|
||||
String msg = "Sync status changed: " + status.toString() + " (" + message + ")";
|
||||
myLog(msg);
|
||||
if (status != LinphoneFriendList.State.SyncStarted) {
|
||||
if (status != FriendList.State.SyncStarted) {
|
||||
synchronize.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void friendListCreated(LinphoneCore lc, LinphoneFriendList list) {
|
||||
public void onFriendListCreated(Core lc, FriendList list) {
|
||||
// TODO Auto-generated method stub
|
||||
String msg = "Friend List added";
|
||||
myLog(msg);
|
||||
|
||||
LinphoneFriendList[] lists = lc.getFriendLists();
|
||||
FriendList[] lists = lc.getFriendsLists();
|
||||
String msg2 = "There are " + lists.length + (lists.length > 1 ? " lists" : " list") + " in the core";
|
||||
myLog(msg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void friendListRemoved(LinphoneCore lc, LinphoneFriendList list) {
|
||||
public void onFriendListRemoved(Core lc, FriendList list) {
|
||||
// TODO Auto-generated method stub
|
||||
String msg = "Friend List removed";
|
||||
myLog(msg);
|
||||
|
||||
LinphoneFriendList[] lists = lc.getFriendLists();
|
||||
FriendList[] lists = lc.getFriendsLists();
|
||||
String msg2 = "There are " + lists.length + (lists.length > 1 ? " lists" : " list") + " in the core";
|
||||
myLog(msg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkReachableChanged(LinphoneCore lc, boolean enable) {
|
||||
public void onNetworkReachable(Core lc, boolean enable) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callStatsUpdated(LinphoneCore lc, LinphoneCall call,
|
||||
LinphoneCallStats stats) {
|
||||
public void onCallStatsUpdated(Core lc, Call call,
|
||||
CallStats stats) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf,
|
||||
public void onNewSubscriptionRequested(Core lc, Friend lf,
|
||||
String url) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {
|
||||
public void onNotifyPresenceReceived(Core lc, Friend lf) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) {
|
||||
public void onDtmfReceived(Core lc, Call call, int dtmf) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyReceived(LinphoneCore lc, LinphoneCall call,
|
||||
LinphoneAddress from, byte[] event) {
|
||||
public void removed(Core lc, Call call,
|
||||
Address from, byte[] event) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferState(LinphoneCore lc, LinphoneCall call,
|
||||
public void onTransferStateChanged(Core lc, Call call,
|
||||
State new_call_state) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void infoReceived(LinphoneCore lc, LinphoneCall call,
|
||||
LinphoneInfoMessage info) {
|
||||
public void onInfoReceived(Core lc, Call call,
|
||||
InfoMessage info) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev,
|
||||
public void onSubscriptionStateChanged(Core lc, Event ev,
|
||||
SubscriptionState state) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publishStateChanged(LinphoneCore lc, LinphoneEvent ev,
|
||||
public void onPublishStateChanged(Core lc, Event ev,
|
||||
PublishState state) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(LinphoneCore lc) {
|
||||
public void removed( lc) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayStatus(LinphoneCore lc, String message) {
|
||||
public void removed(Core lc, String message) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayMessage(LinphoneCore lc, String message) {
|
||||
public void removed(Core lc, String message) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayWarning(LinphoneCore lc, String message) {
|
||||
public void removed(Core lc, String message) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileTransferProgressIndication(LinphoneCore lc,
|
||||
LinphoneChatMessage message, LinphoneContent content, int progress) {
|
||||
public void removed(Core lc,
|
||||
ChatMessage message, Content content, int progress) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileTransferRecv(LinphoneCore lc, LinphoneChatMessage message,
|
||||
LinphoneContent content, byte[] buffer, int size) {
|
||||
public void removed(Core lc, ChatMessage message,
|
||||
Content content, byte[] buffer, int size) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fileTransferSend(LinphoneCore lc, LinphoneChatMessage message,
|
||||
LinphoneContent content, ByteBuffer buffer, int size) {
|
||||
public int removed(Core lc, ChatMessage message,
|
||||
Content content, ByteBuffer buffer, int size) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void globalState(LinphoneCore lc, GlobalState state, String message) {
|
||||
public void onGlobalStateChanged(Core lc, GlobalState state, String message) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg,
|
||||
public void onRegistrationStateChanged(Core lc, ProxyConfig cfg,
|
||||
RegistrationState state, String smessage) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configuringStatus(LinphoneCore lc,
|
||||
RemoteProvisioningState state, String message) {
|
||||
public void onConfiguringStatus(Core lc,
|
||||
ConfiguringState state, String message) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr,
|
||||
LinphoneChatMessage message) {
|
||||
public void onMessageReceived(Core lc, ChatRoom cr,
|
||||
ChatMessage message) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageReceivedUnableToDecrypted(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
|
||||
public void removed(Core lc, ChatRoom cr, ChatMessage message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callState(LinphoneCore lc, LinphoneCall call, State state,
|
||||
public void onCallStateChanged(Core lc, Call call, State state,
|
||||
String message) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,
|
||||
public void onCallEncryptionChanged(Core lc, Call call,
|
||||
boolean encrypted, String authenticationToken) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyReceived(LinphoneCore lc, LinphoneEvent ev,
|
||||
String eventName, LinphoneContent content) {
|
||||
public void onNotifyReceived(Core lc, Event ev,
|
||||
String eventName, Content content) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void isComposingReceived(LinphoneCore lc, LinphoneChatRoom cr) {
|
||||
public void onIsComposingReceived(Core lc, ChatRoom cr) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,
|
||||
public void onEcCalibrationResult(Core lc, EcCalibratorStatus status,
|
||||
int delay_ms, Object data) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgressIndication(LinphoneCore lc, int offset, int total) {
|
||||
public void onLogCollectionUploadProgressIndication(Core lc, int offset, int total) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadStateChanged(LinphoneCore lc,
|
||||
public void onLogCollectionUploadStateChanged(Core lc,
|
||||
LogCollectionUploadState state, String info) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void authInfoRequested(LinphoneCore lc, String realm,
|
||||
public void removed(Core lc, String realm,
|
||||
String username, String domain) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void authenticationRequested(LinphoneCore lc,
|
||||
LinphoneAuthInfo authInfo, AuthMethod method) {
|
||||
public void onAuthenticationRequested(Core lc,
|
||||
AuthInfo authInfo, AuthMethod method) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
|
@ -19,12 +19,6 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.tutorials.TutorialChatRoom;
|
||||
import org.linphone.core.tutorials.TutorialNotifier;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
|
@ -32,6 +26,12 @@ import android.view.View;
|
|||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.tutorials.TutorialChatRoom;
|
||||
import org.linphone.core.tutorials.TutorialNotifier;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
/**
|
||||
* Activity for displaying and starting the chatroom example on Android phone.
|
||||
*
|
||||
|
@ -92,7 +92,7 @@ public class TutorialChatRoomActivity extends Activity {
|
|||
buttonCall.setEnabled(true);
|
||||
}
|
||||
});
|
||||
} catch (LinphoneCoreException e) {
|
||||
} catch (CoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
}
|
|
@ -18,12 +18,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
package org.linphone.tutorials;
|
||||
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.tutorials.TutorialHelloWorld;
|
||||
import org.linphone.core.tutorials.TutorialNotifier;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
|
@ -31,6 +25,12 @@ import android.view.View;
|
|||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.tutorials.TutorialHelloWorld;
|
||||
import org.linphone.core.tutorials.TutorialNotifier;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
/**
|
||||
* Activity for displaying and starting the HelloWorld example on Android phone.
|
||||
*
|
||||
|
@ -93,7 +93,7 @@ public class TutorialHelloWorldActivity extends Activity {
|
|||
buttonCall.setEnabled(true);
|
||||
}
|
||||
});
|
||||
} catch (LinphoneCoreException e) {
|
||||
} catch (CoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
}
|
|
@ -18,13 +18,13 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import org.linphone.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import org.linphone.R;
|
||||
|
||||
public class TutorialLauncherActivity extends Activity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
|
@ -19,18 +19,18 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.tutorials.TutorialNotifier;
|
||||
import org.linphone.core.tutorials.TutorialRegistration;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.tutorials.TutorialNotifier;
|
||||
import org.linphone.core.tutorials.TutorialRegistration;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
/**
|
||||
* Activity for displaying and starting the registration example on Android phone.
|
||||
*
|
||||
|
@ -96,7 +96,7 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity {
|
|||
tutorial.launchTutorial(
|
||||
sipAddressWidget.getText().toString(),
|
||||
sipPasswordWidget.getText().toString());
|
||||
} catch (LinphoneCoreException e) {
|
||||
} catch (CoreException e) {
|
||||
Log.e(e);
|
||||
outputText.setText(e.getMessage() +"\n"+outputText.getText());
|
||||
}
|
Loading…
Reference in a new issue