diff --git a/prepare.py b/prepare.py
index ca01b80b9..bfa80dddb 100755
--- a/prepare.py
+++ b/prepare.py
@@ -301,10 +301,8 @@ uninstall:
\tadb uninstall $(PACKAGE_NAME)
release: java-clean build copy-libs update-project
-\tpatch -p1 < release.patch
\tcat ant.properties | grep version.name > default.properties
\tant release
-\tpatch -Rp1 < release.patch
generate-sdk: liblinphone-android-sdk
diff --git a/res/layout/assistant_account_creation_code_activation.xml b/res/layout/assistant_account_creation_code_activation.xml
index d9b84b292..5337f8d29 100644
--- a/res/layout/assistant_account_creation_code_activation.xml
+++ b/res/layout/assistant_account_creation_code_activation.xml
@@ -26,6 +26,22 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
+
+
+
+
+
+
+
+
-
-
-
-
-
+
-
-
-
-
+
\ No newline at end of file
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index 202a0eb1c..3a797a69f 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -52,8 +52,8 @@
Créer un compte
Associer un compte
Terminer la configuration
- Votre compte a été créé. Vérifiez vos emails pour valider votre compte.
-Lorsque cela est fait, cliquez sur le bouton pour continuer.
+ Votre compte a été créé. Vérifiez vos emails pour valider votre compte:
+ Lorsque cela est fait, cliquez sur le bouton pour continuer.
Cet assistant va vous guider pour réaliser des appels à l\'aide d\'un compte SIP.
Entrez le nom d\'utilisateur et mot de passe de votre compte Linphone.
Entrer votre nom d\'utilisateur et mot de passe ainsi que votre domaine SIP
@@ -64,7 +64,8 @@ Lorsque cela est fait, cliquez sur le bouton pour continuer.
Utiliser un compte SIP
Télécharger la configuration
Merci de confirmer votre code de pays et de rentrer votre numéro de téléphone
- Nous vous avons envoyé un SMS avec un code de validation.\n\nPour complèter la vérification de votre numéro de téléphone, veuillez entrer les 4 chiffres du code en dessous:\n
+ Nous vous avons envoyé un SMS avec un code de validation au numéro :
+ Pour complèter la vérification de votre numéro de téléphone, veuillez entrer les 4 chiffres du code en dessous:\n
Nom d\'affichage (optionnel)
Utiliser un compte Linphone
Utiliser un compte SIP
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1df955d4f..7afce82a3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -69,7 +69,8 @@
Continue
Activate your account
Finish configuration
- Your account is created. Please check your mails to validate your account. Once it is done, come back here and click on the button.
+ Your account is created. Please check your mails to validate your account:
+ Once it is done, come back here and click on the button.
This assistant will help you configure and use your SIP account.
Please enter your username and password of Linphone account
Please enter your username and password with your SIP domain
@@ -80,7 +81,8 @@
Use SIP account
Fetch remote configuration
Please confirm your country code and enter your phone number
- We have sent you a SMS with a validation code.\n\nTo complete your phone number verification, please enter the 4 digit code below:\n
+ We have sent you a SMS with a validation code to your phone number:
+ To complete your phone number verification, please enter the 4 digit code below:\n
Please enter an username, email and password for your Linphone account
Display name (optional)
Use your Linphone account
diff --git a/src/org/linphone/AccountPreferencesFragment.java b/src/org/linphone/AccountPreferencesFragment.java
index d4ede4641..3561ca32b 100644
--- a/src/org/linphone/AccountPreferencesFragment.java
+++ b/src/org/linphone/AccountPreferencesFragment.java
@@ -184,7 +184,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment {
String value = newValue.toString();
preference.setSummary(value);
if (isNewAccount) {
- //TODO accpunt builder ste prefix
+ builder.setPrefix(value);
} else {
mPrefs.setPrefix(n, value);
}
@@ -357,7 +357,6 @@ public class AccountPreferencesFragment extends PreferencesListFragment {
if(!isNewAccount){
String prefixValue = mPrefs.getPrefix(n);
prefix.setText(prefixValue);
- prefix.setOnPreferenceChangeListener(prefixChangedListener);
}
CheckBoxPreference avpf = (CheckBoxPreference) advanced.getPreference(5);
diff --git a/src/org/linphone/ContactsListFragment.java b/src/org/linphone/ContactsListFragment.java
index 235f8de9f..3f605f3f1 100644
--- a/src/org/linphone/ContactsListFragment.java
+++ b/src/org/linphone/ContactsListFragment.java
@@ -568,7 +568,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
holder.delete.setChecked(false);
}
} else {
- holder.delete.setVisibility(View.GONE);
+ holder.delete.setVisibility(View.INVISIBLE);
}
/*LinphoneFriend[] friends = LinphoneManager.getLc().getFriendList();
diff --git a/src/org/linphone/ContactsManager.java b/src/org/linphone/ContactsManager.java
index 1f2746306..3032870c8 100644
--- a/src/org/linphone/ContactsManager.java
+++ b/src/org/linphone/ContactsManager.java
@@ -211,6 +211,7 @@ public class ContactsManager extends ContentObserver {
for (LinphoneNumberOrAddress noa: c.getNumbersOrAddresses()) {
String normalized = null;
if (lpc != null) {
+ lpc.setDialPrefix("");
normalized = lpc.normalizePhoneNumber(noa.getValue());
}
String alias = c.getPresenceModelForUri(noa.getValue());
diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java
index b388bcecc..1d51a32c1 100644
--- a/src/org/linphone/LinphoneActivity.java
+++ b/src/org/linphone/LinphoneActivity.java
@@ -32,7 +32,6 @@ import org.linphone.assistant.AssistantActivity;
import org.linphone.assistant.RemoteProvisioningLoginActivity;
import org.linphone.compatibility.Compatibility;
import org.linphone.core.CallDirection;
-import org.linphone.core.LinphoneAccountCreator;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneAuthInfo;
import org.linphone.core.LinphoneCall;
@@ -98,7 +97,7 @@ import android.widget.Toast;
/**
* @author Sylvain Berfini
*/
-public class LinphoneActivity extends Activity implements OnClickListener, ContactPicked, ActivityCompat.OnRequestPermissionsResultCallback, LinphoneAccountCreator.LinphoneAccountCreatorListener {
+public class LinphoneActivity extends Activity implements OnClickListener, ContactPicked, ActivityCompat.OnRequestPermissionsResultCallback {
public static final String PREF_FIRST_LAUNCH = "pref_first_launch";
private static final int SETTINGS_ACTIVITY = 123;
private static final int CALL_ACTIVITY = 19;
@@ -230,7 +229,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
if(state.equals(RegistrationState.RegistrationOk) && LinphonePreferences.instance().getLinkPopupTime() != ""){
if(getResources().getBoolean(R.bool.use_phone_number_validation)) {
if (LinphonePreferences.instance().getLinkPopupTime() == null || (LinphonePreferences.instance().getLinkPopupTime() != null)){
- isAccountWithAlias();
+ LinphoneManager.getInstance().isAccountWithAlias();
}
}
}
@@ -625,14 +624,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
startActivity(new Intent(LinphoneActivity.this, AssistantActivity.class));
}
- public void displayLinkPhoneNumber() {
- LinphoneAccountCreator accountCreator;
- accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl());
- accountCreator.setDomain(getResources().getString(R.string.default_domain));
- accountCreator.setListener(this);
- accountCreator.setUsername(LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex()));
- accountCreator.isAccountLinked();
- }
+
public void displayInapp() {
startActivity(new Intent(LinphoneActivity.this, InAppPurchaseActivity.class));
@@ -1705,19 +1697,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
}
- private void isAccountWithAlias(){
- if(LinphoneManager.getLc().getDefaultProxyConfig() != null) {
- LinphoneAccountCreator accountCreator;
- accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl());
- accountCreator.setDomain(getResources().getString(R.string.default_domain));
- accountCreator.setListener(this);
- accountCreator.setUsername(LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex()));
- accountCreator.isAccountUsed();
- } else {
- LinphonePreferences.instance().setLinkPopupTime(null);
- }
- }
-
//Inapp Purchase
private void isTrialAccount() {
if(LinphoneManager.getLc().getDefaultProxyConfig() != null && LinphonePreferences.instance().getInappPopupTime() != null) {
@@ -1793,75 +1772,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
return -1;
}
-
- private void askLinkWithPhoneNumber(){
- long now = Calendar.getInstance().getTimeInMillis();
- long newDate = now + (getResources().getInteger(R.integer.popup_time_interval)*60);
- if (LinphonePreferences.instance().getLinkPopupTime() != null && Long.parseLong(LinphonePreferences.instance().getLinkPopupTime()) > now) {
- return;
- } else {
- LinphonePreferences.instance().setLinkPopupTime(String.valueOf(newDate));
- }
- final Dialog dialog = displayDialog(String.format(getResources().getString(R.string.link_account_popup), LinphoneManager.getLc().getDefaultProxyConfig().getAddress().asStringUriOnly()));
- Button delete = (Button) dialog.findViewById(R.id.delete_button);
- delete.setText(getResources().getString(R.string.link));
- Button cancel = (Button) dialog.findViewById(R.id.cancel);
- cancel.setText(getResources().getString(R.string.maybe_later));
-
- delete.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View view) {
- displayLinkPhoneNumber();
- dialog.dismiss();
- }
- });
-
- LinphonePreferences.instance().setLinkPopupTime(String.valueOf(newDate));
-
- cancel.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View view) {
- dialog.dismiss();
- }
- });
- dialog.show();
- }
-
- @Override
- public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
- if (status.equals(LinphoneAccountCreator.Status.AccountExist)) {
- accountCreator.isAccountLinked();
- }
- }
-
- @Override
- public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
-
- @Override
- public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
-
- @Override
- public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
-
- @Override
- public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
-
- @Override
- public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
-
- @Override
- public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
-
- @Override
- public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
- if (status.equals(LinphoneAccountCreator.Status.AccountNotLinked)) {
- askLinkWithPhoneNumber();
- }
- }
-
- @Override
- public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
- }
}
interface ContactPicked {
diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java
index 615f4c517..a03724d24 100644
--- a/src/org/linphone/LinphoneManager.java
+++ b/src/org/linphone/LinphoneManager.java
@@ -30,11 +30,13 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
+import java.util.Calendar;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import org.linphone.core.CallDirection;
+import org.linphone.core.LinphoneAccountCreator;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneBuffer;
import org.linphone.core.LinphoneCall;
@@ -77,6 +79,7 @@ import org.linphone.tools.OpenH264DownloadHelper;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.AlertDialog;
+import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
@@ -99,6 +102,8 @@ import android.preference.CheckBoxPreference;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.telephony.TelephonyManager;
+import android.view.View;
+import android.widget.Button;
import android.widget.Toast;
/**
@@ -116,7 +121,7 @@ import android.widget.Toast;
* @author Guillaume Beraudo
*
*/
-public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessage.LinphoneChatMessageListener {
+public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessage.LinphoneChatMessageListener, LinphoneAccountCreator.LinphoneAccountCreatorListener {
private static LinphoneManager instance;
private Context mServiceContext;
@@ -138,6 +143,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
private IntentFilter mKeepAliveIntentFilter;
private Handler mHandler = new Handler();
private WakeLock mIncallWakeLock;
+ private LinphoneAccountCreator accountCreator;
private static List mPendingChatFileMessage;
private static LinphoneChatMessage mUploadPendingFileMessage;
@@ -482,12 +488,12 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
}
}
}
-
+
LinphoneProxyConfig lpc = getLc().getDefaultProxyConfig();
if (lpc != null) {
to = lpc.normalizePhoneNumber(to);
}
-
+
LinphoneAddress lAddress;
try {
lAddress = mLc.interpretUrl(to);
@@ -664,11 +670,11 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
public void restartLinphoneCore() {
destroyLinphoneCore();
startLibLinphone(mServiceContext);
- /*
- You cannot receive this through components declared in manifests, only
- by explicitly registering for it with Context.registerReceiver(). This is a protected intent that can only
+ /*
+ You cannot receive this through components declared in manifests, only
+ by explicitly registering for it with Context.registerReceiver(). This is a protected intent that can only
be sent by the system.
- */
+ */
mServiceContext.registerReceiver(mKeepAliveReceiver, mKeepAliveIntentFilter);
sExited = false;
}
@@ -702,7 +708,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
Log.e(e, "Cannot start linphone");
}
}
-
+
private void initPushNotificationsService() {
try {
Class> GCMRegistrar = Class.forName("com.google.android.gcm.GCMRegistrar");
@@ -736,7 +742,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
prefMigrator.migrateRemoteProvisioningUriIfNeeded();
prefMigrator.migrateSharingServerUrlIfNeeded();
prefMigrator.doPresenceMigrationIfNeeded();
-
+
if (prefMigrator.isMigrationNeeded()) {
prefMigrator.doMigration();
}
@@ -761,7 +767,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
} catch (NameNotFoundException e) {
Log.e(e, "cannot get version name");
}
-
+
mLc.setRingback(mRingbackSoundFile);
mLc.setRootCA(mLinphoneRootCaFile);
mLc.setPlayFile(mPauseSoundFile);
@@ -786,11 +792,11 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
initPushNotificationsService();
}
- /*
- You cannot receive this through components declared in manifests, only
- by explicitly registering for it with Context.registerReceiver(). This is a protected intent that can only
+ /*
+ You cannot receive this through components declared in manifests, only
+ by explicitly registering for it with Context.registerReceiver(). This is a protected intent that can only
be sent by the system.
- */
+ */
mKeepAliveIntentFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
mKeepAliveIntentFilter.addAction(Intent.ACTION_SCREEN_OFF);
mKeepAliveReceiver = new KeepAliveReceiver();
@@ -799,6 +805,10 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
updateNetworkReachability();
resetCameraFromPreferences();
+
+ accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl());
+ accountCreator.setDomain(getString(R.string.default_domain));
+ accountCreator.setListener(this);
}
private void copyAssetsFromPackage() throws IOException {
@@ -888,7 +898,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
mLastNetworkType=curtype;
}
}
-
+
if (mLc.isNetworkReachable()) {
// When network isn't available, push informations might not be set. This should fix the issue.
LinphonePreferences prefs = LinphonePreferences.instance();
@@ -1053,16 +1063,16 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
}
return null;
}
-
+
public void setAudioManagerInCallMode() {
if (mAudioManager.getMode() == AudioManager.MODE_IN_COMMUNICATION) {
- Log.w("[AudioManager] already in MODE_IN_COMMUNICATION, skipping...");
+ Log.w("[AudioManager] already in MODE_IN_COMMUNICATION, skipping...");
return;
}
Log.d("[AudioManager] Mode: MODE_IN_COMMUNICATION");
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
}
-
+
@SuppressLint("Wakelock")
public void callState(final LinphoneCore lc,final LinphoneCall call, final State state, final String message) {
Log.i("New call state [",state,"]");
@@ -1245,7 +1255,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
if (res == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) mAudioFocused=true;
}
}
-
+
public void enableDeviceRingtone(boolean use) {
if (use) {
mLc.setRing(null);
@@ -1260,7 +1270,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
routeAudioToSpeaker();
return;
}
-
+
if (mR.getBoolean(R.bool.allow_ringing_while_early_media)) {
routeAudioToSpeaker(); // Need to be able to ear the ringtone during the early media
}
@@ -1432,8 +1442,52 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
return incomingPending ? currentCall : null;
}
+ public void displayLinkPhoneNumber() {
+ accountCreator.setUsername(LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex()));
+ accountCreator.isAccountLinked();
+ }
+ public void isAccountWithAlias(){
+ if(LinphoneManager.getLc().getDefaultProxyConfig() != null) {
+ accountCreator.setUsername(LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex()));
+ accountCreator.isAccountUsed();
+ } else {
+ LinphonePreferences.instance().setLinkPopupTime(null);
+ }
+ }
+ private void askLinkWithPhoneNumber(){
+ long now = Calendar.getInstance().getTimeInMillis();
+ long newDate = now + (LinphoneActivity.instance().getResources().getInteger(R.integer.popup_time_interval)*60);
+ if (LinphonePreferences.instance().getLinkPopupTime() != null && Long.parseLong(LinphonePreferences.instance().getLinkPopupTime()) > now) {
+ return;
+ } else {
+ LinphonePreferences.instance().setLinkPopupTime(String.valueOf(newDate));
+ }
+ final Dialog dialog = LinphoneActivity.instance().displayDialog(String.format(getString(R.string.link_account_popup), LinphoneManager.getLc().getDefaultProxyConfig().getAddress().asStringUriOnly()));
+ Button delete = (Button) dialog.findViewById(R.id.delete_button);
+ delete.setText(getString(R.string.link));
+ Button cancel = (Button) dialog.findViewById(R.id.cancel);
+ cancel.setText(getString(R.string.maybe_later));
+
+ delete.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ LinphoneManager.getInstance().displayLinkPhoneNumber();
+ dialog.dismiss();
+ }
+ });
+
+ LinphonePreferences.instance().setLinkPopupTime(String.valueOf(newDate));
+
+ cancel.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ dialog.dismiss();
+ }
+ });
+ dialog.show();
+ }
@SuppressWarnings("serial")
public static class LinphoneConfigException extends LinphoneException {
@@ -1546,12 +1600,12 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
mAudioManager.abandonAudioFocus(null);
Log.i("Set audio mode on 'Normal'");
}
-
+
@Override
public void friendListCreated(LinphoneCore lc, LinphoneFriendList list) {
// TODO Auto-generated method stub
}
-
+
@Override
public void friendListRemoved(LinphoneCore lc, LinphoneFriendList list) {
// TODO Auto-generated method stub
@@ -1560,12 +1614,48 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
public void authInfoRequested(LinphoneCore lc, String realm,
String username, String domain) {
// TODO Auto-generated method stub
-
+
}
@Override
public void authenticationRequested(LinphoneCore lc,
LinphoneAuthInfo authInfo, AuthMethod method) {
// TODO Auto-generated method stub
-
+
+ }
+
+ @Override
+ public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
+ if (status.equals(LinphoneAccountCreator.Status.AccountExist)) {
+ accountCreator.isAccountLinked();
+ }
+ }
+
+ @Override
+ public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
+
+ @Override
+ public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
+
+ @Override
+ public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
+
+ @Override
+ public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
+
+ @Override
+ public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
+
+ @Override
+ public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
+
+ @Override
+ public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
+ if (status.equals(LinphoneAccountCreator.Status.AccountNotLinked)) {
+ askLinkWithPhoneNumber();
+ }
+ }
+
+ @Override
+ public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
}
}
diff --git a/src/org/linphone/assistant/AssistantActivity.java b/src/org/linphone/assistant/AssistantActivity.java
index e10e122d9..5507f8e30 100644
--- a/src/org/linphone/assistant/AssistantActivity.java
+++ b/src/org/linphone/assistant/AssistantActivity.java
@@ -551,12 +551,13 @@ private static AssistantActivity instance;
progress.show();
}
- public void displayAssistantConfirm(String username, String password) {
+ public void displayAssistantConfirm(String username, String password, String email) {
CreateAccountActivationFragment fragment = new CreateAccountActivationFragment();
newAccount = true;
Bundle extras = new Bundle();
extras.putString("Username", username);
extras.putString("Password", password);
+ extras.putString("Email", email);
fragment.setArguments(extras);
changeFragment(fragment);
@@ -582,7 +583,8 @@ private static AssistantActivity instance;
public void isAccountVerified(String username) {
Toast.makeText(this, getString(R.string.assistant_account_validated), Toast.LENGTH_LONG).show();
- launchEchoCancellerCalibration(true);
+ hideKeyboard();
+ success();
}
public void isEchoCalibrationFinished() {
diff --git a/src/org/linphone/assistant/CreateAccountActivationFragment.java b/src/org/linphone/assistant/CreateAccountActivationFragment.java
index db3c732fe..59f57dfc3 100644
--- a/src/org/linphone/assistant/CreateAccountActivationFragment.java
+++ b/src/org/linphone/assistant/CreateAccountActivationFragment.java
@@ -20,91 +20,106 @@ 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.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.LinphoneAccountCreator;
+import org.linphone.core.LinphoneAccountCreator.LinphoneAccountCreatorListener;
+import org.linphone.core.LinphoneCoreFactory;
+import org.linphone.mediastream.Log;
import android.app.Fragment;
import android.os.Bundle;
-import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
+import android.widget.TextView;
import android.widget.Toast;
/**
* @author Sylvain Berfini
*/
-public class CreateAccountActivationFragment extends Fragment implements LinphoneXmlRpcRequestListener {
+public class CreateAccountActivationFragment extends Fragment implements OnClickListener, LinphoneAccountCreatorListener {
private String username, password;
- private Handler mHandler = new Handler();
private Button checkAccount;
- private LinphoneXmlRpcSession xmlRpcSession;
- private LinphoneXmlRpcRequest xmlRpcRequest;
- private Runnable runNotOk, runOk, runNotReachable;
-
+ private TextView email;
+ private LinphoneAccountCreator 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.setDomain(getResources().getString(R.string.default_domain));
+ accountCreator.setListener(this);
+
username = getArguments().getString("Username");
password = getArguments().getString("Password");
- checkAccount = (Button) view.findViewById(R.id.assistant_check);
- checkAccount.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- checkAccount.setEnabled(false);
- isAccountVerified(username);
- }
- });
+ accountCreator.setUsername(username);
+ accountCreator.setPassword(password);
- runNotOk = new Runnable() {
- public void run() {
- checkAccount.setEnabled(true);
- Toast.makeText(getActivity(), getString(R.string.assistant_account_not_validated), Toast.LENGTH_LONG).show();
- }
- };
- runOk = new Runnable() {
- public void run() {
- checkAccount.setEnabled(true);
- AssistantActivity.instance().saveCreatedAccount(username, password, null, null, getString(R.string.default_domain),null);
- AssistantActivity.instance().isAccountVerified(username);
- }
- };
- runNotReachable = new Runnable() {
- public void run() {
- Toast.makeText(getActivity(), getString(R.string.wizard_server_unavailable), Toast.LENGTH_LONG).show();
- }
- };
-
- xmlRpcSession = new LinphoneXmlRpcSessionImpl(LinphoneManager.getLcIfManagerNotDestroyedOrNull(), LinphonePreferences.instance().getXmlrpcUrl());
- xmlRpcRequest = new LinphoneXmlRpcRequestImpl("check_account_validated", LinphoneXmlRpcRequest.ArgType.Int);
- xmlRpcRequest.setListener(this);
-
+ email = (TextView) view.findViewById(R.id.send_email);
+ email.setText(getArguments().getString("Email"));
+
+ checkAccount = (Button) view.findViewById(R.id.assistant_check);
+ checkAccount.setOnClickListener(this);
return view;
}
@Override
- public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
- if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
- int response = request.getIntResponse();
- if (response != 1) {
- mHandler.post(runNotOk);
- } else {
- mHandler.post(runOk);
+ public void onClick(View v) {
+ switch (v.getId()) {
+ case R.id.assistant_check: {
+ checkAccount.setEnabled(false);
+ accountCreator.isAccountActivated();
+ break;
}
- } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
- mHandler.post(runNotReachable);
}
}
-
- private void isAccountVerified(final String username) {
- xmlRpcRequest.addStringArg(username + "@" + getString(R.string.default_domain));
- xmlRpcSession.sendRequest(xmlRpcRequest);
+
+ @Override
+ public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
+ }
+
+ @Override
+ public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
+ }
+
+ @Override
+ public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
+ }
+
+ @Override
+ public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
+ }
+
+ @Override
+ public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
+ }
+
+ @Override
+ public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
+ if (status.equals(LinphoneAccountCreator.Status.AccountNotActivated)) {
+ Toast.makeText(getActivity(), getString(R.string.assistant_account_not_validated), Toast.LENGTH_LONG).show();
+ } else if (status.equals(LinphoneAccountCreator.Status.AccountActivated)) {
+ AssistantActivity.instance().saveCreatedAccount(username, password, null, null, getString(R.string.default_domain), null);
+ AssistantActivity.instance().isAccountVerified(username);
+ } else {
+ Toast.makeText(getActivity(), getString(R.string.wizard_server_unavailable), Toast.LENGTH_LONG).show();
+ }
+ checkAccount.setEnabled(true);
+ }
+
+ @Override
+ public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
+ }
+
+ @Override
+ public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
+ }
+
+ @Override
+ public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
}
}
diff --git a/src/org/linphone/assistant/CreateAccountCodeActivationFragment.java b/src/org/linphone/assistant/CreateAccountCodeActivationFragment.java
index 619d9cce7..c63f102b7 100644
--- a/src/org/linphone/assistant/CreateAccountCodeActivationFragment.java
+++ b/src/org/linphone/assistant/CreateAccountCodeActivationFragment.java
@@ -41,7 +41,7 @@ import android.widget.Toast;
public class CreateAccountCodeActivationFragment extends Fragment implements LinphoneAccountCreatorListener {
private String username, phone, dialcode;
- private TextView title;
+ private TextView title, phonenumber;
private EditText code;
private boolean recoverAccount = false, linkAccount = false;
private int code_length;
@@ -78,6 +78,9 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
title.setText(getString(R.string.assistant_linphone_account));
}
+ phonenumber = (TextView) view.findViewById(R.id.send_phone_number);
+ phonenumber.setText(phone);
+
code = (EditText) view.findViewById(R.id.assistant_code);
code.addTextChangedListener(new TextWatcher() {
@Override
diff --git a/src/org/linphone/assistant/CreateAccountFragment.java b/src/org/linphone/assistant/CreateAccountFragment.java
index 721e395d5..2f98187b5 100644
--- a/src/org/linphone/assistant/CreateAccountFragment.java
+++ b/src/org/linphone/assistant/CreateAccountFragment.java
@@ -32,7 +32,6 @@ import org.linphone.core.LinphoneAccountCreator.LinphoneAccountCreatorListener;
import org.linphone.core.LinphoneAccountCreator.Status;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneProxyConfig;
-import org.w3c.dom.Text;
import android.accounts.Account;
import android.accounts.AccountManager;
@@ -152,7 +151,6 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
AssistantActivity.instance().country = c;
selectCountry.setText(c.name);
}
- LinphoneUtils.setCountry(c, dialCode, selectCountry, countryCode);
//Allow user to enter a username instead use the phone number as username
if (getResources().getBoolean(R.bool.assistant_allow_username)) {
@@ -320,7 +318,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
if (linkAccount) {
addAlias();
} else {
- if (getUsername().length() > 0) {
+ if (!getResources().getBoolean(R.bool.isTablet) || getUsername().length() > 0) {
accountCreator.isAccountUsed();
} else {
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(Status.UsernameTooShort)
@@ -601,7 +599,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
if (status.equals(Status.AccountCreated)) {
if (useEmail.isChecked() || !getResources().getBoolean(R.bool.use_phone_number_validation)) {
AssistantActivity.instance().displayAssistantConfirm(getUsername()
- , passwordEdit.getText().toString());
+ , passwordEdit.getText().toString(), emailEdit.getText().toString());
} else {
AssistantActivity.instance().displayAssistantCodeConfirm(getUsername()
, phoneNumberEdit.getText().toString()
diff --git a/src/org/linphone/assistant/LinphoneLoginFragment.java b/src/org/linphone/assistant/LinphoneLoginFragment.java
index ded6e17be..d0d13463a 100644
--- a/src/org/linphone/assistant/LinphoneLoginFragment.java
+++ b/src/org/linphone/assistant/LinphoneLoginFragment.java
@@ -40,6 +40,7 @@ import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
+import android.view.ViewDebug;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
@@ -103,13 +104,16 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
if(getResources().getBoolean(R.bool.use_phone_number_validation)){
getActivity().getApplicationContext();
//Automatically get the country code from the phone
- TelephonyManager tm = (TelephonyManager) getActivity().getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
+ TelephonyManager tm =
+ (TelephonyManager) getActivity().getApplicationContext().getSystemService(
+ Context.TELEPHONY_SERVICE);
String countryIso = tm.getNetworkCountryIso();
LinphoneProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig();
countryCode = proxyConfig.lookupCCCFromIso(countryIso.toUpperCase());
+
AssistantActivity.Country c = AssistantActivity.instance().getCountryListAdapter()
- .getCountryFromCountryCode(dialCode.getText().toString());
+ .getCountryFromCountryCode(String.valueOf(countryCode));
if (c != null) {
AssistantActivity.instance().country = c;
selectCountry.setText(c.name);
@@ -124,8 +128,6 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
phoneNumberEdit.setText(previousPhone);
}
- LinphoneUtils.setCountry(AssistantActivity.instance().country, dialCode, selectCountry, countryCode);
-
//Allow user to enter a username instead use the phone number as username
if(getResources().getBoolean(R.bool.assistant_allow_username) ) {
useUsername.setVisibility(View.VISIBLE);
diff --git a/submodules/linphone b/submodules/linphone
index a5a65227b..552967108 160000
--- a/submodules/linphone
+++ b/submodules/linphone
@@ -1 +1 @@
-Subproject commit a5a65227b36d0cfb6d4b34b93521986bc371b685
+Subproject commit 5529671088b6711b90c5abc21d972a3d20e5f124