Import enhance UI for first_login_view
This commit is contained in:
parent
0f4d2fed7d
commit
be7faa516e
5 changed files with 86 additions and 29 deletions
|
@ -2,20 +2,32 @@
|
||||||
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
|
||||||
a:layout_width="fill_parent" a:layout_height="fill_parent" a:orientation="vertical">
|
a:layout_width="fill_parent" a:layout_height="fill_parent" a:orientation="vertical">
|
||||||
|
|
||||||
<TextView a:text="@string/first_login_explanation" a:layout_width="fill_parent" a:layout_height="wrap_content" a:layout_marginBottom="20px"/>
|
|
||||||
|
|
||||||
<LinearLayout a:layout_width="fill_parent" a:layout_height="wrap_content">
|
<EditText a:id="@+id/login"
|
||||||
<TextView a:text="@string/first_login_username" a:layout_width="wrap_content" a:layout_height="wrap_content" />
|
a:hint="@string/first_login_username"
|
||||||
<EditText a:id="@+id/login" a:layout_width="fill_parent" a:layout_height="wrap_content" />
|
a:layout_width="wrap_content" a:layout_height="wrap_content"
|
||||||
</LinearLayout>
|
a:layout_marginTop="20sp" a:layout_marginRight="15sp" a:layout_gravity="right"
|
||||||
|
a:width="180sp"/>
|
||||||
|
|
||||||
<LinearLayout a:layout_width="fill_parent" a:layout_height="wrap_content">
|
<EditText a:id="@+id/password" a:password="true"
|
||||||
<TextView a:text="@string/first_login_password" a:layout_width="wrap_content" a:layout_height="wrap_content"/>
|
a:hint="@string/first_login_password"
|
||||||
<EditText a:id="@+id/password" a:password="true" a:layout_width="fill_parent" a:layout_height="wrap_content" />
|
a:layout_width="wrap_content" a:layout_height="wrap_content"
|
||||||
</LinearLayout>
|
a:layout_marginTop="10sp" a:layout_marginRight="15sp" a:layout_gravity="right"
|
||||||
|
a:width="180sp"/>
|
||||||
|
|
||||||
<Button a:id="@+id/connect" a:text="@string/first_login_connect" a:layout_width="fill_parent" a:layout_height="wrap_content" a:layout_marginTop="20px"/>
|
<Button a:id="@+id/connect" a:text="@string/first_login_connect"
|
||||||
|
a:layout_width="wrap_content" a:layout_height="wrap_content"
|
||||||
|
a:layout_marginTop="20sp" a:layout_marginRight="15sp" a:layout_gravity="right"
|
||||||
|
a:width="180sp"/>
|
||||||
|
|
||||||
|
<View a:layout_width="wrap_content" a:layout_height="wrap_content" a:layout_weight="1" />
|
||||||
|
|
||||||
|
<ProgressBar a:id="@+id/progress_bar"
|
||||||
|
a:layout_width="wrap_content" a:layout_height="wrap_content"
|
||||||
|
a:layout_gravity="center|bottom" a:layout_marginTop="50sp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<View a:layout_width="wrap_content" a:layout_height="wrap_content" a:layout_weight="1" />
|
||||||
|
|
||||||
// Some moving widget
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -1,5 +1,13 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Custom start -->
|
||||||
|
<string name="default_domain">test.linphone.org</string>
|
||||||
|
|
||||||
|
<!-- Custom end -->
|
||||||
|
|
||||||
|
|
||||||
<string name="pref_prefix_key">pref_prefix_key</string>
|
<string name="pref_prefix_key">pref_prefix_key</string>
|
||||||
<string name="pref_proxy_key">pref_proxy_key</string>
|
<string name="pref_proxy_key">pref_proxy_key</string>
|
||||||
<string name="pref_domain_key">pref_domain_key</string>
|
<string name="pref_domain_key">pref_domain_key</string>
|
||||||
|
@ -29,5 +37,4 @@
|
||||||
<string name="pref_codecs_key">pref_codecs_key</string>
|
<string name="pref_codecs_key">pref_codecs_key</string>
|
||||||
<string name="pref_stun_server_key">pref_stun_server_key</string>
|
<string name="pref_stun_server_key">pref_stun_server_key</string>
|
||||||
|
|
||||||
<string name="default_domain">test.linphone.org</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,5 +1,20 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Custom start -->
|
||||||
|
<string name="app_name">RelTime</string>
|
||||||
|
|
||||||
|
<!-- Custom end -->
|
||||||
|
|
||||||
|
|
||||||
|
<string name="first_launch_ok">Registration successful</string>
|
||||||
|
<string name="error">Error</string>
|
||||||
|
<string name="click_to_show_first_login_view">Start</string>
|
||||||
|
<string name="dialer_null_on_new_intent">Application not ready</string>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<string name="pref_echo_canceller_calibration_key">pref_echo_canceller_calibration_key</string>
|
<string name="pref_echo_canceller_calibration_key">pref_echo_canceller_calibration_key</string>
|
||||||
<string name="pref_echo_canceller_calibration">Echo calibration</string>
|
<string name="pref_echo_canceller_calibration">Echo calibration</string>
|
||||||
<string name="pref_video_use_front_camera_title">Use front camera</string>
|
<string name="pref_video_use_front_camera_title">Use front camera</string>
|
||||||
|
@ -53,7 +68,6 @@
|
||||||
<string name="pref_passwd">Password*</string>
|
<string name="pref_passwd">Password*</string>
|
||||||
<string name="pref_username">Username*</string>
|
<string name="pref_username">Username*</string>
|
||||||
<string name="hello">Hello World, Linphone!</string>
|
<string name="hello">Hello World, Linphone!</string>
|
||||||
<string name="app_name">Linphone</string>
|
|
||||||
<string name="pref_sipaccount">SIP Account</string>
|
<string name="pref_sipaccount">SIP Account</string>
|
||||||
<string name="wrong_username">wrong user name</string>
|
<string name="wrong_username">wrong user name</string>
|
||||||
<string name="wrong_passwd">wrong password</string>
|
<string name="wrong_passwd">wrong password</string>
|
||||||
|
|
|
@ -21,13 +21,15 @@ package org.linphone;
|
||||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
@ -36,6 +38,7 @@ public class FirstLoginActivity extends Activity implements OnClickListener {
|
||||||
private TextView login;
|
private TextView login;
|
||||||
private TextView password;
|
private TextView password;
|
||||||
private SharedPreferences mPref;
|
private SharedPreferences mPref;
|
||||||
|
private ProgressBar bar;
|
||||||
static FirstLoginActivity instance;
|
static FirstLoginActivity instance;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -47,7 +50,13 @@ public class FirstLoginActivity extends Activity implements OnClickListener {
|
||||||
|
|
||||||
login = (TextView) findViewById(R.id.login);
|
login = (TextView) findViewById(R.id.login);
|
||||||
login.setText(mPref.getString(getString(R.string.pref_username_key), ""));
|
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);
|
findViewById(R.id.connect).setOnClickListener(this);
|
||||||
instance = this;
|
instance = this;
|
||||||
|
@ -67,6 +76,9 @@ public class FirstLoginActivity extends Activity implements OnClickListener {
|
||||||
return;
|
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_username_key, login.getText().toString());
|
||||||
writePreference(R.string.pref_passwd_key, password.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());
|
LinphoneManager.getInstance().initFromConf(getApplicationContext());
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.e(LinphoneManager.TAG, "Error while initializing from config in first login activity", 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) {
|
public void onRegistrationStateChanged(RegistrationState state) {
|
||||||
if (RegistrationState.RegistrationOk == 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();
|
mPref.edit().putBoolean(getString(R.string.first_launch_suceeded_once_key), true).commit();
|
||||||
|
setResult(RESULT_OK);
|
||||||
finish();
|
finish();
|
||||||
} else if (RegistrationState.RegistrationFailed == state) {
|
} else if (RegistrationState.RegistrationFailed == state) {
|
||||||
|
bar.setVisibility(View.INVISIBLE);
|
||||||
toast(R.string.first_launch_bad_login_password);
|
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();
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,10 @@ package org.linphone;
|
||||||
|
|
||||||
|
|
||||||
import static android.content.Intent.ACTION_MAIN;
|
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 java.util.List;
|
||||||
|
|
||||||
import org.linphone.core.Version;
|
import org.linphone.core.Version;
|
||||||
|
@ -48,10 +51,12 @@ import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.TabHost;
|
import android.widget.TabHost;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class LinphoneActivity extends TabActivity {
|
public class LinphoneActivity extends TabActivity {
|
||||||
public static final String DIALER_TAB = "dialer";
|
public static final String DIALER_TAB = "dialer";
|
||||||
private AudioManager mAudioManager;
|
private AudioManager mAudioManager;
|
||||||
|
|
||||||
private static LinphoneActivity instance;
|
private static LinphoneActivity instance;
|
||||||
|
|
||||||
private FrameLayout mMainFrame;
|
private FrameLayout mMainFrame;
|
||||||
|
@ -109,7 +114,12 @@ public class LinphoneActivity extends TabActivity {
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
|
||||||
if (requestCode == FIRST_LOGIN_ACTIVITY) {
|
if (requestCode == FIRST_LOGIN_ACTIVITY) {
|
||||||
|
if (resultCode == RESULT_OK) {
|
||||||
fillTabHost();
|
fillTabHost();
|
||||||
|
} else {
|
||||||
|
finish();
|
||||||
|
stopService(new Intent(ACTION_MAIN).setClass(this, LinphoneService.class));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
@ -160,7 +170,11 @@ public class LinphoneActivity extends TabActivity {
|
||||||
protected void onNewIntent(Intent intent) {
|
protected void onNewIntent(Intent intent) {
|
||||||
super.onNewIntent(intent);
|
super.onNewIntent(intent);
|
||||||
if (intent.getData() != null) {
|
if (intent.getData() != null) {
|
||||||
|
if (DialerActivity.instance() != null) {
|
||||||
DialerActivity.instance().newOutgoingCall(intent);
|
DialerActivity.instance().newOutgoingCall(intent);
|
||||||
|
} else {
|
||||||
|
Toast.makeText(this, getString(R.string.dialer_null_on_new_intent), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue