Some fix for Assistant
This commit is contained in:
parent
f47ff85423
commit
9deca05ed1
5 changed files with 37 additions and 25 deletions
|
@ -22,6 +22,7 @@
|
||||||
android:text="@string/assistant_create_account_part_2"
|
android:text="@string/assistant_create_account_part_2"
|
||||||
style="@style/font11"
|
style="@style/font11"
|
||||||
android:paddingTop="10dp"
|
android:paddingTop="10dp"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@
|
||||||
<string name="phone_number_info_title">What will my phone number be used for?</string>
|
<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_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">\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 -->
|
<!-- Status -->
|
||||||
<string name="invalid_email">Invalid email</string>
|
<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_rfc2833_dtmf">Send in-band DTMFs(RFC2833)</string>
|
||||||
<string name="pref_sipinfo_dtmf">Send out-band DTMFs(SIP INFO)</string>
|
<string name="pref_sipinfo_dtmf">Send out-band DTMFs(SIP INFO)</string>
|
||||||
<string name="pref_voice_mail">Voice mail URI</string>
|
<string name="pref_voice_mail">Voice mail URI</string>
|
||||||
|
|
||||||
<!-- Chat settings -->
|
<!-- Chat settings -->
|
||||||
<string name="pref_chat_title">Chat</string>
|
<string name="pref_chat_title">Chat</string>
|
||||||
<string name="pref_image_sharing_server_title">Sharing server</string>
|
<string name="pref_image_sharing_server_title">Sharing server</string>
|
||||||
|
|
|
@ -99,7 +99,7 @@ private static AssistantActivity instance;
|
||||||
public String phone_number;
|
public String phone_number;
|
||||||
public String email;
|
public String email;
|
||||||
public String activation_code;
|
public String activation_code;
|
||||||
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ private static AssistantActivity instance;
|
||||||
accountCreator.setListener(this);
|
accountCreator.setListener(this);
|
||||||
|
|
||||||
countryListAdapter = new CountryListAdapter(R.raw.countries, getApplicationContext());
|
countryListAdapter = new CountryListAdapter(R.raw.countries, getApplicationContext());
|
||||||
|
|
||||||
mListener = new LinphoneCoreListenerBase() {
|
mListener = new LinphoneCoreListenerBase() {
|
||||||
@Override
|
@Override
|
||||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, RegistrationState state, String smessage) {
|
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, RegistrationState state, String smessage) {
|
||||||
|
@ -178,7 +178,7 @@ private static AssistantActivity instance;
|
||||||
lc.addListener(mListener);
|
lc.addListener(mListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
|
@ -188,14 +188,14 @@ private static AssistantActivity instance;
|
||||||
|
|
||||||
super.onPause();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
outState.putSerializable("CurrentFragment", currentFragment);
|
outState.putSerializable("CurrentFragment", currentFragment);
|
||||||
outState.putBoolean("echoCanceller", echoCancellerAlreadyDone);
|
outState.putBoolean("echoCanceller", echoCancellerAlreadyDone);
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AssistantActivity instance() {
|
public static AssistantActivity instance() {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ private static AssistantActivity instance;
|
||||||
cancel = (ImageView) findViewById(R.id.assistant_cancel);
|
cancel = (ImageView) findViewById(R.id.assistant_cancel);
|
||||||
cancel.setOnClickListener(this);
|
cancel.setOnClickListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeFragment(Fragment newFragment) {
|
private void changeFragment(Fragment newFragment) {
|
||||||
hideKeyboard();
|
hideKeyboard();
|
||||||
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
||||||
|
@ -221,7 +221,7 @@ private static AssistantActivity instance;
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
int id = v.getId();
|
int id = v.getId();
|
||||||
|
|
||||||
if (id == R.id.assistant_cancel) {
|
if (id == R.id.assistant_cancel) {
|
||||||
hideKeyboard();
|
hideKeyboard();
|
||||||
LinphonePreferences.instance().firstLaunchSuccessful();
|
LinphonePreferences.instance().firstLaunchSuccessful();
|
||||||
|
@ -310,7 +310,7 @@ private static AssistantActivity instance;
|
||||||
private void launchEchoCancellerCalibration(boolean sendEcCalibrationResult) {
|
private void launchEchoCancellerCalibration(boolean sendEcCalibrationResult) {
|
||||||
int recordAudio = getPackageManager().checkPermission(Manifest.permission.RECORD_AUDIO, getPackageName());
|
int recordAudio = getPackageManager().checkPermission(Manifest.permission.RECORD_AUDIO, getPackageName());
|
||||||
Log.i("[Permission] Record audio permission is " + (recordAudio == PackageManager.PERMISSION_GRANTED ? "granted" : "denied"));
|
Log.i("[Permission] Record audio permission is " + (recordAudio == PackageManager.PERMISSION_GRANTED ? "granted" : "denied"));
|
||||||
|
|
||||||
if (recordAudio == PackageManager.PERMISSION_GRANTED) {
|
if (recordAudio == PackageManager.PERMISSION_GRANTED) {
|
||||||
EchoCancellerCalibrationFragment fragment = new EchoCancellerCalibrationFragment();
|
EchoCancellerCalibrationFragment fragment = new EchoCancellerCalibrationFragment();
|
||||||
fragment.enableEcCalibrationResultSending(sendEcCalibrationResult);
|
fragment.enableEcCalibrationResultSending(sendEcCalibrationResult);
|
||||||
|
@ -378,7 +378,7 @@ private static AssistantActivity instance;
|
||||||
currentFragment = AssistantFragmentsEnum.LOGIN;
|
currentFragment = AssistantFragmentsEnum.LOGIN;
|
||||||
back.setVisibility(View.VISIBLE);
|
back.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayLoginLinphone() {
|
public void displayLoginLinphone() {
|
||||||
fragment = new LinphoneLoginFragment();
|
fragment = new LinphoneLoginFragment();
|
||||||
changeFragment(fragment);
|
changeFragment(fragment);
|
||||||
|
@ -466,7 +466,7 @@ private static AssistantActivity instance;
|
||||||
if(prefix != null){
|
if(prefix != null){
|
||||||
builder.setPrefix(prefix);
|
builder.setPrefix(prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMainAccountLinphoneDotOrg) {
|
if (isMainAccountLinphoneDotOrg) {
|
||||||
if (getResources().getBoolean(R.bool.disable_all_security_features_for_markets)) {
|
if (getResources().getBoolean(R.bool.disable_all_security_features_for_markets)) {
|
||||||
builder.setProxy(domain)
|
builder.setProxy(domain)
|
||||||
|
@ -487,7 +487,7 @@ private static AssistantActivity instance;
|
||||||
.setNoDefault(false);
|
.setNoDefault(false);
|
||||||
|
|
||||||
mPrefs.enabledFriendlistSubscription(getResources().getBoolean(R.bool.use_friendlist_subscription));
|
mPrefs.enabledFriendlistSubscription(getResources().getBoolean(R.bool.use_friendlist_subscription));
|
||||||
|
|
||||||
mPrefs.setStunServer(getString(R.string.default_stun));
|
mPrefs.setStunServer(getString(R.string.default_stun));
|
||||||
mPrefs.setIceEnabled(true);
|
mPrefs.setIceEnabled(true);
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ private static AssistantActivity instance;
|
||||||
builder.setTransport(transport);
|
builder.setTransport(transport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getResources().getBoolean(R.bool.enable_push_id)) {
|
if (getResources().getBoolean(R.bool.enable_push_id)) {
|
||||||
String regId = mPrefs.getPushNotificationRegistrationID();
|
String regId = mPrefs.getPushNotificationRegistrationID();
|
||||||
String appId = getString(R.string.push_sender_id);
|
String appId = getString(R.string.push_sender_id);
|
||||||
|
@ -541,7 +541,7 @@ private static AssistantActivity instance;
|
||||||
|
|
||||||
public void displayRemoteProvisioningInProgressDialog() {
|
public void displayRemoteProvisioningInProgressDialog() {
|
||||||
remoteProvisioningInProgress = true;
|
remoteProvisioningInProgress = true;
|
||||||
|
|
||||||
progress = ProgressDialog.show(this, null, null);
|
progress = ProgressDialog.show(this, null, null);
|
||||||
Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorE));
|
Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorE));
|
||||||
d.setAlpha(200);
|
d.setAlpha(200);
|
||||||
|
@ -559,7 +559,7 @@ private static AssistantActivity instance;
|
||||||
extras.putString("Password", password);
|
extras.putString("Password", password);
|
||||||
fragment.setArguments(extras);
|
fragment.setArguments(extras);
|
||||||
changeFragment(fragment);
|
changeFragment(fragment);
|
||||||
|
|
||||||
currentFragment = AssistantFragmentsEnum.CREATE_ACCOUNT_ACTIVATION;
|
currentFragment = AssistantFragmentsEnum.CREATE_ACCOUNT_ACTIVATION;
|
||||||
back.setVisibility(View.INVISIBLE);
|
back.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
@ -579,7 +579,7 @@ private static AssistantActivity instance;
|
||||||
currentFragment = AssistantFragmentsEnum.CREATE_ACCOUNT_CODE_ACTIVATION;
|
currentFragment = AssistantFragmentsEnum.CREATE_ACCOUNT_CODE_ACTIVATION;
|
||||||
back.setVisibility(View.INVISIBLE);
|
back.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
launchEchoCancellerCalibration(true);
|
launchEchoCancellerCalibration(true);
|
||||||
|
@ -611,7 +611,7 @@ private static AssistantActivity instance;
|
||||||
});
|
});
|
||||||
return builder.show();
|
return builder.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void success() {
|
public void success() {
|
||||||
boolean needsEchoCalibration = LinphoneManager.getLc().needsEchoCalibration();
|
boolean needsEchoCalibration = LinphoneManager.getLc().needsEchoCalibration();
|
||||||
if (needsEchoCalibration && mPrefs.isFirstLaunch()) {
|
if (needsEchoCalibration && mPrefs.isFirstLaunch()) {
|
||||||
|
@ -620,7 +620,7 @@ private static AssistantActivity instance;
|
||||||
launchDownloadCodec();
|
launchDownloadCodec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void goToLinphoneActivity() {
|
private void goToLinphoneActivity() {
|
||||||
mPrefs.firstLaunchSuccessful();
|
mPrefs.firstLaunchSuccessful();
|
||||||
startActivity(new Intent().setClass(this, LinphoneActivity.class).putExtra("isNewProxyConfig", true));
|
startActivity(new Intent().setClass(this, LinphoneActivity.class).putExtra("isNewProxyConfig", true));
|
||||||
|
@ -738,7 +738,7 @@ private static AssistantActivity instance;
|
||||||
public Country getCountryFromCountryCode(String countryCode) {
|
public Country getCountryFromCountryCode(String countryCode) {
|
||||||
countryCode = (countryCode.startsWith("+")) ? countryCode : "+" + countryCode;
|
countryCode = (countryCode.startsWith("+")) ? countryCode : "+" + countryCode;
|
||||||
for (Country c : allCountries) {
|
for (Country c : allCountries) {
|
||||||
if (c.dial_code.compareTo("+"+countryCode) == 0)
|
if (c.dial_code.compareTo(countryCode) == 0)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
||||||
private EditText phoneNumberEdit, usernameEdit, passwordEdit, passwordConfirmEdit, emailEdit, dialCode;
|
private EditText phoneNumberEdit, usernameEdit, passwordEdit, passwordConfirmEdit, emailEdit, dialCode;
|
||||||
private TextView phoneNumberError, usernameError, passwordError, passwordConfirmError, emailError, assisstantTitle, sipUri, skip;
|
private TextView phoneNumberError, usernameError, passwordError, passwordConfirmError, emailError, assisstantTitle, sipUri, skip;
|
||||||
private ImageView phoneNumberInfo;
|
private ImageView phoneNumberInfo;
|
||||||
|
|
||||||
private boolean phoneNumberOk = false;
|
private boolean phoneNumberOk = false;
|
||||||
private boolean usernameOk = false;
|
private boolean usernameOk = false;
|
||||||
private boolean passwordOk = 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());
|
AssistantActivity.Country c = AssistantActivity.instance().getCountryListAdapter().getCountryFromCountryCode(dialCode.getText().toString());
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
AssistantActivity.instance().country = c;
|
AssistantActivity.instance().country = c;
|
||||||
LinphoneUtils.setCountry(AssistantActivity.instance().country, dialCode, selectCountry, countryCode);
|
selectCountry.setText(c.name);
|
||||||
|
} else {
|
||||||
|
selectCountry.setText(R.string.select_your_country);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
||||||
accountCreator.setListener(this);
|
accountCreator.setListener(this);
|
||||||
|
|
||||||
String url = "http://linphone.org/free-sip-service.html&action=recover";
|
String url = "http://linphone.org/free-sip-service.html&action=recover";
|
||||||
|
|
||||||
login = (EditText) view.findViewById(R.id.assistant_username);
|
login = (EditText) view.findViewById(R.id.assistant_username);
|
||||||
login.addTextChangedListener(this);
|
login.addTextChangedListener(this);
|
||||||
|
|
||||||
|
@ -171,6 +171,15 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
||||||
private void addPhoneNumberHandler(final EditText field, final ImageView icon) {
|
private void addPhoneNumberHandler(final EditText field, final ImageView icon) {
|
||||||
field.addTextChangedListener(new TextWatcher() {
|
field.addTextChangedListener(new TextWatcher() {
|
||||||
public void afterTextChanged(Editable s) {
|
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) {
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
@ -194,7 +203,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
int id = v.getId();
|
int id = v.getId();
|
||||||
|
|
||||||
switch(id) {
|
switch(id) {
|
||||||
case R.id.assistant_apply: {
|
case R.id.assistant_apply: {
|
||||||
if (recoverAccount) {
|
if (recoverAccount) {
|
||||||
|
@ -207,7 +216,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
||||||
case R.id.info_phone_number: {
|
case R.id.info_phone_number: {
|
||||||
new AlertDialog.Builder(getActivity())
|
new AlertDialog.Builder(getActivity())
|
||||||
.setTitle(getString(R.string.phone_number_info_title))
|
.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();
|
.show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue