Some fix for Assistant

This commit is contained in:
Erwan Croze 2016-10-10 17:22:45 +02:00
parent f47ff85423
commit 9deca05ed1
5 changed files with 37 additions and 25 deletions

View file

@ -22,6 +22,7 @@
android:text="@string/assistant_create_account_part_2"
style="@style/font11"
android:paddingTop="10dp"
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

View file

@ -117,7 +117,7 @@
<string name="phone_number_info_title">What will my phone number be used for?</string>
<string name="phone_number_info_content">\nThanks to your phone number, your friends will find you more easily.\n\n You will see in your address book who is using Linphone and your friends will know that they can rach you on Linphone as well.\n</string>
<string name="phone_number_link_info_content">\nYour friends will find you more easily if you link your account to your phone number\n\nYou will see in your address book who is using Linphone and your friends will know that they can reach you on Linphone as well.\n</string>
<string name="phone_number_link_info_content_already_account">You can only use your phone number with one linphone account.\n\nIf you had already linked your number to an other account but you prefer to use this one simply link it now and your number will automatically be moved to this account.</string>
<string name="phone_number_link_info_content_already_account">You can only use your phone number with one Linphone account.\n\nIf you had already linked your number to an other account but you prefer to use this one, simply link it now and your number will automatically be moved to this account.</string>
<!-- Status -->
<string name="invalid_email">Invalid email</string>
@ -337,7 +337,7 @@
<string name="pref_rfc2833_dtmf">Send in-band DTMFs(RFC2833)</string>
<string name="pref_sipinfo_dtmf">Send out-band DTMFs(SIP INFO)</string>
<string name="pref_voice_mail">Voice mail URI</string>
<!-- Chat settings -->
<string name="pref_chat_title">Chat</string>
<string name="pref_image_sharing_server_title">Sharing server</string>

View file

