Return to linphone login fragment after an error of validation code

This commit is contained in:
Erwan Croze 2016-11-17 15:47:28 +01:00
parent 44137ec872
commit ec5317d02e
5 changed files with 31 additions and 4 deletions

View file

@ -393,6 +393,10 @@ private static AssistantActivity instance;
public void displayLoginLinphone() { public void displayLoginLinphone() {
fragment = new LinphoneLoginFragment(); fragment = new LinphoneLoginFragment();
Bundle extras = new Bundle();
extras.putString("Phone", null);
extras.putString("Dialcode", null);
fragment.setArguments(extras);
changeFragment(fragment); changeFragment(fragment);
currentFragment = AssistantFragmentsEnum.LINPHONE_LOGIN; currentFragment = AssistantFragmentsEnum.LINPHONE_LOGIN;
back.setVisibility(View.VISIBLE); back.setVisibility(View.VISIBLE);
@ -594,6 +598,19 @@ private static AssistantActivity instance;
back.setVisibility(View.INVISIBLE); back.setVisibility(View.INVISIBLE);
} }
public void displayAssistantLinphoneLogin( String phone, String dialcode) {
LinphoneLoginFragment fragment = new LinphoneLoginFragment();
newAccount = true;
Bundle extras = new Bundle();
extras.putString("Phone", phone);
extras.putString("Dialcode", dialcode);
fragment.setArguments(extras);
changeFragment(fragment);
currentFragment = AssistantFragmentsEnum.LINPHONE_LOGIN;
back.setVisibility(View.VISIBLE);
}
public void isAccountVerified(String username) { public void isAccountVerified(String username) {
Toast.makeText(this, getString(R.string.assistant_account_validated), Toast.LENGTH_LONG).show(); Toast.makeText(this, getString(R.string.assistant_account_validated), Toast.LENGTH_LONG).show();
hideKeyboard(); hideKeyboard();

View file

@ -160,8 +160,9 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
} }
} 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(); Toast.makeText(getActivity(), getString(R.string.wizard_server_unavailable), Toast.LENGTH_LONG).show();
}else { } else {
Toast.makeText(getActivity(), getString(R.string.assistant_error_confirmation_code), Toast.LENGTH_LONG).show(); Toast.makeText(getActivity(), getString(R.string.assistant_error_confirmation_code), Toast.LENGTH_LONG).show();
AssistantActivity.instance().displayAssistantLinphoneLogin(phone, dialcode);
} }
} }

View file

@ -64,6 +64,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
private Boolean recoverAccount; private Boolean recoverAccount;
private LinphoneAccountCreator accountCreator; private LinphoneAccountCreator accountCreator;
private int countryCode; private int countryCode;
private String username, phone, dialcode;
private ImageView phoneNumberInfo; private ImageView phoneNumberInfo;
@Override @Override
@ -104,6 +105,9 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
//Phone number //Phone number
if(getResources().getBoolean(R.bool.use_phone_number_validation)){ if(getResources().getBoolean(R.bool.use_phone_number_validation)){
phone = getArguments().getString("Phone");
dialcode = getArguments().getString("Dialcode");
getActivity().getApplicationContext(); getActivity().getApplicationContext();
//Automatically get the country code from the phone //Automatically get the country code from the phone
TelephonyManager tm = TelephonyManager tm =
@ -139,10 +143,15 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
} }
//Allow user to enter a username instead use the phone number as username //Allow user to enter a username instead use the phone number as username
if(getResources().getBoolean(R.bool.assistant_allow_username) ) { if (getResources().getBoolean(R.bool.assistant_allow_username) ) {
useUsername.setVisibility(View.VISIBLE); useUsername.setVisibility(View.VISIBLE);
useUsername.setOnCheckedChangeListener(this); useUsername.setOnCheckedChangeListener(this);
} }
if (phone != null)
phoneNumberEdit.setText(phone);
if (dialcode != null)
dialCode.setText("+"+dialcode);
} }
if(getResources().getBoolean(R.bool.assistant_allow_username)) { if(getResources().getBoolean(R.bool.assistant_allow_username)) {

@ -1 +1 @@
Subproject commit 96d9dc552ce67db241aca45df549428f195461af Subproject commit 4da1c5ea4db5634beeb92ff7300e160446a594e5

@ -1 +1 @@
Subproject commit 1f5cf605310dc96881aa83ff1f74547a70a4dfa4 Subproject commit b1a48fb8163214474f66674f288b5ffb253ca1d9