Creation de l'activite PrivacyList et d'une interface PrivacyListListener ainsi que son implementation.
authorJean-Manuel Da Silva <dasilvj@gmail.com>
Sun, 15 Nov 2009 23:03:19 +0100
changeset 518 6b8089c9b834
parent 517 fd6c52c23165
child 519 ea7009295a84
Creation de l'activite PrivacyList et d'une interface PrivacyListListener ainsi que son implementation.
AndroidManifest.xml
res/menu/edit_settings.xml
res/values-fr/strings.xml
res/values/strings.xml
src/com/beem/project/beem/BeemService.java
src/com/beem/project/beem/service/PrivacyListManagerAdapter.java
src/com/beem/project/beem/service/XmppConnectionAdapter.java
src/com/beem/project/beem/service/XmppFacade.java
src/com/beem/project/beem/service/aidl/IPrivacyListListener.aidl
src/com/beem/project/beem/service/aidl/IPrivacyListManager.aidl
src/com/beem/project/beem/service/aidl/IXmppConnection.aidl
src/com/beem/project/beem/service/aidl/IXmppFacade.aidl
src/com/beem/project/beem/ui/Chat.java
src/com/beem/project/beem/ui/PrivacyList.java
src/com/beem/project/beem/ui/Settings.java
--- a/AndroidManifest.xml	Sun Nov 15 20:40:15 2009 +0100
+++ b/AndroidManifest.xml	Sun Nov 15 23:03:19 2009 +0100
@@ -2,10 +2,9 @@
 <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" android:icon="@drawable/beem_launcher_icon_silver"
-		android:theme="@style/Theme.BEEM.Default" android:debuggable="true"
-		android:name="@string/app_name"
-		>
+	<application android:label="@string/app_name"
+		android:icon="@drawable/beem_launcher_icon_silver" android:theme="@style/Theme.BEEM.Default"
+		android:debuggable="true" android:name="@string/app_name">
 		<activity android:name=".ui.Login" android:label="@string/app_name"
 			android:launchMode="singleTask">
 			<intent-filter>
@@ -26,8 +25,9 @@
 		<activity android:name=".ui.Chat" android:label="@string/chat_name"
 			android:launchMode="singleTop">
 			<intent-filter android:label="Beem Connection">
-				<action android:name="com.beem.project.beem.service.XmppConnectionAdapter.CONNECTION_CLOSED" />
-			</intent-filter>		
+				<action
+					android:name="com.beem.project.beem.service.XmppConnectionAdapter.CONNECTION_CLOSED" />
+			</intent-filter>
 		</activity>
 		<activity android:name=".ui.ChangeStatus" android:label="@string/ChangeStatusActTitle">
 			<intent-filter android:label="Beem Connection">
@@ -74,6 +74,12 @@
 					android:name="com.beem.project.beem.service.XmppConnectionAdapter.CONNECTION_CLOSED" />
 			</intent-filter>
 		</activity>
+		<activity android:name=".ui.PrivacyList" android:label="@string/privacy_list_name">
+			<intent-filter android:label="Beem Connection">
+				<action
+					android:name="com.beem.project.beem.service.XmppConnectionAdapter.CONNECTION_CLOSED" />
+			</intent-filter>
+		</activity>
 		<service android:name="BeemService" android:enabled="true"
 			android:label="Beem Service" android:permission="com.beem.project.beem.BEEM_SERVICE">
 			<intent-filter>
--- a/res/menu/edit_settings.xml	Sun Nov 15 20:40:15 2009 +0100
+++ b/res/menu/edit_settings.xml	Sun Nov 15 23:03:19 2009 +0100
@@ -7,4 +7,8 @@
 		android:visible="true"
 		android:title="@string/settings_menu_login"
 		android:icon="@drawable/ic_menu_login" />
+	<item android:id="@+id/settings_menu_privacy_lists"
+		android:visible="true"
+		android:title="@string/settings_menu_privacy_lists"
+		android:icon="@drawable/ic_menu_blocked_user" />
 </menu>
--- a/res/values-fr/strings.xml	Sun Nov 15 20:40:15 2009 +0100
+++ b/res/values-fr/strings.xml	Sun Nov 15 23:03:19 2009 +0100
@@ -180,6 +180,7 @@
 	-->
 	<string name="settings_menu_create_account">Créer un compte</string>
 	<string name="settings_menu_login">Se connecter</string>