@ -99,7 +99,7 @@ private static AssistantActivity instance;
public String phone_number;
public String email;
public String activation_code;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -136,7 +136,7 @@ private static AssistantActivity instance;
accountCreator.setListener(this);
countryListAdapter = new CountryListAdapter(R.raw.countries, getApplicationContext());
mListener = new LinphoneCoreListenerBase() {
@Override
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, RegistrationState state, String smessage) {
@ -178,7 +178,7 @@ private static AssistantActivity instance;
lc.addListener(mListener);
}
}
@Override
protected void onPause() {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
@ -188,14 +188,14 @@ private static AssistantActivity instance;
super.onPause();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putSerializable("CurrentFragment", currentFragment);
outState.putBoolean("echoCanceller", echoCancellerAlreadyDone);
super.onSaveInstanceState(outState);
}
public static AssistantActivity instance() {
return instance;
}
@ -210,7 +210,7 @@ private static AssistantActivity instance;
cancel = (ImageView) findViewById(R.id.assistant_cancel);
cancel.setOnClickListener(this);
}
private void changeFragment(Fragment newFragment) {
hideKeyboard();
FragmentTransaction transaction = getFragmentManager().beginTransaction();
@ -221,7 +221,7 @@ private static AssistantActivity instance;
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.assistant_cancel) {
hideKeyboard();
LinphonePreferences.instance().firstLaunchSuccessful();
@ -310,7 +310,7 @@ private static AssistantActivity instance;
private void launchEchoCancellerCalibration(boolean sendEcCalibrationResult) {
int recordAudio = getPackageManager().checkPermission(Manifest.permission.RECORD_AUDIO, getPackageName());
Log.i("[Permission] Record audio permission is " + (recordAudio == PackageManager.PERMISSION_GRANTED ? "granted" : "denied"));
if (recordAudio == PackageManager.PERMISSION_GRANTED) {
EchoCancellerCalibrationFragment fragment = new EchoCancellerCalibrationFragment();
fragment.enableEcCalibrationResultSending(sendEcCalibrationResult);
@ -378,7 +378,7 @@ private static AssistantActivity instance;
currentFragment = AssistantFragmentsEnum.LOGIN;
back.setVisibility(View.VISIBLE);
}
public void displayLoginLinphone() {
fragment = new LinphoneLoginFragment();
changeFragment(fragment);
@ -466,7 +466,7 @@ private static AssistantActivity instance;
if(prefix != null){
builder.setPrefix(prefix);
}
if (isMainAccountLinphoneDotOrg) {
if (getResources().getBoolean(R.bool.disable_all_security_features_for_markets)) {
builder.setProxy(domain)
@ -487,7 +487,7 @@ private static AssistantActivity instance;
.setNoDefault(false);
mPrefs.enabledFriendlistSubscription(getResources().getBoolean(R.bool.use_friendlist_subscription));
mPrefs.setStunServer(getString(R.string.default_stun));
mPrefs.setIceEnabled(true);
@ -506,7 +506,7 @@ private static AssistantActivity instance;
builder.setTransport(transport);
}
}
if (getResources().getBoolean(R.bool.enable_push_id)) {
String regId = mPrefs.getPushNotificationRegistrationID();
String appId = getString(R.string.push_sender_id);
@ -541,7 +541,7 @@ private static AssistantActivity instance;
public void displayRemoteProvisioningInProgressDialog() {
remoteProvisioningInProgress = true;
progress = ProgressDialog.show(this, null, null);
Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorE));
d.setAlpha(200);
@ -559,7 +559,7 @@ private static AssistantActivity instance;
extras.putString("Password", password);
fragment.setArguments(extras);
changeFragment(fragment);
currentFragment = AssistantFragmentsEnum.CREATE_ACCOUNT_ACTIVATION;
back.setVisibility(View.INVISIBLE);
}
@ -579,7 +579,7 @@ private static AssistantActivity instance;
currentFragment = AssistantFragmentsEnum.CREATE_ACCOUNT_CODE_ACTIVATION;
back.setVisibility(View.INVISIBLE);
}
public void isAccountVerified(String username) {
Toast.makeText(this, getString(R.string.assistant_account_validated), Toast.LENGTH_LONG).show();
launchEchoCancellerCalibration(true);
@ -611,7 +611,7 @@ private static AssistantActivity instance;
});
return builder.show();
}
public void success() {
boolean needsEchoCalibration = LinphoneManager.getLc().needsEchoCalibration();
if (needsEchoCalibration && mPrefs.isFirstLaunch()) {
@ -620,7 +620,7 @@ private static AssistantActivity instance;
launchDownloadCodec();
}
}
private void goToLinphoneActivity() {
mPrefs.firstLaunchSuccessful();
startActivity(new Intent().setClass(this, LinphoneActivity.class).putExtra("isNewProxyConfig", true));
@ -738,7 +738,7 @@ private static AssistantActivity instance;
public Country getCountryFromCountryCode(String countryCode) {
countryCode = (countryCode.startsWith("+")) ? countryCode : "+" + countryCode;
for (Country c : allCountries) {
if (c.dial_code.compareTo("+"+countryCode) == 0)
if (c.dial_code.compareTo(countryCode) == 0)
return c;
}
return null;

View file

@ -62,7 +62,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
private EditText phoneNumberEdit, usernameEdit, passwordEdit, passwordConfirmEdit, emailEdit, dialCode;
private TextView phoneNumberError, usernameError, passwordError, passwordConfirmError, emailError, assisstantTitle, sipUri, skip;
private ImageView phoneNumberInfo;
private boolean phoneNumberOk = false;
private boolean usernameOk = false;
private boolean passwordOk = false;
@ -413,7 +413,9 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
AssistantActivity.Country c = AssistantActivity.instance().getCountryListAdapter().getCountryFromCountryCode(dialCode.getText().toString());
if (c != null) {
AssistantActivity.instance().country = c;
LinphoneUtils.setCountry(AssistantActivity.instance().country, dialCode, selectCountry, countryCode);
selectCountry.setText(c.name);
} else {
selectCountry.setText(R.string.select_your_country);
}
}
}

View file

@ -68,7 +68,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
accountCreator.setListener(this);
String url = "http://linphone.org/free-sip-service.html&action=recover";
login = (EditText) view.findViewById(R.id.assistant_username);
login.addTextChangedListener(this);
@ -171,6 +171,15 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
private void addPhoneNumberHandler(final EditText field, final ImageView icon) {
field.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
if (field.equals(dialCode)) {
AssistantActivity.Country c = AssistantActivity.instance().getCountryListAdapter().getCountryFromCountryCode(dialCode.getText().toString());
if (c != null) {
AssistantActivity.instance().country = c;
selectCountry.setText(c.name);
} else {
selectCountry.setText(R.string.select_your_country);
}
}
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@ -194,7 +203,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
@Override
public void onClick(View v) {
int id = v.getId();
switch(id) {
case R.id.assistant_apply: {
if (recoverAccount) {
@ -207,7 +216,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
case R.id.info_phone_number: {
new AlertDialog.Builder(getActivity())
.setTitle(getString(R.string.phone_number_info_title))
.setMessage(getString(R.string.phone_number_link_info_content) + "\n" + getString(R.string.phone_number_link_info_content_already_account))
.setMessage(getString(R.string.phone_number_link_info_content))
.show();
break;
}