diff --git a/res/layout/first_login_view.xml b/res/layout/first_login_view.xml
index 0bfb393c5..225263010 100644
--- a/res/layout/first_login_view.xml
+++ b/res/layout/first_login_view.xml
@@ -2,20 +2,32 @@
-
-
-
-
-
+
-
-
-
-
+
-
+
+
+
+
+
+
+
- // Some moving widget
\ No newline at end of file
diff --git a/res/values/non_localizable_strings.xml b/res/values/non_localizable_strings.xml
index 8a196b479..403bf0a51 100644
--- a/res/values/non_localizable_strings.xml
+++ b/res/values/non_localizable_strings.xml
@@ -1,5 +1,13 @@
+
+
+
+ test.linphone.org
+
+
+
+
pref_prefix_key
pref_proxy_key
pref_domain_key
@@ -29,5 +37,4 @@
pref_codecs_key
pref_stun_server_key
- test.linphone.org
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9e6862f72..18b8987bb 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1,5 +1,20 @@
+
+
+
+ RelTime
+
+
+
+
+ Registration successful
+ Error
+ Start
+ Application not ready
+
+
+
pref_echo_canceller_calibration_key
Echo calibration
Use front camera
@@ -53,7 +68,6 @@
Password*
Username*
Hello World, Linphone!
-Linphone
SIP Account
wrong user name
wrong password
diff --git a/src/org/linphone/FirstLoginActivity.java b/src/org/linphone/FirstLoginActivity.java
index 0b501a8a2..4a6b9dbce 100644
--- a/src/org/linphone/FirstLoginActivity.java
+++ b/src/org/linphone/FirstLoginActivity.java
@@ -21,13 +21,15 @@ package org.linphone;
import org.linphone.core.LinphoneCore.RegistrationState;
import android.app.Activity;
+import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
-import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
@@ -36,6 +38,7 @@ public class FirstLoginActivity extends Activity implements OnClickListener {
private TextView login;
private TextView password;
private SharedPreferences mPref;
+ private ProgressBar bar;
static FirstLoginActivity instance;
@Override
@@ -47,8 +50,14 @@ public class FirstLoginActivity extends Activity implements OnClickListener {
login = (TextView) findViewById(R.id.login);
login.setText(mPref.getString(getString(R.string.pref_username_key), ""));
- password = (TextView) findViewById(R.id.password);
+ password = (TextView) findViewById(R.id.password);
+ password.setText(mPref.getString(getString(R.string.pref_passwd_key), ""));
+
+ bar = (ProgressBar) findViewById(R.id.progress_bar);
+ bar.setVisibility(View.INVISIBLE);
+
+
findViewById(R.id.connect).setOnClickListener(this);
instance = this;
}
@@ -67,6 +76,9 @@ public class FirstLoginActivity extends Activity implements OnClickListener {
return;
}
+ InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
+ imm.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), 0);
+
writePreference(R.string.pref_username_key, login.getText().toString());
writePreference(R.string.pref_passwd_key, password.getText().toString());
@@ -74,6 +86,7 @@ public class FirstLoginActivity extends Activity implements OnClickListener {
LinphoneManager.getInstance().initFromConf(getApplicationContext());
} catch (Throwable e) {
Log.e(LinphoneManager.TAG, "Error while initializing from config in first login activity", e);
+ toast(R.string.error);;
}
}
@@ -91,10 +104,16 @@ public class FirstLoginActivity extends Activity implements OnClickListener {
public void onRegistrationStateChanged(RegistrationState state) {
if (RegistrationState.RegistrationOk == state) {
+ bar.setVisibility(View.INVISIBLE);
+ toast(R.string.first_launch_ok);
mPref.edit().putBoolean(getString(R.string.first_launch_suceeded_once_key), true).commit();
+ setResult(RESULT_OK);
finish();
} else if (RegistrationState.RegistrationFailed == state) {
- toast(R.string.first_launch_bad_login_password);
+ bar.setVisibility(View.INVISIBLE);
+ toast(R.string.first_launch_bad_login_password);
+ } else if (RegistrationState.RegistrationProgress == state) {
+ bar.setVisibility(View.VISIBLE);
}
}
@@ -102,13 +121,4 @@ public class FirstLoginActivity extends Activity implements OnClickListener {
Toast.makeText(instance, instance.getString(key), Toast.LENGTH_LONG).show();
}
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
- // Forbid user to press back button
- return true;
- }
-
- return super.onKeyDown(keyCode, event);
- }
}
diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java
index b7a98d6eb..c8876cad0 100644
--- a/src/org/linphone/LinphoneActivity.java
+++ b/src/org/linphone/LinphoneActivity.java
@@ -20,7 +20,10 @@ package org.linphone;
import static android.content.Intent.ACTION_MAIN;
-import static android.media.AudioManager.*;
+import static android.media.AudioManager.MODE_NORMAL;
+import static android.media.AudioManager.ROUTE_ALL;
+import static android.media.AudioManager.ROUTE_SPEAKER;
+
import java.util.List;
import org.linphone.core.Version;
@@ -48,10 +51,12 @@ import android.view.View;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.TabHost;
-
+import android.widget.Toast;
+
public class LinphoneActivity extends TabActivity {
public static final String DIALER_TAB = "dialer";
private AudioManager mAudioManager;
+
private static LinphoneActivity instance;
private FrameLayout mMainFrame;
@@ -109,7 +114,12 @@ public class LinphoneActivity extends TabActivity {
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == FIRST_LOGIN_ACTIVITY) {
- fillTabHost();
+ if (resultCode == RESULT_OK) {
+ fillTabHost();
+ } else {
+ finish();
+ stopService(new Intent(ACTION_MAIN).setClass(this, LinphoneService.class));
+ }
}
super.onActivityResult(requestCode, resultCode, data);
@@ -160,7 +170,11 @@ public class LinphoneActivity extends TabActivity {
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (intent.getData() != null) {
- DialerActivity.instance().newOutgoingCall(intent);
+ if (DialerActivity.instance() != null) {
+ DialerActivity.instance().newOutgoingCall(intent);
+ } else {
+ Toast.makeText(this, getString(R.string.dialer_null_on_new_intent), Toast.LENGTH_LONG).show();
+ }
}
}