Merge
authormarseille@marseille-desktop
Sat, 21 Mar 2009 00:00:14 +0100
changeset 24 b915994d895e
parent 23 b6f30d35ea22 (diff)
parent 20 55868b881f04 (current diff)
child 28 5b42427793c5
child 33 0e65d5f55d2f
Merge
src/com/beem/project/beem/Beem.java
--- a/AndroidManifest.xml	Fri Mar 20 14:25:25 2009 +0100
+++ b/AndroidManifest.xml	Sat Mar 21 00:00:14 2009 +0100
@@ -1,22 +1,26 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-      package="com.beem.project.beem"
-      android:versionCode="1"
-      android:versionName="1.0">
-    <application android:label="@string/app_name">
-        <activity android:name=".Beem"
-                  android:label="@string/app_name">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    <service android:name="BeemService" android:enabled="true" android:label="Beem Service" android:permission="com.beem.project.beem.BEEM_SERVICE"><intent-filter><action android:name="com.beem.project.beem.BeemService"></action>
-</intent-filter>
-</service>
-</application>
-<permission android:permissionGroup="android.permission-group.NETWORK" android:label="BeemService" android:description="@string/BeemServiceDescription" android:name="com.beem.project.beem.BEEM_SERVICE"></permission>
-<uses-permission android:name="android.permission.INTERNET"></uses-permission>
-<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
-<uses-permission android:name="com.beem.project.beem.BEEM_SERVICE"></uses-permission>
+	package="com.beem.project.beem" android:versionCode="1"
+	android:versionName="1.0">
+	<application android:label="@string/app_name">
+		<activity android:name=".ui.Beem" android:label="@string/app_name">
+			<intent-filter>
+				<action android:name="android.intent.action.MAIN" />
+				<category android:name="android.intent.category.LAUNCHER" />
+			</intent-filter>
+		</activity>
+		<activity android:name=".ui.ContactList" android:label="@string/app_name" />
+		<service android:name="BeemService" android:enabled="true"
+			android:label="Beem Service" android:permission="com.beem.project.beem.BEEM_SERVICE">
+			<intent-filter>
+				<action android:name="com.beem.project.beem.BeemService"></action>
+			</intent-filter>
+		</service>
+	</application>
+	<permission android:permissionGroup="android.permission-group.NETWORK"
+		android:label="BeemService" android:description="@string/BeemServiceDescription"
+		android:name="com.beem.project.beem.BEEM_SERVICE"></permission>
+	<uses-permission android:name="android.permission.INTERNET"></uses-permission>
+	<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
+	<uses-permission android:name="com.beem.project.beem.BEEM_SERVICE"></uses-permission>
 </manifest> 
Binary file res/drawable/avatar.png has changed
Binary file res/drawable/bart.jpg has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/beem.xml	Sat Mar 21 00:00:14 2009 +0100
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+	android:orientation="vertical"
+	android:layout_width="fill_parent"
+	android:layout_height="fill_parent">
+
+	<ImageView android:id="@+id/logo"
+		android:src="@drawable/logo"
+		android:adjustViewBounds="true"
+		android:layout_width="wrap_content"
+		android:layout_height="wrap_content"/>
+		
+	<TextView android:text="@string/BeemJabberID"
+		android:textSize="25sp"
+		android:paddingLeft="100sp"
+		android:paddingTop="50sp"
+		android:paddingBottom="15sp"
+		android:layout_width="fill_parent"
+		android:layout_height="wrap_content" />
+		
+	<ImageView android:id="@+id/avatar"
+		android:src="@drawable/bart"
+		android:paddingTop="10sp"
+		android:paddingBottom="10sp"		
+		android:adjustViewBounds="true"
+		android:layout_width="fill_parent"
+		android:layout_height="wrap_content"/>
+		
+	<Button android:id="@+id/connection"
+		android:textSize="20sp"
+		android:singleLine="true"
+		android:layout_width="fill_parent"
+		android:layout_height="wrap_content"/>
+
+</LinearLayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/beemdialogsettings.xml	Sat Mar 21 00:00:14 2009 +0100
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:orientation="vertical"
+              android:layout_width="fill_parent"
+              android:layout_height="fill_parent"
+        >
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:orientation="horizontal"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+            >
+        <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="Host/Port:"
+                android:minWidth="70dp"
+                />
+                
+        <EditText android:id="@+id/host"
+                  android:layout_width="wrap_content"
+                  android:layout_height="wrap_content"
+                  android:singleLine="true"
+                  android:textSize="16sp"
+                  android:autoText="false"
+                  android:capitalize="none"
+                  android:minWidth="150dp"
+                  android:scrollHorizontally="true"/>
+        <EditText android:id="@+id/port"
+                  android:layout_width="wrap_content"
+                  android:layout_height="wrap_content"
+                  android:singleLine="true"
+                  android:textSize="16sp"
+                  android:autoText="false"
+                  android:minWidth="80dp"
+                  android:capitalize="none"
+                  android:scrollHorizontally="true"/>
+    </LinearLayout>
+
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:orientation="horizontal"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+            >
+        <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="Userid:"
+                android:minWidth="70dp"
+                />
+        <EditText android:id="@+id/userid"
+                  android:layout_width="wrap_content"
+                  android:layout_height="wrap_content"
+                  android:singleLine="true"
+                  android:textSize="16sp"
+                  android:autoText="false"
+                  android:minWidth="250dp"
+                  android:capitalize="none"
+                  android:scrollHorizontally="true"/>
+    </LinearLayout>
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:orientation="horizontal"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+            >
+        <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="Password:"
+                android:minWidth="70dp"
+                />
+        <EditText android:id="@+id/password"
+                  android:layout_width="wrap_content"
+                  android:layout_height="wrap_content"
+                  android:singleLine="true"
+                  android:password="true"
+                  android:textSize="16sp"
+                  android:autoText="false"
+                  android:minWidth="250dp"
+                  android:capitalize="none"
+                  android:scrollHorizontally="true"/>
+    </LinearLayout>
+
+    <Button android:id="@+id/ok"
+            android:layout_width="fill_parent"
+            android:layout_height="fill_parent"
+            android:text="OK">
+        <requestFocus/>
+    </Button>
+</LinearLayout>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/contactlist.xml	Sat Mar 21 00:00:14 2009 +0100
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ 	android:layout_width="fill_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical">
+                    	         	
+	<ImageView android:id="@+id/avatar"
+		android:src="@drawable/avatar"
+		android:paddingLeft="50sp"
+		android:layout_width="wrap_content"
+		android:layout_height="wrap_content"/>
+ 
+     <TextView android:id="@+id/textchild"
+         android:textSize="16sp"         
+         android:paddingLeft="100sp"
+         android:layout_width="fill_parent"
+         android:layout_height="wrap_content"/>
+		
+ </LinearLayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/contactlistgroup.xml	Sat Mar 21 00:00:14 2009 +0100
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+	android:layout_width="fill_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical">
+
+	<TextView android:id="@+id/textgroup"
+		android:height="50sp"
+		android:textSize="20sp"
+       	android:textStyle="bold"
+       	android:paddingTop="10sp"
+       	android:paddingLeft="40sp"
+       	android:layout_width="fill_parent"
+       	android:layout_height="wrap_content" />	
+
+ </LinearLayout>
--- a/res/layout/main.xml	Fri Mar 20 14:25:25 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-	android:orientation="vertical"
-	android:layout_width="fill_parent"
-	android:layout_height="fill_parent">
-
-	<ImageView android:id="@+id/logo"
-		android:src="@drawable/logo"
-		android:adjustViewBounds="true"
-		android:layout_width="wrap_content"
-		android:layout_height="wrap_content"/>
-		
-	<TextView android:text="Jabber ID"
-		android:textSize="25sp"
-		android:paddingLeft="100sp"
-		android:paddingTop="50sp"
-		android:paddingBottom="15sp"
-		android:layout_width="wrap_content"
-		android:layout_height="wrap_content" />
-		
-	<EditText android:id="@+id/jid"
-		android:singleLine="true"
-		android:layout_width="fill_parent"
-		android:layout_height="wrap_content"
-		android:scrollHorizontally="true" />
-	
-	<TextView
-		android:layout_width="fill_parent"
-		android:layout_height="10sp"/>
-
-	<Button android:id="@+id/connection"
-		android:textSize="20sp"
-		android:singleLine="true"
-		android:layout_width="fill_parent"
-		android:layout_height="wrap_content"
-		android:text="Connection" />
-
-</LinearLayout>
-
--- a/res/layout/settings.xml	Fri Mar 20 14:25:25 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:orientation="vertical"
-              android:layout_width="fill_parent"
-              android:layout_height="fill_parent"
-        >
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="horizontal"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-            >
-        <TextView
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="Host/Port:"
-                android:minWidth="70dp"
-                />
-                
-        <EditText android:id="@+id/host"
-                  android:layout_width="wrap_content"
-                  android:layout_height="wrap_content"
-                  android:singleLine="true"
-                  android:textSize="16sp"
-                  android:autoText="false"
-                  android:capitalize="none"
-                  android:minWidth="150dp"
-                  android:scrollHorizontally="true"/>
-        <EditText android:id="@+id/port"
-                  android:layout_width="wrap_content"
-                  android:layout_height="wrap_content"
-                  android:singleLine="true"
-                  android:textSize="16sp"
-                  android:autoText="false"
-                  android:minWidth="80dp"
-                  android:capitalize="none"
-                  android:scrollHorizontally="true"/>
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="horizontal"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-            >
-        <TextView
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="Userid:"
-                android:minWidth="70dp"
-                />
-        <EditText android:id="@+id/userid"
-                  android:layout_width="wrap_content"
-                  android:layout_height="wrap_content"
-                  android:singleLine="true"
-                  android:textSize="16sp"
-                  android:autoText="false"
-                  android:minWidth="250dp"
-                  android:capitalize="none"
-                  android:scrollHorizontally="true"/>
-    </LinearLayout>
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="horizontal"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-            >
-        <TextView
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="Password:"
-                android:minWidth="70dp"
-                />
-        <EditText android:id="@+id/password"
-                  android:layout_width="wrap_content"
-                  android:layout_height="wrap_content"
-                  android:singleLine="true"
-                  android:password="true"
-                  android:textSize="16sp"
-                  android:autoText="false"
-                  android:minWidth="250dp"
-                  android:capitalize="none"
-                  android:scrollHorizontally="true"/>
-    </LinearLayout>
-
-    <Button android:id="@+id/ok"
-            android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
-            android:text="OK">
-        <requestFocus/>
-    </Button>
-</LinearLayout>
-
--- a/res/menu/account.xml	Fri Mar 20 14:25:25 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-	<item android:id="@+id/account_edit"
-			android:title="Create or Edit Account" />
-	<item android:id="@+id/account_about"
-		android:title="About Beem" />
-</menu>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/menu/beemmenu.xml	Sat Mar 21 00:00:14 2009 +0100
@@ -0,0 +1,4 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+	<item android:title="Creer ou Editer un compte" android:id="@+id/account_edit"/>
+	<item android:title="L'equipe Beem" android:id="@+id/account_about"/>
+</menu>
--- a/res/values/strings.xml	Fri Mar 20 14:25:25 2009 +0100
+++ b/res/values/strings.xml	Sat Mar 21 00:00:14 2009 +0100
@@ -1,15 +1,20 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <string name="app_name">Beem</string>
-		
-<string name="BeemServiceDescription">Use the Beem Service</string>
-<string name="BeemServiceCreated">BeemService Created</string>
-<string name="BeemServiceDestroyed">BeemService destroyed</string>
+	<string name="app_name">Beem</string>
 
-<!--  Preferences information -->
-<string name="PreferenceFileName">Beem</string>
-<string name="PreferenceLoginKey">login</string>
-<string name="PreferenceHostKey">host</string>
-<string name="PreferencePasswordKey">password</string>
-<string name="PreferencePortKey">port</string>
+	<!--  Class Beem -->
+	<string name="BeemCreateAccount">Creer un compte</string>
+	<string name="BeemJabberID">Jabber ID</string>
+	
+	<!--  Class BeemService -->
+	<string name="BeemServiceDescription">Use the Beem Service</string>
+	<string name="BeemServiceCreated">BeemService Created</string>
+	<string name="BeemServiceDestroyed">BeemService destroyed</string>
+
+	<!--  Preferences information -->
+	<string name="PreferenceFileName">Beem</string>
+	<string name="PreferenceLoginKey">login</string>
+	<string name="PreferenceHostKey">host</string>
+	<string name="PreferencePasswordKey">password</string>
+	<string name="PreferencePortKey">port</string>
 </resources>
--- a/src/com/beem/project/beem/Beem.java	Fri Mar 20 14:25:25 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-package com.beem.project.beem;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.os.Bundle;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.EditText;
-
-public class Beem extends Activity {
-    
-    private SharedPreferences mSettings;
-
-    /** 
-     * Called when the activity is first created.
-     */
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.main);
-        mSettings = getSharedPreferences(getString(R.string.PreferenceFileName), MODE_PRIVATE);
-        showJID();
-        Button btConnection = (Button) findViewById(R.id.connection);
-        btConnection.setOnClickListener(new OnClickListener() {
-
-	    @Override
-	    public void onClick(View v) {
-		// TODO Auto-generated method stub
-		startService(new Intent(Beem.this,BeemService.class));
-	    }
-        });
-    }
-    
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        super.onCreateOptionsMenu(menu);
-        MenuInflater inflater = getMenuInflater();
-        inflater.inflate(R.menu.account, menu);
-        return true;
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        SettingsDialog Dialog = new SettingsDialog(this, mSettings);
-        switch (item.getItemId()) {        
-        case R.id.account_edit:
-            Dialog.show();
-            return true;
-        case R.id.account_about:
-            return true;
-        }
-        return false;
-    }
-
-    public void showJID() {
-        EditText ejid = (EditText) findViewById(R.id.jid);
-        String jid = mSettings.getString("login", "") +
-            "@" +  mSettings.getString("host", "") ;
-        if (jid.length() == 1)
-            jid = "Enter Jabber ID / Create New Account";
-        ejid.setText(jid);
-    }
-
-}
--- a/src/com/beem/project/beem/BeemService.java	Fri Mar 20 14:25:25 2009 +0100
+++ b/src/com/beem/project/beem/BeemService.java	Sat Mar 21 00:00:14 2009 +0100
@@ -8,96 +8,125 @@
 import org.jivesoftware.smack.XMPPConnection;
 import org.jivesoftware.smack.XMPPException;
 
-import com.beem.project.beem.service.IXMPPFacade;
-
 import android.app.Notification;
 import android.app.NotificationManager;
 import android.app.PendingIntent;
 import android.app.Service;
 import android.content.Intent;
 import android.content.SharedPreferences;
-import android.content.res.Resources;
 import android.os.IBinder;
 import android.os.RemoteException;
-import android.widget.TextView;
 import android.widget.Toast;
 
+import com.beem.project.beem.service.IXMPPFacade;
+
 /**
  * @author darisk
- *
+ * 
  */
 public class BeemService extends Service {
 
     private NotificationManager notificationManager;
 
     private XMPPConnection connection;
+
     private SharedPreferences settings;
+
     private String login;
+
     private String password;
+
     private String host;
-    
+
     private IXMPPFacade.Stub bind = new IXMPPFacade.Stub() {
-    
+
         @Override
         public List<String> getContactList() throws RemoteException {
-    	// TODO Auto-generated method stub
-    	return null;
+            return null;
+        }
+
+        @Override
+        public List<String> getGroupList() throws RemoteException {
+            return null;
         }
     };
-    
-    /* (non-Javadoc)
+
+    /*
+     * (non-Javadoc)
+     * 
      * @see android.app.Service#onBind(android.content.Intent)
      */
     @Override
     public IBinder onBind(Intent arg0) {
-	// TODO Auto-generated method stub
-	return null;
+        try {
+            connection = new XMPPConnection("10.0.2.2"); // address du pc host
+            // de l'emulateur
+            connection.connect();
+            connection.login(login, password);
+            notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+            showBasicNotification(R.string.BeemServiceCreated);
+        } catch (XMPPException e) {
+            // TODO Auto-generated catch block
+            Toast toast = Toast.makeText(this, "ERREUR " + e.getMessage(),
+                    Toast.LENGTH_LONG);
+            toast.show();
+            notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+            showBasicNotification(R.string.PreferenceFileName);
+        }
+        return bind;
     }
-    
+
     private void showBasicNotification(int stringResource) {
-	String text = (String) getText(stringResource);
-	Notification notif = new Notification(R.drawable.logo, text, System.currentTimeMillis());
-	notif.defaults = Notification.DEFAULT_ALL;
-	notif.setLatestEventInfo(this, text, text, PendingIntent.getActivity(this, 0, new Intent(),0));
-	notificationManager.notify(stringResource, notif);
-	Toast toast = Toast.makeText(this, R.string.BeemServiceCreated, Toast.LENGTH_LONG);
-	toast.show();
+        String text = (String) getText(stringResource);
+        Notification notif = new Notification(R.drawable.logo, text, System
+                .currentTimeMillis());
+        notif.defaults = Notification.DEFAULT_ALL;
+        notif.setLatestEventInfo(this, text, text, PendingIntent.getActivity(
+                this, 0, new Intent(), 0));
+        notificationManager.notify(stringResource, notif);
+        Toast toast = Toast.makeText(this, R.string.BeemServiceCreated,
+                Toast.LENGTH_LONG);
+        toast.show();
     }
-    
+
     @Override
-    public void onCreate(){
-	super.onCreate();
-	settings = getSharedPreferences(getString(R.string.PreferenceFileName),	MODE_PRIVATE);
-	login = settings.getString(getString(R.string.PreferenceLoginKey), "");
-	password = settings.getString(getString(R.string.PreferencePasswordKey), "");
-	host = settings.getString(getString(R.string.PreferenceHostKey), "");
+    public void onCreate() {
+        super.onCreate();
+        settings = getSharedPreferences(getString(R.string.PreferenceFileName),
+                MODE_PRIVATE);
+        login = settings.getString(getString(R.string.PreferenceLoginKey), "");
+        password = settings.getString(
+                getString(R.string.PreferencePasswordKey), "");
+        host = settings.getString(getString(R.string.PreferenceHostKey), "");
     }
-    
+
     @Override
     public void onStart(Intent intent, int startId) {
-	try {
-	    connection = new XMPPConnection("10.0.2.2"); // address du pc host de l'emulateur
-	    connection.connect();
-	    connection.login(login, password);
-	    notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
-	    showBasicNotification(R.string.BeemServiceCreated);
-	} catch (XMPPException e) {
-	    // TODO Auto-generated catch block
-	    Toast toast = Toast.makeText(this, "ERREUR " + e.getMessage(), Toast.LENGTH_LONG);
-	    toast.show();
-	    e.printStackTrace();
-	}
+        try {
+            connection = new XMPPConnection("10.0.2.2"); // address du pc host
+            // de l'emulateur
+            connection.connect();
+            connection.login(login, password);
+            notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+            showBasicNotification(R.string.BeemServiceCreated);
+        } catch (XMPPException e) {
+            // TODO Auto-generated catch block
+            Toast toast = Toast.makeText(this, "ERREUR " + e.getMessage(),
+                    Toast.LENGTH_LONG);
+            toast.show();
+            notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+            showBasicNotification(R.string.PreferenceFileName);
+        }
     }
-    
+
     private void closeConnection() {
-	if (connection != null)
-	    connection.disconnect();
+        if (connection != null)
+            connection.disconnect();
     }
-    
+
     @Override
     public void onDestroy() {
-	closeConnection();
-	showBasicNotification(R.string.BeemServiceDestroyed); 
-    }
+        closeConnection();
+            }
 
 }
--- a/src/com/beem/project/beem/SettingsDialog.java	Fri Mar 20 14:25:25 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-package com.beem.project.beem;
-
-import android.app.Dialog;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-
-/**
- *
- */
-public class SettingsDialog extends Dialog implements android.view.View.OnClickListener {
-
-    private Beem mbeem;
-    private SharedPreferences mSettings;
-    public SettingsDialog(Beem beem, SharedPreferences settings) {
-        super(beem);
-        this.mbeem = beem;
-        this.mSettings = settings;
-    }
-
-    @Override
-    protected void onStart() {
-        super.onStart();
-        setContentView(R.layout.settings);
-        getWindow().setFlags(4, 4);
-        setTitle("Jabber Account Settings");
-        showSettings();
-        Button ok = (Button) findViewById(R.id.ok);
-        ok.setOnClickListener(this);
-    }
-    
-    @Override
-    public void onClick(View v) {
-        SharedPreferences.Editor editor = mSettings.edit();
-        Context ctx = getContext();
-        editor.putString(ctx.getString(R.string.PreferenceHostKey), getWidgetText(R.id.host));
-        editor.putString(ctx.getString(R.string.PreferencePortKey), getWidgetText(R.id.port));
-        editor.putString(ctx.getString(R.string.PreferenceLoginKey), getWidgetText(R.id.userid));
-        editor.putString(ctx.getString(R.string.PreferencePasswordKey), getWidgetText(R.id.password));
-        editor.commit();
-        this.mbeem.showJID();
-        dismiss();
-    }
-    
-    private void showSettings() {
-        String tmp;
-        EditText eHost = (EditText) findViewById(R.id.host);
-        if ((tmp = mSettings.getString("host","")) != "")
-            eHost.setText(tmp);
-        EditText ePort = (EditText) findViewById(R.id.port);
-        if ((tmp = mSettings.getString("port","")) != "")
-            ePort.setText(tmp);
-        EditText eLogin = (EditText) findViewById(R.id.userid);
-        if ((tmp = mSettings.getString("login","")) != "")
-            eLogin.setText(tmp);
-        EditText ePwd = (EditText) findViewById(R.id.password);
-        if ((tmp = mSettings.getString("password","")) != "")
-            ePwd.setText(tmp);
-    }
-    
-    private String getWidgetText(int id) {
-        EditText widget = (EditText) this.findViewById(id);
-        return widget.getText().toString();
-    }
-}
--- a/src/com/beem/project/beem/service/IXMPPFacade.aidl	Fri Mar 20 14:25:25 2009 +0100
+++ b/src/com/beem/project/beem/service/IXMPPFacade.aidl	Sat Mar 21 00:00:14 2009 +0100
@@ -7,5 +7,6 @@
   //  org.jivesoftware.smack.XMPPConnection getXMPPConnection();
   
   List<String> getContactList();