+	<string name="settings_menu_privacy_lists">Gérer mes listes privées</string>
 	<string name="settings_saved_ok">Les paramètres ont été enregistrés avec succès.
 	</string>
 
@@ -292,12 +293,16 @@
 	<string name="chat_dialog_change_chat_title">Conversations en cours</string>
 	<string name="chat_menu_close_chat">Fermer cette conversation</string>
 	<string name="chat_no_more_chats">Aucune conversation en cours</string>
-	
+
 	<string name="contact_status_msg_available">Disponible</string>
 	<string name="contact_status_msg_available_chat">Disponible pour clavarder</string>
 	<string name="contact_status_msg_dnd">Occupé(e)</string>
 	<string name="contact_status_msg_away">Parti(e)</string>
 	<string name="contact_status_msg_xa">Indisponible</string>
 	<string name="contact_status_msg_offline">Hors ligne</string>
+
+	<string name="privacy_list_name">Beem - Gérer mes listes privées</string>
+	<string name="privacy_list_no_data">Il n'existe aucune liste privée enregistrée.</string>
+
 	<string name="UpdateButton">Mettre à jour</string>
 </resources>
--- a/res/values/strings.xml	Sun Nov 15 20:40:15 2009 +0100
+++ b/res/values/strings.xml	Sun Nov 15 23:03:19 2009 +0100
@@ -165,6 +165,7 @@
 	<!-- EditSettings Activity -->
 	<string name="settings_menu_create_account">Create an account</string>
 	<string name="settings_menu_login">Login</string>
+	<string name="settings_menu_privacy_lists">Manage my privacy lists</string>
 	<string name="settings_saved_ok">The settings have been saved successfully.</string>
 
 	<string name="settings_key_account_username">beem_account_username</string>
@@ -273,6 +274,9 @@
 	<string name="contact_status_msg_away">Away</string>
 	<string name="contact_status_msg_xa">Unavailable</string>
 	<string name="contact_status_msg_offline">Disconnected</string>
+	
+	<string name="privacy_list_name">Beem - Manage my privacy lists</string>
+	<string name="privacy_list_no_data">There aren't any privacy list registered.</string>
 
 	<string name="UpdateButton">Update</string>
 </resources>
