diff --git a/res/values/strings.xml b/res/values/strings.xml index baf5f687c..2e18cc8f6 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -374,6 +374,9 @@ Incompatible media parameters Your correspondent has low bandwidth, video can\'t be started Network is unreachable + Bad credentials + Unauthorized + Network error Today Yesterday Missed diff --git a/src/org/linphone/AccountPreferencesFragment.java b/src/org/linphone/AccountPreferencesFragment.java index 866647565..e95ab392a 100644 --- a/src/org/linphone/AccountPreferencesFragment.java +++ b/src/org/linphone/AccountPreferencesFragment.java @@ -499,7 +499,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment { } catch (LinphoneCoreException e) { e.printStackTrace(); } - + LinphoneActivity.instance().isNewProxyConfig(); LinphoneManager.getLc().refreshRegisters(); } } diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index c505e7792..2668ba3da 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -43,6 +43,7 @@ import org.linphone.core.LinphoneCoreException; import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.core.LinphoneProxyConfig; +import org.linphone.core.Reason; import org.linphone.mediastream.Log; import org.linphone.setup.RemoteProvisioningLoginActivity; import org.linphone.setup.SetupActivity; @@ -104,6 +105,7 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene private Fragment dialerFragment, messageListFragment, friendStatusListenerFragment; private ChatFragment chatFragment; private SavedState dialerSavedState; + private boolean newProxyConfig; private boolean isAnimationDisabled = false, preferLinphoneContacts = false; private OrientationEventListener mOrientationHelper; private LinphoneCoreListenerBase mListener; @@ -198,6 +200,19 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene lc.removeAuthInfo(authInfo); } } + + if(state.equals(RegistrationState.RegistrationFailed) && newProxyConfig) { + newProxyConfig = false; + if (proxy.getError() == Reason.BadCredentials) { + displayCustomToast(getString(R.string.error_bad_credentials), Toast.LENGTH_LONG); + } + if (proxy.getError() == Reason.Unauthorized) { + displayCustomToast(getString(R.string.error_unauthorized), Toast.LENGTH_LONG); + } + if (proxy.getError() == Reason.IOError) { + displayCustomToast(getString(R.string.error_io_error), Toast.LENGTH_LONG); + } + } } @Override @@ -212,11 +227,11 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene } } else if (state == State.CallEnd || state == State.Error || state == State.CallReleased) { // Convert LinphoneCore message for internalization - if (message != null && message.equals("Call declined.")) { + if (message != null && call.getReason() == Reason.Declined) { displayCustomToast(getString(R.string.error_call_declined), Toast.LENGTH_LONG); - } else if (message != null && message.equals("Not Found")) { + } else if (message != null && call.getReason() == Reason.NotFound) { displayCustomToast(getString(R.string.error_user_not_found), Toast.LENGTH_LONG); - } else if (message != null && message.equals("Unsupported media type")) { + } else if (message != null && call.getReason() == Reason.Media) { displayCustomToast(getString(R.string.error_incompatible_media), Toast.LENGTH_LONG); } else if (message != null && state == State.Error) { displayCustomToast(getString(R.string.error_unknown) + " - " + message, Toast.LENGTH_LONG); @@ -259,7 +274,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene updateAnimationsState(); } - private void initButtons() { menu = (LinearLayout) findViewById(R.id.menu); mark = (LinearLayout) findViewById(R.id.mark); @@ -322,6 +336,10 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene findViewById(R.id.fragmentContainer).setPadding(0, LinphoneUtils.pixelsToDpi(getResources(), 40), 0, 0); } + public void isNewProxyConfig(){ + newProxyConfig = true; + } + private void changeCurrentFragment(FragmentsAvailable newFragmentType, Bundle extras) { changeCurrentFragment(newFragmentType, extras, false); } diff --git a/src/org/linphone/setup/SetupActivity.java b/src/org/linphone/setup/SetupActivity.java index a2f5bfedb..4cfce5d42 100644 --- a/src/org/linphone/setup/SetupActivity.java +++ b/src/org/linphone/setup/SetupActivity.java @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +import org.linphone.LinphoneActivity; import org.linphone.LinphoneManager; import org.linphone.LinphonePreferences; import org.linphone.LinphonePreferences.AccountBuilder; @@ -405,6 +406,7 @@ public class SetupActivity extends FragmentActivity implements OnClickListener { public void success() { mPrefs.firstLaunchSuccessful(); + LinphoneActivity.instance().isNewProxyConfig(); setResult(Activity.RESULT_OK); finish(); }