+  List<String> getGroupList();
 
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/Beem.java	Sat Mar 21 00:00:14 2009 +0100
@@ -0,0 +1,74 @@
+package com.beem.project.beem.ui;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+
+import com.beem.project.beem.R;
+
+public class Beem extends Activity {
+
+    private SharedPreferences mSettings;
+    private BeemDialogSettings mDialog;
+    private Button mButton;
+
+    /**
+     * Called when the activity is first created.
+     */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.beem);
+        mSettings = getSharedPreferences(
+                getString(R.string.PreferenceFileName), MODE_PRIVATE);
+        mDialog = new BeemDialogSettings(this, mSettings);
+
+        mButton = (Button) findViewById(R.id.connection);
+        mButton.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (mButton.getText() == getString(R.string.BeemCreateAccount))
+                    mDialog.show();
+                else
+                    startActivity(new Intent(Beem.this, ContactList.class));
+            }
+        });
+        showJID();
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        super.onCreateOptionsMenu(menu);
+        MenuInflater inflater = getMenuInflater();
+        inflater.inflate(R.menu.beemmenu, menu);
+        return true;
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {       
+        switch (item.getItemId()) {
+        case R.id.account_edit:
+           mDialog.show();
+            return true;
+        case R.id.account_about:
+            return true;
+        }
+        return false;
+    }
+
+    public void showJID() {  
+        String jid = mSettings.getString(getString(R.string.PreferenceLoginKey), "") + "@"
+                + mSettings.getString(getString(R.string.PreferenceHostKey), "");
+        if (jid.length() == 1)
+            jid = getString(R.string.BeemCreateAccount);
+        mButton.setText(jid);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/BeemDialogSettings.java	Sat Mar 21 00:00:14 2009 +0100
@@ -0,0 +1,76 @@
+package com.beem.project.beem.ui;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+
+import com.beem.project.beem.R;
+
+/**
+ *
+ */
+public class BeemDialogSettings extends Dialog implements
+        android.view.View.OnClickListener {
+
+    private Beem mbeem;
+
+    private SharedPreferences mSettings;
+
+    public BeemDialogSettings(Beem beem, SharedPreferences settings) {
+        super(beem);
+        this.mbeem = beem;
+        this.mSettings = settings;
+    }
+
+    @Override
+    protected void onStart() {
+        super.onStart();
+        setContentView(R.layout.beemdialogsettings);
+        getWindow().setFlags(4, 4);
+        setTitle("Jabber Account Settings");
+        showSettings();
+        Button ok = (Button) findViewById(R.id.ok);
+        ok.setOnClickListener(this);
+    }
+
+    @Override
+    public void onClick(View v) {
+        SharedPreferences.Editor editor = mSettings.edit();
+        Context ctx = getContext();
+        editor.putString(ctx.getString(R.string.PreferenceHostKey),
+                getWidgetText(R.id.host));
+        editor.putString(ctx.getString(R.string.PreferencePortKey),
+                getWidgetText(R.id.port));
+        editor.putString(ctx.getString(R.string.PreferenceLoginKey),
+                getWidgetText(R.id.userid));
+        editor.putString(ctx.getString(R.string.PreferencePasswordKey),
+                getWidgetText(R.id.password));
+        editor.commit();
+        this.mbeem.showJID();
+        dismiss();
+    }
+
+    private void showSettings() {
+        String tmp;
+        EditText eHost = (EditText) findViewById(R.id.host);
+        if ((tmp = mSettings.getString("host", "")) != "")
+            eHost.setText(tmp);
+        EditText ePort = (EditText) findViewById(R.id.port);
+        if ((tmp = mSettings.getString("port", "")) != "")
+            ePort.setText(tmp);
+        EditText eLogin = (EditText) findViewById(R.id.userid);
+        if ((tmp = mSettings.getString("login", "")) != "")
+            eLogin.setText(tmp);
+        EditText ePwd = (EditText) findViewById(R.id.password);
+        if ((tmp = mSettings.getString("password", "")) != "")
+            ePwd.setText(tmp);
+    }
+
+    private String getWidgetText(int id) {
+        EditText widget = (EditText) this.findViewById(id);
+        return widget.getText().toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/ContactList.java	Sat Mar 21 00:00:14 2009 +0100
@@ -0,0 +1,82 @@
+package com.beem.project.beem.ui;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import android.app.ExpandableListActivity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.widget.ExpandableListAdapter;
+import android.widget.SimpleExpandableListAdapter;
+
+import com.beem.project.beem.BeemService;
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.IXMPPFacade;
+
+public class ContactList extends ExpandableListActivity {
+
+    private IXMPPFacade mService = null;
+
+    @Override
+    public void onCreate(Bundle saveBundle) {
+        super.onCreate(saveBundle);
+        bindService(new Intent(this, BeemService.class), mConnection,
+                BIND_AUTO_CREATE | BIND_DEBUG_UNBIND);
+        showContactList();
+    }
+
+    private void showContactList() {
+        ExpandableListAdapter Adapter;
+        List<Map<String, String>> groupData = new ArrayList<Map<String, String>>();
+        List<List<Map<String, String>>> childData = new ArrayList<List<Map<String, String>>>();
+
+        for (int i = 0; i < 2; i++) {
+            Map<String, String> curGroupMap = new HashMap<String, String>();
+            groupData.add(curGroupMap);
+            curGroupMap.put("NAME", "Group " + i);
+            
+            List<Map<String, String>> children = new ArrayList<Map<String, String>>();
+            for (int j = 0; j < 5; j++) {
+                Map<String, String> curChildMap = new HashMap<String, String>();
+                children.add(curChildMap);
+                curChildMap.put("NAME CHILD", "Child " + j);                
+            }
+            childData.add(children);
+        }
+
+        Adapter = new SimpleExpandableListAdapter(this, 
+                groupData, R.layout.contactlistgroup,
+                new String[] {"NAME"}, new int[] {R.id.textgroup},
+                childData, R.layout.contactlist,
+                new String[] {"NAME CHILD"}, new int[] {R.id.textchild});
+        setListAdapter(Adapter);
+    }
+
+    private ServiceConnection mConnection = new ServiceConnection() {
+        @Override
+        public void onServiceConnected(ComponentName name, IBinder service) {
+            mService = IXMPPFacade.Stub.asInterface(service);
+            /*
+             * mService.getGroupList(); mService.getContactList();
+             */
+            showContactList();
+        }
+
+        @Override
+        public void onServiceDisconnected(ComponentName name) {
+        }
+
+    };
+
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+        unbindService(mConnection);
+    }
+
+}