Add a configuration wizard.
Needs to improve the text.
--- a/AndroidManifest.xml Sat Mar 06 07:12:53 2010 +0100
+++ b/AndroidManifest.xml Sat Mar 06 07:38:45 2010 +0100
@@ -6,12 +6,14 @@
android:icon="@drawable/beem_launcher_icon_silver" android:theme="@style/Theme.BEEM.Default"
android:debuggable="true" android:name=".BeemApplication">
<activity android:name=".ui.Login" android:label="@string/app_name"
- android:screenOrientation="portrait" android:launchMode="singleTask">
+ android:screenOrientation="portrait" android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
+ <activity android:name=".ui.wizard.Account" android:label="Account wizard" />
+ <activity android:name=".ui.wizard.AccountConfigure" android:label="Account wizard" />
<activity android:name=".ui.LoginAnim" android:label="@string/login_login_progress"
android:launchMode="singleTop" android:screenOrientation="portrait" />
<activity android:name=".ui.Settings" android:label="@string/edit_settings_name">
@@ -91,4 +93,4 @@
<uses-sdk android:minSdkVersion="3" />
<supports-screens android:largeScreens="true"
android:normalScreens="true" android:smallScreens="true" android:anyDensity="true" />
-</manifest>
+</manifest>
Binary file res/drawable/bottombar.png has changed
Binary file res/drawable/button_indicator_next.png has changed
Binary file res/drawable/button_indicator_prev.png has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/wizard_account.xml Sat Mar 06 07:38:45 2010 +0100
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_height="fill_parent" android:layout_width="fill_parent"
+ >
+ <TextView android:id="@+id/wizard_account_tv"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:text="@string/account_wizard_text1"
+ android:textSize="18sp"
+ android:paddingBottom="10dip" />
+ <RadioGroup android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_below="@id/wizard_account_tv" >
+ <RadioButton android:id="@+id/configure_account"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/account_wizard_configure_account"/>
+ <RadioButton android:id="@+id/create_account"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/account_wizard_create_account"/>
+
+ </RadioGroup>
+
+ <RelativeLayout
+ android:layout_alignParentBottom="true"
+ android:gravity="right"
+ android:layout_height="wrap_content"
+ android:layout_width="fill_parent"
+ android:background="@drawable/bottombar" >
+ <Button
+ android:id="@+id/next"
+ android:text="suivant"
+ android:minWidth="100dp"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:drawableRight="@drawable/button_indicator_next"
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true"
+ />
+ </RelativeLayout>
+
+</RelativeLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/wizard_account.xml~ Sat Mar 06 07:38:45 2010 +0100
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_height="fill_parent" android:layout_width="fill_parent"
+ >
+ <TextView android:id="@+id/wizard_account_tv"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:text="@string/account_wizard_text1"
+ android:textSize="14sp"
+ android:paddingBottom="10dip" />
+ <RadioGroup android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_below="@id/wizard_account_tv" >
+ <RadioButton android:id="@+id/configure_account"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/account_wizard_configure_account"/>
+ <RadioButton android:id="@+id/create_account"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/account_wizard_create_account"/>
+
+ </RadioGroup>
+
+ <RelativeLayout
+ android:layout_alignParentBottom="true"
+ android:gravity="right"
+ android:layout_height="wrap_content"
+ android:layout_width="fill_parent"
+ android:background="@drawable/bottombar" >
+ <Button
+ android:id="@+id/next"
+ android:text="suivant"
+ android:minWidth="100dp"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:drawableRight="@drawable/button_indicator_next"
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true"
+ />
+ </RelativeLayout>
+
+</RelativeLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/wizard_account_configure.xml Sat Mar 06 07:38:45 2010 +0100
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_height="fill_parent" android:layout_width="fill_parent"
+ >
+ <TextView android:id="@+id/wizard_account_tv"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:text="@string/account_wizard_text1"
+ android:textSize="18sp"
+ android:paddingBottom="10dip" />
+
+ <TextView android:id="@+id/label_username"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_below="@id/wizard_account_tv"
+ android:text="@string/JabberID" style="@style/Label" />
+ <EditText android:id="@+id/account_username"
+ android:inputType="textEmailAddress" android:imeOptions="actionNext"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_below="@id/label_username"
+ android:singleLine="true"
+ android:hint="beem@beem-project.com "/>
+ <TextView android:id="@+id/label_password"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_below="@id/account_username"
+ android:text="@string/Password" style="@style/Label" />
+ <EditText android:id="@+id/account_password"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_below="@id/label_password"
+ android:inputType="textPassword" android:imeOptions="actionNext"
+ android:password="true" android:singleLine="true" />
+
+ <RelativeLayout
+ android:layout_alignParentBottom="true"
+ android:gravity="right"
+ android:layout_height="wrap_content"
+ android:layout_width="fill_parent"
+ android:background="@drawable/bottombar" >
+
+ <Button
+ android:id="@+id/manual_setup"
+ android:text="Configuration manuelle"
+ android:minWidth="100dp"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ />
+
+ <Button
+ android:id="@+id/next"
+ android:text="suivant"
+ android:minWidth="100dp"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:drawableRight="@drawable/button_indicator_next"
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true"
+ android:enabled="false"
+ />
+ </RelativeLayout>
+
+</RelativeLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/wizard_account_configure.xml~ Sat Mar 06 07:38:45 2010 +0100
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_height="fill_parent" android:layout_width="fill_parent"
+ >
+ <TextView android:id="@+id/wizard_account_tv"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:text="@string/account_wizard_text1"
+ android:textSize="18sp"
+ android:paddingBottom="10dip" />
+
+ <TextView android:id="@+id/label_username"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_below="@id/wizard_account_tv"
+ android:text="@string/JabberID" style="@style/Label" />
+ <EditText android:id="@+id/account_username"
+ android:inputType="textEmailAddress" android:imeOptions="actionNext"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_below="@id/label_username"
+ android:singleLine="true"
+ android:hint="beem@beem-project.com "/>
+ <TextView android:id="@+id/label_password"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_below="@id/account_username"
+ android:text="@string/Password" style="@style/Label" />
+ <EditText android:id="@+id/account_password"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_below="@id/label_password"
+ android:inputType="textPassword" android:imeOptions="actionNext"
+ android:password="true" android:singleLine="true" />
+
+ <RelativeLayout
+ android:layout_alignParentBottom="true"
+ android:gravity="right"
+ android:layout_height="wrap_content"
+ android:layout_width="fill_parent"
+ android:background="@drawable/bottombar" >
+
+ <Button
+ android:id="@+id/manual_setup"
+ android:text="Configuration manuelle"
+ android:minWidth="100dp"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ />
+
+ <Button
+ android:id="@+id/next"
+ android:text="suivant"
+ android:minWidth="100dp"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:drawableRight="@drawable/button_indicator_next"
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true"
+ android:enable="false"
+ />
+ </RelativeLayout>
+
+</RelativeLayout>
--- a/res/values-fr/strings.xml Sat Mar 06 07:12:53 2010 +0100
+++ b/res/values-fr/strings.xml Sat Mar 06 07:38:45 2010 +0100
@@ -1,11 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
+ <!-- Generic terms -->
<string name="app_name">Beem</string>
<string name="OkButton">Valider</string>
<string name="ClearButton">Effacer</string>
<string name="CancelButton">Annuler</string>
<string name="AcceptButton">Autoriser</string>
<string name="RefuseButton">Refuser</string>
+ <string name="JabberID">Jabber ID</string>
+ <string name="Password">Mot de passe</string>
<!-- Beem class -->
<string name="BeemJabberID">Jabber ID</string>
@@ -230,6 +233,11 @@
<string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
<string name="settings_tab_label_proxy">Proxy</string>
+ <!-- wizard activities -->
+ <string name="account_wizard_text1"><b>Bienvenue sur BEEM.</b>\n\nVous n\'avez pas encore configuré de compte XMPP (Jabber).\nChoisissez une des options suivantes :</string>
+ <string name="account_wizard_configure_account">Je possède déjà un compte que je veux utiliser.</string>
+ <string name="account_wizard_create_account">Je veux créer un nouveau compte</string>
+
<!--
Create an account Activity
-->
@@ -301,9 +309,7 @@
<string name="UpdateButton">Mettre à jour</string>
<!-- Error messages -->
-
<string name="error_login_authentication">Erreur lors de l\'authenfitication, mauvais login ou password</string>
-
<string name="interna_server_error">Erreur survenu sur le serveur</string>
<string name="bad_request">bad-request</string>
<string name="forbidden">forbidden</string>
--- a/res/values/strings.xml Sat Mar 06 07:12:53 2010 +0100
+++ b/res/values/strings.xml Sat Mar 06 07:38:45 2010 +0100
@@ -1,11 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
+ <!-- Generic terms -->
<string name="app_name">Beem</string>
<string name="OkButton">Ok</string>
<string name="ClearButton">Clear</string>
<string name="CancelButton">Cancel</string>
<string name="AcceptButton">Authorize</string>
<string name="RefuseButton">Deny</string>
+ <string name="JabberID">Jabber ID</string>
+ <string name="Password">Password</string>
<!-- Beem class -->
<string name="BeemJabberID">Jabber ID</string>
@@ -220,11 +223,11 @@
<string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
<string name="settings_tab_label_proxy">Proxy</string>
- <!-- EditSettings Activity General Preferences Tabs -->
-
-
-
+ <!-- wizard activities -->
+ <string name="account_wizard_text1"><b>Welcome on BEEM.</b>\n\nYou have not configured an XMPPP (Jabber) account yet.\nChoose one of the following options :</string>
+ <string name="account_wizard_configure_account">I already have an account I want to use</string>
+ <string name="account_wizard_create_account">I want to register for a new account</string>
<!-- Create an account Activity -->
<string name="create_account_instr_dialog_title">Create an account - Instructions</string>
--- a/src/com/beem/project/beem/ui/Login.java Sat Mar 06 07:12:53 2010 +0100
+++ b/src/com/beem/project/beem/ui/Login.java Sat Mar 06 07:38:45 2010 +0100
@@ -62,6 +62,7 @@
import com.beem.project.beem.R;
import com.beem.project.beem.utils.BeemConnectivity;
import com.beem.project.beem.BeemApplication;
+import com.beem.project.beem.ui.wizard.Account;
/**
* This class is the main Activity for the Beem project.
@@ -91,6 +92,9 @@
if (mBeemApplication.isConnected()) {
startActivity(new Intent(this, ContactList.class));
finish();
+ } else if (!mBeemApplication.isAccountConfigured()) {
+ startActivity(new Intent(this, Account.class));
+ finish();
}
}
setContentView(R.layout.login);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/wizard/Account.java Sat Mar 06 07:38:45 2010 +0100
@@ -0,0 +1,99 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.ui.wizard;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.RadioButton;
+
+import com.beem.project.beem.ui.CreateAccount;
+import com.beem.project.beem.R;
+
+/**
+ * The first activity of an user friendly wizard to configure a XMPP account.
+ *
+ * @author Da Risk <darisk972@gmail.com>
+ */
+public class Account extends Activity implements OnClickListener {
+
+ private RadioButton mConfigureAccount;
+ private RadioButton mCreateAccount;
+ private Button mNextButton;
+
+ /**
+ * Constructor.
+ */
+ public Account() {
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.wizard_account);
+ mConfigureAccount = (RadioButton) findViewById(R.id.configure_account);
+ mCreateAccount = (RadioButton) findViewById(R.id.create_account);
+ mNextButton = (Button) findViewById(R.id.next);
+ mNextButton.setOnClickListener(this);
+ }
+
+ @Override
+ public void onClick(View v) {
+ if (v == mNextButton) {
+ Intent i = null;
+ if (mConfigureAccount.isChecked()) {
+ i = new Intent(this, AccountConfigure.class);
+ finish();
+ } else if (mCreateAccount.isChecked()) {
+ i = new Intent(this, CreateAccount.class);
+ }
+ if (i != null) {
+ startActivity(i);
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/wizard/AccountConfigure.java Sat Mar 06 07:38:45 2010 +0100
@@ -0,0 +1,199 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.ui.wizard;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.preference.PreferenceManager;
+import android.widget.Button;
+import android.widget.EditText;
+import android.text.Editable;
+import android.text.InputFilter;
+import android.text.LoginFilter;
+import android.text.TextWatcher;
+
+import org.jivesoftware.smack.util.StringUtils;
+
+import com.beem.project.beem.ui.Login;
+import com.beem.project.beem.ui.Settings;
+import com.beem.project.beem.R;
+
+/**
+ * Activity to enter the information required in order to configure a XMPP account.
+ *
+ * @author Da Risk <darisk972@gmail.com>
+ */
+public class AccountConfigure extends Activity implements OnClickListener {
+
+ private Button mNextButton;
+ private Button mManualConfigButton;
+ private EditText mAccountJID;
+ private EditText mAccountPassword;
+ private final JidTextWatcher mJidTextWatcher = new JidTextWatcher();
+ private final PasswordTextWatcher mPasswordTextWatcher = new PasswordTextWatcher();
+ private boolean mValidJid;
+ private boolean mValidPassword;
+
+ /**
+ * Constructor.
+ */
+ public AccountConfigure() {
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.wizard_account_configure);
+ mManualConfigButton = (Button) findViewById(R.id.manual_setup);
+ mManualConfigButton.setOnClickListener(this);
+ mNextButton = (Button) findViewById(R.id.next);
+ mNextButton.setOnClickListener(this);
+ mAccountJID = (EditText) findViewById(R.id.account_username);
+ mAccountPassword = (EditText) findViewById(R.id.account_password);
+
+
+ InputFilter[] orgFilters = mAccountJID.getFilters();
+ InputFilter[] newFilters = new InputFilter[orgFilters.length + 1];
+ int i;
+ for (i = 0; i < orgFilters.length; i++)
+ newFilters[i] = orgFilters[i];
+ newFilters[i] = new LoginFilter.UsernameFilterGeneric();
+ mAccountJID.setFilters(newFilters);
+ mAccountJID.addTextChangedListener(mJidTextWatcher);
+ mAccountPassword.addTextChangedListener(mPasswordTextWatcher);
+ }
+
+ @Override
+ public void onClick(View v) {
+ Intent i = null;
+ if (v == mNextButton) {
+ configureAccount();
+ i = new Intent(this, Login.class);
+ } else if (v == mManualConfigButton) {
+ i = new Intent(this, Settings.class);
+ }
+ if (i != null) {
+ i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ startActivity(i);
+ finish();
+ }
+ }
+
+ /**
+ * Store the account in the settings.
+ */
+ private void configureAccount() {
+ SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
+ SharedPreferences.Editor edit = settings.edit();
+ edit.putString("settings_key_account_username", mAccountJID.getText().toString());
+ edit.putString("settings_key_account_password", mAccountPassword.getText().toString());
+ edit.putBoolean("PreferenceIsConfigured", true);
+ edit.commit();
+ }
+
+ /**
+ * Text watcher to test the existence of a password.
+ */
+ private class PasswordTextWatcher implements TextWatcher {
+
+ /**
+ * Constructor.
+ */
+ public PasswordTextWatcher() {
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ if (s.length() > 0)
+ mValidPassword = true;
+ else
+ mValidPassword = false;
+ mNextButton.setEnabled(mValidJid && mValidPassword);
+ }
+
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+ }
+
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+ }
+ }
+
+ /**
+ * TextWatcher to check the validity of a JID.
+ */
+ private class JidTextWatcher implements TextWatcher {
+
+ /**
+ * Constructor.
+ */
+ public JidTextWatcher() {
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ String name = StringUtils.parseName(s.toString());
+ String server = StringUtils.parseServer(s.toString());
+ if (name == null || "".equals(name) || server == null || "".equals(server)) {
+ mValidJid = false;
+ } else {
+ mValidJid = true;
+ }
+ mNextButton.setEnabled(mValidJid && mValidPassword);
+ }
+
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+ }
+
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+ }
+ }
+}