Remove call to impl classes

This commit is contained in:
Margaux Clerc 2015-02-10 18:18:21 +01:00
parent 7c18d1d7ad
commit c656a35aef
4 changed files with 23 additions and 25 deletions

View file

@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone;
import org.linphone.core.LinphoneCoreFactoryImpl;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LpConfig;
import android.content.BroadcastReceiver;
@ -31,7 +31,7 @@ public class BootReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
String path = context.getFilesDir().getAbsolutePath() + "/.linphonerc";
LpConfig lpConfig = LinphoneCoreFactoryImpl.instance().createLpConfig(path);
LpConfig lpConfig = LinphoneCoreFactory.instance().createLpConfig(path);
if (lpConfig.getBool("app", "auto_start", false)) {
Intent lLinphoneServiceIntent = new Intent(Intent.ACTION_MAIN);
lLinphoneServiceIntent.setClass(context, LinphoneService.class);

View file

@ -38,6 +38,7 @@ 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.LogCollectionUploadState;
import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
@ -215,6 +216,11 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
displayMissedCalls(missedCalls);
}
};
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.addListener(mListener);
}
int missedCalls = LinphoneManager.getLc().getMissedCallsCount();
displayMissedCalls(missedCalls);
@ -1210,11 +1216,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
@Override
protected void onPause() {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.removeListener(mListener);
}
getIntent().putExtra("PreviousActivity", 0);
super.onPause();
}
@ -1226,11 +1227,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
if (!LinphoneService.isReady()) {
startService(new Intent(ACTION_MAIN).setClass(this, LinphoneService.class));
}
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.addListener(mListener);
}
prepareContactsInBackground();
@ -1264,6 +1260,11 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
mOrientationHelper.disable();
mOrientationHelper = null;
}
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.removeListener(mListener);
}
instance = null;
super.onDestroy();
@ -1407,7 +1408,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
return view;
}
}
}
interface ContactPicked {

View file

@ -51,7 +51,6 @@ 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.LinphoneCoreFactoryImpl;
import org.linphone.core.LinphoneCoreListener;
import org.linphone.core.LinphoneEvent;
import org.linphone.core.LinphoneFriend;
@ -227,7 +226,7 @@ public class LinphoneManager implements LinphoneCoreListener {
if (isInstanciated() && lc != null && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.Online) {
lc.getPresenceModel().getActivity().setType(PresenceActivityType.Online);
} else if (isInstanciated() && lc != null && !isPresenceModelActivitySet()) {
PresenceModel model = LinphoneCoreFactoryImpl.instance().createPresenceModel(PresenceActivityType.Online, null);
PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.Online, null);
lc.setPresenceModel(model);
}
}
@ -237,7 +236,7 @@ public class LinphoneManager implements LinphoneCoreListener {
if (isInstanciated() && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.OnThePhone) {
lc.getPresenceModel().getActivity().setType(PresenceActivityType.OnThePhone);
} else if (isInstanciated() && !isPresenceModelActivitySet()) {
PresenceModel model = LinphoneCoreFactoryImpl.instance().createPresenceModel(PresenceActivityType.OnThePhone, null);
PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.OnThePhone, null);
lc.setPresenceModel(model);
}
}
@ -247,7 +246,7 @@ public class LinphoneManager implements LinphoneCoreListener {
if (isInstanciated() && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.Offline) {
lc.getPresenceModel().getActivity().setType(PresenceActivityType.Offline);
} else if (isInstanciated() && !isPresenceModelActivitySet()) {
PresenceModel model = LinphoneCoreFactoryImpl.instance().createPresenceModel(PresenceActivityType.Offline, null);
PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.Offline, null);
lc.setPresenceModel(model);
}
}

View file

@ -29,8 +29,7 @@ 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.LinphoneCoreFactoryImpl;
import org.linphone.core.LinphoneCoreImpl;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListenerBase;
import org.linphone.core.LinphoneProxyConfig;
import org.linphone.mediastream.Log;
@ -137,9 +136,10 @@ public final class LinphoneService extends Service {
mNotificationTitle = getString(R.string.service_name);
// Needed in order for the two next calls to succeed, libraries must have been loaded first
LinphoneCoreFactoryImpl.instance();
LinphoneCoreImpl.setLogCollectionPath(getFilesDir().getAbsolutePath());
LinphoneCoreImpl.enableLogCollection(!(getResources().getBoolean(R.bool.disable_every_log)));
LinphoneCoreFactory.instance();
Log.w(getFilesDir().getAbsolutePath());
LinphoneCoreFactory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath());
LinphoneCoreFactory.instance().enableLogCollection(!(getResources().getBoolean(R.bool.disable_every_log)));
// Dump some debugging information to the logs
Log.i(START_LINPHONE_LOGS);
@ -167,7 +167,6 @@ public final class LinphoneService extends Service {
startWifiLock();
}
instance = this; // instance is ready once linphone manager has been created
LinphoneManager.getLc().addListener(mListener = new LinphoneCoreListenerBase(){
@Override
@ -322,7 +321,7 @@ public final class LinphoneService extends Service {
String userName = call.getRemoteAddress().getUserName();
String domain = call.getRemoteAddress().getDomain();
String displayName = call.getRemoteAddress().getDisplayName();
LinphoneAddress address = LinphoneCoreFactoryImpl.instance().createLinphoneAddress(userName,domain,null);
LinphoneAddress address = LinphoneCoreFactory.instance().createLinphoneAddress(userName,domain,null);
address.setDisplayName(displayName);
Uri pictureUri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(address, getContentResolver());
@ -402,7 +401,7 @@ public final class LinphoneService extends Service {
Uri pictureUri;
try {
pictureUri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(LinphoneCoreFactoryImpl.instance().createLinphoneAddress(fromSipUri), getContentResolver());
pictureUri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(LinphoneCoreFactory.instance().createLinphoneAddress(fromSipUri), getContentResolver());
} catch (LinphoneCoreException e1) {
Log.e("Cannot parse from address",e1);
pictureUri=null;