--- a/src/com/beem/project/beem/BeemService.java	Sun Nov 15 20:40:15 2009 +0100
+++ b/src/com/beem/project/beem/BeemService.java	Sun Nov 15 23:03:19 2009 +0100
@@ -103,9 +103,9 @@
 
     @Override
     public boolean onUnbind(Intent intent) {
-	Log.d("BEEMSERVICE", "ONUNBIND()");
+	Log.d(TAG, "ONUNBIND()");
 	if (!mConnection.getAdaptee().isConnected()) {
-	    Log.d("BEEMSERVICE", "DESTROYED");
+	    Log.d(TAG, "DESTROYED");
 	    this.stopSelf();
 	}
 	return true;
--- a/src/com/beem/project/beem/service/PrivacyListManagerAdapter.java	Sun Nov 15 20:40:15 2009 +0100
+++ b/src/com/beem/project/beem/service/PrivacyListManagerAdapter.java	Sun Nov 15 23:03:19 2009 +0100
@@ -4,14 +4,17 @@
 import java.util.List;
 
 import org.jivesoftware.smack.PrivacyList;
+import org.jivesoftware.smack.PrivacyListListener;
 import org.jivesoftware.smack.PrivacyListManager;
 import org.jivesoftware.smack.XMPPConnection;
 import org.jivesoftware.smack.XMPPException;
 import org.jivesoftware.smack.packet.PrivacyItem;
 
+import android.os.RemoteCallbackList;
 import android.os.RemoteException;
 import android.util.Log;
 
+import com.beem.project.beem.service.aidl.IPrivacyListListener;
 import com.beem.project.beem.service.aidl.IPrivacyListManager;
 
 /**
@@ -25,8 +28,11 @@
      */
     public static final String TAG = "PrivacyListManagerAdapter";
 
+    private final XMPPConnection mXmppConnection;
     private final PrivacyListManager mPrivacyListManager;
-    private final XMPPConnection mXmppConnection;
+
+    private final RemoteCallbackList<IPrivacyListListener> mPrivacyListListeners = new RemoteCallbackList<IPrivacyListListener>();
+    private final PrivacyListListenerAdapter mPrivacyListListener = new PrivacyListListenerAdapter();
 
     /**
      * Constructor.
@@ -35,6 +41,7 @@
     public PrivacyListManagerAdapter(final XMPPConnection connection) {
 	mXmppConnection = connection;
 	mPrivacyListManager = PrivacyListManager.getInstanceFor(mXmppConnection);
+	mPrivacyListManager.addListener(mPrivacyListListener);
     }
 
     @Override
@@ -171,4 +178,66 @@
 
 	return rItems;
     }
+
+    /**
+     * From a List of PrivacyItem get a List of PrivacyListItem.
+     * @param items The List of PrivacyItem.
+     * @return A list of PrivacyListItem.
+     */
+    private List<PrivacyListItem> tranformPrivacyItemsToPrivacyListItems(List<PrivacyItem> items) {
+	List<PrivacyListItem> rItems = new ArrayList<PrivacyListItem>();
+	PrivacyItem.Type[] itemTypes = PrivacyItem.Type.values();
+
+	for (int i = 0; i < items.size(); i++) {
+	    rItems.add(new PrivacyListItem(items.get(i).getType().ordinal(), items.get(i).getValue()));
+	}
+	return rItems;
+    }
+
+    /**
+     * An adapter for the Smack's PrivacyListListener.
+     * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
+     */
+    private class PrivacyListListenerAdapter implements PrivacyListListener {
+
+	@Override
+	public void setPrivacyList(String listName, List<PrivacyItem> listItem) {
+	    final int n = mPrivacyListListeners.beginBroadcast();
+	    for (int i = 0; i < n; i++) {
+		IPrivacyListListener listener = mPrivacyListListeners.getBroadcastItem(i);
+		try {
+		    listener.setPrivacyList(listName, tranformPrivacyItemsToPrivacyListItems(listItem));
+		} catch (RemoteException e) {
+		    Log.w(TAG, e.getMessage());
+		}
+	    }
+	    mPrivacyListListeners.finishBroadcast();
+	}
+
+	@Override
+	public void updatedPrivacyList(String listName) {
+	    final int n = mPrivacyListListeners.beginBroadcast();
+	    for (int i = 0; i < n; i++) {
+		IPrivacyListListener listener = mPrivacyListListeners.getBroadcastItem(i);
+		try {
+		    listener.updatedPrivacyList(listName);
+		} catch (RemoteException e) {
+		    Log.w(TAG, e.getMessage());
+		}
+	    }
+	    mPrivacyListListeners.finishBroadcast();
+	}
+    }
+
+    @Override
+    public void addPrivacyListListener(IPrivacyListListener listener) throws RemoteException {
+	if (listener != null)
+	    mPrivacyListListeners.register(listener);
+    }
+
+    @Override
+    public void removePrivacyListListener(IPrivacyListListener listener) throws RemoteException {
+	if (listener != null)
+	    mPrivacyListListeners.unregister(listener);
+    }
 }
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Sun Nov 15 20:40:15 2009 +0100
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Sun Nov 15 23:03:19 2009 +0100
@@ -48,7 +48,7 @@
     private final String mLogin;
     private final String mPassword;
     private RosterAdapter mRoster;
-    private PrivacyListManagerAdapter mPrivacyList;
+    private PrivacyListManagerAdapter mPrivacyListManager;
     private final BeemService mService;
     private final RemoteCallbackList<IBeemConnectionListener> mRemoteConnListeners = new RemoteCallbackList<IBeemConnectionListener>();
 
@@ -133,7 +133,7 @@
 	    mAdaptee.login(mLogin, mPassword, "BEEM");
 
 	    mChatManager = new BeemChatManager(mAdaptee.getChatManager(), mService);
-	    mPrivacyList = new PrivacyListManagerAdapter(mAdaptee);
+	    mPrivacyListManager = new PrivacyListManagerAdapter(mAdaptee);
 
 	    this.initFeatures(); // pour declarer les features xmpp qu'on
 	    // supporte
@@ -141,8 +141,8 @@
 
 	    triggerAsynchronousConnectEvent();
 	    // Priority between -128 and 128
-	    Presence p = new Presence(Presence.Type.available, "Beem : http://www.beem-project.com", PRESENCE_PRIORITY,
-		Presence.Mode.available);
+	    Presence p = new Presence(Presence.Type.available, "Beem : http://www.beem-project.com",
+		PRESENCE_PRIORITY, Presence.Mode.available);
 	    mAdaptee.sendPacket(p);
 	    return true;
 	} catch (XMPPException e) {
@@ -244,19 +244,19 @@
     }
 
     /**
-     * Set the privacy list to use.
-     * @param privacyList the mPrivacyList to set
+     * PrivacyListManagerAdapter mutator.
+     * @param privacyList the PrivacyListManager to set
      */
-    public void setPrivacyList(PrivacyListManagerAdapter privacyList) {
-	this.mPrivacyList = privacyList;
+    public void setPrivacyListManager(PrivacyListManagerAdapter privacyListManager) {
+	this.mPrivacyListManager = privacyListManager;
     }
 
     /**
-     * Get the privacy list in use.
+     * PrivacyListManagerAdapter accessor.
      * @return the mPrivacyList
      */
-    public PrivacyListManagerAdapter getPrivacyList() {
-	return mPrivacyList;
+    public PrivacyListManagerAdapter getPrivacyListManager() {
+	return mPrivacyListManager;
     }
 
     /**
@@ -343,13 +343,14 @@
 		@Override
 		public void processPacket(Packet packet) {
 		    String from = packet.getFrom();
-		    Notification notif = new Notification(android.R.drawable.stat_notify_more, mService
-			.getString(R.string.AcceptContactRequest, from), System.currentTimeMillis());
+		    Notification notif = new Notification(android.R.drawable.stat_notify_more, mService.getString(
+			R.string.AcceptContactRequest, from), System.currentTimeMillis());
 		    notif.defaults = Notification.DEFAULT_ALL;
 		    notif.flags = Notification.FLAG_AUTO_CANCEL;
 		    Intent intent = new Intent(mService, Subscription.class);
 		    intent.putExtra("from", from);
-		    notif.setLatestEventInfo(mService, from, mService.getString(R.string.AcceptContactRequestFrom, from), PendingIntent.getActivity(mService, 0, intent, PendingIntent.FLAG_ONE_SHOT));
+		    notif.setLatestEventInfo(mService, from, mService.getString(R.string.AcceptContactRequestFrom,
+			from), PendingIntent.getActivity(mService, 0, intent, PendingIntent.FLAG_ONE_SHOT));
 		    int id = packet.hashCode();
 		    mService.sendNotification(id, notif);
 		}
@@ -442,13 +443,14 @@
 		@Override
 		public void processPacket(Packet packet) {
 		    String from = packet.getFrom();
-		    Notification notif = new Notification(android.R.drawable.stat_notify_more, mService
-			.getString(R.string.AcceptContactRequest, from), System.currentTimeMillis());
+		    Notification notif = new Notification(android.R.drawable.stat_notify_more, mService.getString(
+			R.string.AcceptContactRequest, from), System.currentTimeMillis());
 		    notif.defaults = Notification.DEFAULT_ALL;
 		    notif.flags = Notification.FLAG_AUTO_CANCEL;
 		    Intent intent = new Intent(mService, Subscription.class);
 		    intent.putExtra("from", from);
-		    notif.setLatestEventInfo(mService, from, mService.getString(R.string.AcceptContactRequestFrom, from), PendingIntent.getActivity(mService, 0, intent, PendingIntent.FLAG_ONE_SHOT));
+		    notif.setLatestEventInfo(mService, from, mService.getString(R.string.AcceptContactRequestFrom,
+			from), PendingIntent.getActivity(mService, 0, intent, PendingIntent.FLAG_ONE_SHOT));
 		    int id = packet.hashCode();
 		    mService.sendNotification(id, notif);
 		}
--- a/src/com/beem/project/beem/service/XmppFacade.java	Sun Nov 15 20:40:15 2009 +0100
+++ b/src/com/beem/project/beem/service/XmppFacade.java	Sun Nov 15 23:03:19 2009 +0100
@@ -12,6 +12,7 @@
 import com.beem.project.beem.BeemService;
 import com.beem.project.beem.jingle.JingleService;
 import com.beem.project.beem.service.aidl.IChatManager;
+import com.beem.project.beem.service.aidl.IPrivacyListManager;
 import com.beem.project.beem.service.aidl.IRoster;
 import com.beem.project.beem.service.aidl.IXmppConnection;
 import com.beem.project.beem.service.aidl.IXmppFacade;
@@ -116,6 +117,14 @@
 	return mConnexion.getRoster();
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public IPrivacyListManager getPrivacyListManager() {
+	return mConnexion.getPrivacyListManager();
+    }
+
     @Override
     public void sendPresencePacket(PresenceAdapter presence) throws RemoteException {
 	Presence presence2 = new Presence(PresenceType.getPresenceTypeFrom(presence.getType()));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/service/aidl/IPrivacyListListener.aidl	Sun Nov 15 23:03:19 2009 +0100
@@ -0,0 +1,8 @@
+package com.beem.project.beem.service.aidl;
+
+import  com.beem.project.beem.service.PrivacyListItem;
+
+interface IPrivacyListListener {
+	void updatedPrivacyList(in String listName);
+	void setPrivacyList(in String listName, in List<PrivacyListItem> listItem);
+}
--- a/src/com/beem/project/beem/service/aidl/IPrivacyListManager.aidl	Sun Nov 15 20:40:15 2009 +0100
+++ b/src/com/beem/project/beem/service/aidl/IPrivacyListManager.aidl	Sun Nov 15 23:03:19 2009 +0100
@@ -1,31 +1,21 @@
 package com.beem.project.beem.service.aidl;
 
 import  com.beem.project.beem.service.PrivacyListItem;
+import  com.beem.project.beem.service.aidl.IPrivacyListListener;
 
 interface IPrivacyListManager {
-
 	void createPrivacyList(in String listName, in List<PrivacyListItem> items);
-	
 	void removePrivacyList(in String listName);
-	
 	void editPrivacyList(in String listName, in List<PrivacyListItem> items);
-	
 	String getActivePrivacyList();
-	
 	String getDefaultPrivacyList();
-	
 	void setActivePrivacyList(in String listName);
-	
 	void setDefaultPrivacyList(in String listName);
-	
 	void declineActivePrivacyList();
-	
 	void declineDefaultPrivacyList();
-
 	void blockUser(in String listName, in String jid);
-	
 	List<String> getBlockedUsersByList(in String listName);
-	
 	List<String> getBlockedGroupsByList(in String listName);
-
+	void addPrivacyListListener(in IPrivacyListListener listener);
+	void removePrivacyListListener(in IPrivacyListListener listener);
 }
\ No newline at end of file
--- a/src/com/beem/project/beem/service/aidl/IXmppConnection.aidl	Sun Nov 15 20:40:15 2009 +0100
+++ b/src/com/beem/project/beem/service/aidl/IXmppConnection.aidl	Sun Nov 15 23:03:19 2009 +0100
@@ -3,6 +3,7 @@
 import  com.beem.project.beem.service.aidl.IRoster;
 import  com.beem.project.beem.service.aidl.IBeemConnectionListener;
 import  com.beem.project.beem.service.aidl.IChatManager;
+import  com.beem.project.beem.service.aidl.IPrivacyListManager;
 
 interface IXmppConnection {
     
@@ -20,4 +21,6 @@
     boolean isAuthentificated();
     
     IChatManager getChatManager();
-}
\ No newline at end of file
+    
+    IPrivacyListManager getPrivacyListManager();
+}
--- a/src/com/beem/project/beem/service/aidl/IXmppFacade.aidl	Sun Nov 15 20:40:15 2009 +0100
+++ b/src/com/beem/project/beem/service/aidl/IXmppFacade.aidl	Sun Nov 15 23:03:19 2009 +0100
@@ -3,6 +3,7 @@
 import  com.beem.project.beem.service.aidl.IXmppConnection;
 import  com.beem.project.beem.service.aidl.IRoster;
 import  com.beem.project.beem.service.aidl.IChatManager;
+import  com.beem.project.beem.service.aidl.IPrivacyListManager;
 import com.beem.project.beem.service.PresenceAdapter;
 
 interface IXmppFacade {
@@ -52,9 +53,11 @@
      */
      void call(in String jid);
      
-     /**
-      * get the user vcard avatar
-      * @param jid the user jid
-      */
-      byte[] getVcardAvatar(in String jid);
+	 /**
+	  * get the user vcard avatar
+	  * @param jid the user jid
+	  */
+	  byte[] getVcardAvatar(in String jid);
+	  
+	IPrivacyListManager getPrivacyListManager();
 }
--- a/src/com/beem/project/beem/ui/Chat.java	Sun Nov 15 20:40:15 2009 +0100
+++ b/src/com/beem/project/beem/ui/Chat.java	Sun Nov 15 23:03:19 2009 +0100
@@ -705,7 +705,7 @@
 	private String mMessage;
 
 	/**
-	 * Construtor.
+	 * Constructor.
 	 * @param bareJid A String containing the bare JID of the message's author.
 	 * @param name A String containing the name of the message's author.
 	 * @param message A String containing the message.
@@ -859,12 +859,4 @@
 	}
 	Log.v(TAG, "END sendMessage.");
     }
-
-    private final OnClickListener mSendButtonClickListener = new OnClickListener() {
-
-	@Override
-	public void onClick(View v) {
-	    sendMessage();
-	}
-    };
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/PrivacyList.java	Sun Nov 15 23:03:19 2009 +0100
@@ -0,0 +1,128 @@
+package com.beem.project.beem.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import android.app.ListActivity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.util.Log;
+import android.widget.ArrayAdapter;
+
+import com.beem.project.beem.BeemService;
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.aidl.IPrivacyListManager;
+import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.utils.BeemBroadcastReceiver;
+
+/**
+ * This class represents an activity which allows the user to manage his privacy lists.
+ * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
+ */
+public class PrivacyList extends ListActivity {
+
+    private static final String TAG = "PrivacyList";
+    private static final Intent SERVICE_INTENT = new Intent();
+    static {
+	SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
+    }
+
+    private ArrayAdapter<String> mAdapter;
+    private final List<String> mPrivacyListNames = new ArrayList<String>();
+
+    private final ServiceConnection mConn = new BeemServiceConnection();
+    private BeemBroadcastReceiver mBroadcastReceiver;
+    private IPrivacyListManager mPrivacyListManager;
+
+    /**
+     * Constructor.
+     */
+    public PrivacyList() {
+	super();
+    }
+
+    /**
+     * {@inheritDoc}.
+     */
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+	super.onCreate(savedInstanceState);
+	Log.d(TAG, "BEGIN onCreate.");
+	setContentView(R.layout.privacy_list);
+
+	mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mPrivacyListNames);
+	setListAdapter(mAdapter);
+
+	mBroadcastReceiver = new BeemBroadcastReceiver(mConn);
+	this.registerReceiver(mBroadcastReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
+
+	Log.d(TAG, "END onCreate.");
+    }
+
+    /**
+     * {@inheritDoc}.
+     */
+    @Override
+    protected void onDestroy() {
+	super.onDestroy();
+
+	Log.v(TAG, "BEGIN onDestroy.");
+	this.unregisterReceiver(mBroadcastReceiver);
+	Log.v(TAG, "END onDestroy.");
+    }
+
+    /**
+     * {@inheritDoc}.
+     */
+    @Override
+    protected void onStart() {
+	super.onStart();
+
+	Log.v(TAG, "BEGIN onStart.");
+	bindService(new Intent(this, BeemService.class), mConn, BIND_AUTO_CREATE);
+	Log.v(TAG, "END onStart.");
+    }
+
+    /**
+     * {@inheritDoc}.
+     */
+    @Override
+    protected void onStop() {
+	super.onStop();
+
+	Log.v(TAG, "BEGIN onStop.");
+	if (mBroadcastReceiver.isBinded()) {
+	    unbindService(mConn);
+	}
+	Log.v(TAG, "END onStop.");
+    }
+
+    private final class BeemServiceConnection implements ServiceConnection {
+
+	private IXmppFacade mXmppFacade;
+
+	@Override
+	public void onServiceConnected(ComponentName name, IBinder service) {
+	    Log.v(TAG, "BEGIN onServiceConnected.");
+	    mXmppFacade = IXmppFacade.Stub.asInterface(service);
+	    try {
+		mPrivacyListManager = mXmppFacade.getPrivacyListManager();
+	    } catch (RemoteException e) {
+		Log.e(TAG, e.getMessage());
+	    }
+	    Log.v(TAG, "END onServiceConnected.");
+	}
+
+	@Override
+	public void onServiceDisconnected(ComponentName name) {
+	    Log.v(TAG, "BEGIN onServiceDisconnected.");
+	    mXmppFacade = null;
+	    Log.v(TAG, "END onServiceDisconnected.");
+	}
+    }
+}
--- a/src/com/beem/project/beem/ui/Settings.java	Sun Nov 15 20:40:15 2009 +0100
+++ b/src/com/beem/project/beem/ui/Settings.java	Sun Nov 15 23:03:19 2009 +0100
@@ -17,7 +17,6 @@
 
 /**
  * This class represents an activity which allows the user to change his account or proxy parameters.
- * @author nikita
  */
 public class Settings extends PreferenceActivity {
 
@@ -103,6 +102,10 @@
 		this.stopService(SERVICE_INTENT);
 		finish();
 		return true;
+	    case R.id.settings_menu_privacy_lists:
+		i = new Intent(this, PrivacyList.class);
+		startActivity(i);
+		return true;
 	    default:
 		return false;
 	}