Fix country code chooser

This commit is contained in:
Margaux Clerc 2016-09-02 17:26:09 +02:00
parent 329d716273
commit adfa788a73
5 changed files with 28 additions and 20 deletions

View file

@ -73,9 +73,11 @@
android:background="@drawable/resizable_textfield"
android:textColor="@color/colorB"
android:inputType="phone"
android:text="+"
android:layout_marginRight="10dp"
android:layout_width="50dp"
android:layout_height="40dp"
android:gravity="center"
android:layout_width="65dp"
android:layout_height="42dp"
android:singleLine="true"/>
<EditText

View file

@ -51,6 +51,7 @@
<string name="conference">Conference</string>
<string name="link">Link</string>
<string name="link_account_popup">Do you want to link the account %s with your phone number ?</string>
<string name="maybe_later">Maybe later</string>
<!-- Launch screen -->
<string name="app_description">the <i>libre</i> SIP client</string>
@ -84,6 +85,7 @@
<string name="assistant_ec_calibration">Echo canceler calibration in progress</string>
<string name="assistant_remote_provisioning_login">Enter your login</string>
<string name="assistant_account_not_validated">Your account has not been validated yet.</string>
<string name="assistant_error_confirmation_code"></string>
<string name="assistant_account_validated">Your account has been validated.</string>
<string name="assistant_error_bad_credentials">Incorrect username or password</string>
<string name="assistant_codec_down_question">Do you agree to download OpenH264 Video Codec provided by Cisco Systems, Inc.?</string>

View file

@ -69,6 +69,7 @@ public class AssistantActivity extends Activity implements OnClickListener, Acti
private static AssistantActivity instance;
private ImageView back, cancel;
private AssistantFragmentsEnum currentFragment;
private AssistantFragmentsEnum lastFragment;
private AssistantFragmentsEnum firstFragment;
private Fragment fragment;
private LinphonePreferences mPrefs;
@ -234,14 +235,15 @@ private static AssistantActivity instance;
|| currentFragment == AssistantFragmentsEnum.LINPHONE_LOGIN
|| currentFragment == AssistantFragmentsEnum.CREATE_ACCOUNT
|| currentFragment == AssistantFragmentsEnum.REMOTE_PROVISIONING) {
WelcomeFragment fragment = new WelcomeFragment();
changeFragment(fragment);
currentFragment = AssistantFragmentsEnum.WELCOME;
back.setVisibility(View.INVISIBLE);
displayMenu();
} else if (currentFragment == AssistantFragmentsEnum.WELCOME) {
finish();
} else if (currentFragment == AssistantFragmentsEnum.COUNTRY_CHOOSER){
displayCreateAccount();
if(lastFragment.equals(AssistantFragmentsEnum.LINPHONE_LOGIN)){
displayLoginLinphone();
} else {
displayCreateAccount();
}
}
}
@ -344,6 +346,7 @@ private static AssistantActivity instance;
public void displayMenu() {
fragment = new WelcomeFragment();
changeFragment(fragment);
country = null;
currentFragment = AssistantFragmentsEnum.WELCOME;
back.setVisibility(View.INVISIBLE);
}
@ -382,6 +385,7 @@ private static AssistantActivity instance;
public void displayCountryChooser() {
fragment = new CountryListFragment();
changeFragment(fragment);
lastFragment = currentFragment;
currentFragment = AssistantFragmentsEnum.COUNTRY_CHOOSER;
back.setVisibility(View.VISIBLE);
}

View file

@ -22,7 +22,6 @@ import android.app.Fragment;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import org.linphone.mediastream.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
@ -35,6 +34,7 @@ import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences;
import org.linphone.R;
import org.linphone.core.LinphoneAccountCreator;
import org.linphone.mediastream.Log;
import org.linphone.core.LinphoneAccountCreatorImpl;
@ -126,20 +126,21 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
@Override
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
if(status.equals(Status.AccountActivated)){
if (status.equals(Status.AccountActivated)) {
checkAccount.setEnabled(true);
if(accountCreator.getUsername() != null){
AssistantActivity.instance().saveCreatedAccount(accountCreator.getUsername(), null , null, accountCreator.getHa1() , getString(R.string.default_domain), null);
AssistantActivity.instance().isAccountVerified(accountCreator.getUsername());
if (accountCreator.getUsername() != null) {
AssistantActivity.instance().saveCreatedAccount(accountCreator.getUsername(), null, null, accountCreator.getHa1(), getString(R.string.default_domain), null);
if(!recoverAccount)
AssistantActivity.instance().isAccountVerified(accountCreator.getUsername());
} else {
AssistantActivity.instance().saveCreatedAccount(accountCreator.getPhoneNumber(), null , null, accountCreator.getHa1() , getString(R.string.default_domain), null);
AssistantActivity.instance().isAccountVerified(accountCreator.getPhoneNumber());
AssistantActivity.instance().saveCreatedAccount(accountCreator.getPhoneNumber(), null, null, accountCreator.getHa1(), getString(R.string.default_domain), null);
if(!recoverAccount)
AssistantActivity.instance().isAccountVerified(accountCreator.getPhoneNumber());
}
} else if (status.equals(LinphoneAccountCreator.Status.Failed)){
} else if (status.equals(LinphoneAccountCreator.Status.Failed)) {
Toast.makeText(getActivity(), getString(R.string.wizard_server_unavailable), Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getActivity(), getString(R.string.assistant_account_not_validated), Toast.LENGTH_LONG).show();
}else {
Toast.makeText(getActivity(), getString(R.string.assistant_error_confirmation_code), Toast.LENGTH_LONG).show();
}
}

View file

@ -225,8 +225,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
}
private void recoverAccount() {
//accountCreator.recoverPhoneAccount();
AssistantActivity.instance().displayAssistantCodeConfirm(accountCreator.getUsername(), phoneNumberEdit.getText().toString(), getCountryCode(), true);
accountCreator.recoverPhoneAccount();
}
@Override