Improve account wizard
authorDa Risk <darisk972@gmail.com>
Sun, 07 Mar 2010 21:33:13 +0100
changeset 703 8cd09cb7b00b
parent 702 f30ae9c4051e
child 704 e310d3275d5d
child 706 bc47c8518bfd
Improve account wizard
res/layout/login.xml
res/layout/wizard_account.xml
res/layout/wizard_account.xml~
res/layout/wizard_account_configure.xml
res/layout/wizard_account_configure.xml~
res/values-fr/strings.xml
res/values/strings.xml
src/com/beem/project/beem/ui/wizard/Account.java
--- a/res/layout/login.xml	Sun Mar 07 07:31:24 2010 +0100
+++ b/res/layout/login.xml	Sun Mar 07 21:33:13 2010 +0100
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-	android:layout_width="fill_parent" android:layout_height="fill_parent"
-	android:orientation="vertical">
+    android:layout_width="fill_parent" android:layout_height="fill_parent" >
 	<LinearLayout android:orientation="vertical"
 		android:layout_width="fill_parent" android:layout_height="wrap_content">
 		<ImageView android:id="@+id/log_as_logo" android:src="@drawable/logo"
--- a/res/layout/wizard_account.xml	Sun Mar 07 07:31:24 2010 +0100
+++ b/res/layout/wizard_account.xml	Sun Mar 07 21:33:13 2010 +0100
@@ -1,27 +1,37 @@
 <?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_height="fill_parent" android:layout_width="fill_parent"
+    android:orientation="vertical"
     >
-    <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>
+    <ScrollView android:layout_height="fill_parent" android:layout_width="fill_parent" 
+	android:layout_weight="1">
+	<LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent"
+	    android:orientation="vertical" >
+	    <ImageView android:id="@+id/logo"
+		android:layout_width="fill_parent" android:layout_height="wrap_content"
+		android:layout_marginTop="15dp"
+		android:layout_marginBottom="30dp"
+		android:src="@drawable/logo"/>
+	    <TextView
+		android:layout_width="fill_parent" android:layout_height="wrap_content"
+		android:text="@string/account_wizard_text1"
+		android:textSize="18sp"
+		android:paddingBottom="10dip" />
+	    <RadioGroup android:id="@+id/configure_group"
+		android:layout_width="fill_parent" android:layout_height="wrap_content" >
+		<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>
+	</LinearLayout>
+    </ScrollView>
 
     <RelativeLayout
 	android:layout_alignParentBottom="true"
-	android:gravity="right" 
+	android:gravity="right|center_vertical"
 	android:layout_height="wrap_content"
 	android:layout_width="fill_parent"
 	android:background="@drawable/bottombar" >
@@ -34,7 +44,8 @@
 	    android:drawableRight="@drawable/button_indicator_next"
 	    android:layout_alignParentRight="true"
 	    android:layout_centerVertical="true"
+	    android:enabled="false"
 	    />
     </RelativeLayout>
 
-</RelativeLayout>
+</LinearLayout>
--- a/res/layout/wizard_account.xml~	Sun Mar 07 07:31:24 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-<?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>
--- a/res/layout/wizard_account_configure.xml	Sun Mar 07 07:31:24 2010 +0100
+++ b/res/layout/wizard_account_configure.xml	Sun Mar 07 21:33:13 2010 +0100
@@ -1,33 +1,39 @@
 <?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout 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" />
+    android:orientation="vertical" >
+    <ScrollView android:layout_height="fill_parent" android:layout_width="fill_parent" 
+	android:layout_weight="1">
+	<LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent"
+	    android:orientation="vertical" >
+	    <ImageView android:id="@+id/logo"
+		android:layout_width="fill_parent" android:layout_height="wrap_content"
+		android:layout_marginTop="15dp"
+		android:layout_marginBottom="30dp"
+		android:src="@drawable/logo"/>
+	    <TextView
+		android:layout_width="fill_parent" android:layout_height="wrap_content"
+		android:layout_alignParentTop="true"
+		android:text="@string/account_wizard_configure_text"
+		android:textSize="18sp"
+		android:paddingBottom="10dip" />
+	    <TextView
+		android:layout_width="fill_parent" android:layout_height="wrap_content"
+		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:singleLine="true" 
+		android:hint="beem@beem-project.com "/>
+	    <TextView
+		android:layout_width="fill_parent" android:layout_height="wrap_content"
+		android:text="@string/Password" style="@style/Label" />
+	    <EditText android:id="@+id/account_password"
+		android:layout_width="fill_parent" android:layout_height="wrap_content"
+		android:inputType="textPassword" android:imeOptions="actionNext"
+		android:password="true" android:singleLine="true" />
+	</LinearLayout>
+    </ScrollView>
 
     <RelativeLayout
 	android:layout_alignParentBottom="true"
@@ -59,4 +65,4 @@
 	    />
     </RelativeLayout>
 
-</RelativeLayout>
+</LinearLayout>
--- a/res/layout/wizard_account_configure.xml~	Sun Mar 07 07:31:24 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-<?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	Sun Mar 07 07:31:24 2010 +0100
+++ b/res/values-fr/strings.xml	Sun Mar 07 21:33:13 2010 +0100
@@ -235,6 +235,7 @@
 
 	<!-- 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_text"><b>Remplissez les informations pour votre compte</b></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>
 
--- a/res/values/strings.xml	Sun Mar 07 07:31:24 2010 +0100
+++ b/res/values/strings.xml	Sun Mar 07 21:33:13 2010 +0100
@@ -226,6 +226,7 @@
 
 	<!-- 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_text"><b>Please fill in the data for your existing account</b></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>
 
--- a/src/com/beem/project/beem/ui/wizard/Account.java	Sun Mar 07 07:31:24 2010 +0100
+++ b/src/com/beem/project/beem/ui/wizard/Account.java	Sun Mar 07 21:33:13 2010 +0100
@@ -49,7 +49,7 @@
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.Button;
-import android.widget.RadioButton;
+import android.widget.RadioGroup;
 
 import com.beem.project.beem.ui.CreateAccount;
 import com.beem.project.beem.R;
@@ -59,10 +59,9 @@
  *
  * @author Da Risk <darisk972@gmail.com>
  */
-public class Account extends Activity implements OnClickListener {
+public class Account extends Activity implements OnClickListener, RadioGroup.OnCheckedChangeListener {
 
-    private RadioButton mConfigureAccount;
-    private RadioButton mCreateAccount;
+    private RadioGroup mConfigureGroup;
     private Button mNextButton;
 
     /**
@@ -75,8 +74,8 @@
     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);
+	mConfigureGroup = (RadioGroup) findViewById(R.id.configure_group);
+	mConfigureGroup.setOnCheckedChangeListener(this);
 	mNextButton = (Button) findViewById(R.id.next);
 	mNextButton.setOnClickListener(this);
     }
@@ -84,11 +83,12 @@
     @Override
     public void onClick(View v) {
 	if (v == mNextButton) {
+	    int selectedid = mConfigureGroup.getCheckedRadioButtonId();
 	    Intent i = null;
-	    if (mConfigureAccount.isChecked()) {
+	    if (selectedid == R.id.configure_account) {
 		i = new Intent(this, AccountConfigure.class);
 		finish();
-	    } else if (mCreateAccount.isChecked()) {
+	    } else if (selectedid == R.id.create_account) {
 		i = new Intent(this, CreateAccount.class);
 	    }
 	    if (i != null) {
@@ -96,4 +96,12 @@
 	    }
 	}
     }
+
+    @Override
+    public void onCheckedChanged(RadioGroup  group, int checkedId) {
+	if (checkedId == -1)
+	    mNextButton.setEnabled(false);
+	else
+	    mNextButton.setEnabled(true);
+    }
 }