diff --git a/.gitignore b/.gitignore
index 8647aa6b4ef8ffc62a96f1375756c832193a1e64..969729983939e330df1d24f8c803c4c97743d59d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,13 @@ tags
 TAGS.LST
 ID
 
+
+.classpath
+.project
+.settings/org.eclipse.jdt.core.prefs
+.settings/org.eclipse.jdt.ui.prefs
+
+
 SFLPhoneservice*
 CallManagerJNI.java
 Callback.java
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 22b166688149dfb570fb0e6461bcd5e65fb992d0..34dc33fb97b09774c9400f42ea485fec6151eb00 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -53,7 +53,7 @@ as that of the covered work.
         android:label="@string/app_name"
         android:theme="@style/AppTheme" >
         <activity
-            android:name=".client.SFLPhoneHome"
+            android:name=".client.SFLPhoneHomeActivity"
             android:label="@string/title_activity_sflphone_home"
             android:screenOrientation="portrait"
             android:theme="@style/AppTheme" >
@@ -70,9 +70,6 @@ as that of the covered work.
                 android:name="android.support.PARENT_ACTIVITY"
                 android:value="com.savoirfairelinux.sflphone.client.SFLPhoneHome" />
         </activity>
-        <activity android:name=".client.AccountCreationActivity"
-                  android:label="@string/app_name"
-                  android:screenOrientation="portrait"/>
         <activity android:name=".client.AccountPreferenceActivity"
                   android:label="@string/app_name"
                   android:screenOrientation="portrait"/>
diff --git a/README b/README
index 089b63e66ae960460e077e83ed3f92405b041148..1fa98ca6913f3e671d747b9e47c44a5b676057de 100644
--- a/README
+++ b/README
@@ -24,9 +24,15 @@ Check that following files are executable:
   make-swig.sh
 
 Compile pjsip-android
-cd jni/pjsip-androi/android
-./configure-android --disable-audio (or --disable-sound)
-make dep && make
+$ pushd jni/pjproject-android/android
+$ ./configure-android --disable-sound
+$ make dep && make
+$ popd
+
+
+Generate dbus interface
+$ ./make-glue.sh
+
 
 $ ndk-build -j4
 
@@ -37,4 +43,9 @@ Check that no errors occurred. In particular, following files should have been g
   sflphoneserviceJNI.java
   ManagerImpl.java
 
+
+Add compatibility library to libs folder
+$ cp $ANDROID_SDK/extras/android/support/v13/android-support-v13.jar ./libs/
+
+
 Then build android project with your favorite JDK: eclipse or ant.
diff --git a/bin/AndroidManifest.xml b/bin/AndroidManifest.xml
index 22b166688149dfb570fb0e6461bcd5e65fb992d0..34dc33fb97b09774c9400f42ea485fec6151eb00 100644
--- a/bin/AndroidManifest.xml
+++ b/bin/AndroidManifest.xml
@@ -53,7 +53,7 @@ as that of the covered work.
         android:label="@string/app_name"
         android:theme="@style/AppTheme" >
         <activity
-            android:name=".client.SFLPhoneHome"
+            android:name=".client.SFLPhoneHomeActivity"
             android:label="@string/title_activity_sflphone_home"
             android:screenOrientation="portrait"
             android:theme="@style/AppTheme" >
@@ -70,9 +70,6 @@ as that of the covered work.
                 android:name="android.support.PARENT_ACTIVITY"
                 android:value="com.savoirfairelinux.sflphone.client.SFLPhoneHome" />
         </activity>
-        <activity android:name=".client.AccountCreationActivity"
-                  android:label="@string/app_name"
-                  android:screenOrientation="portrait"/>
         <activity android:name=".client.AccountPreferenceActivity"
                   android:label="@string/app_name"
                   android:screenOrientation="portrait"/>
diff --git a/libs/android-support-v13.jar b/libs/android-support-v13.jar
index df7f9fc24072b998d076840e2474fbcd8c1779dd..821775632e0181046acb6628bfb541d7eef4bffa 100644
Binary files a/libs/android-support-v13.jar and b/libs/android-support-v13.jar differ
diff --git a/make-glue.sh b/make-glue.sh
new file mode 100755
index 0000000000000000000000000000000000000000..421131f35375a6abf189e311bdb5c2fe3a3c3dfe
--- /dev/null
+++ b/make-glue.sh
@@ -0,0 +1,23 @@
+SRCDIR=jni/sflphone/daemon/src
+
+
+# Fix a problem with dbusxx generating *const introspect() instead of introspect()
+echo "Generating callmanager glue..."
+dbusxx-xml2cpp $SRCDIR/dbus/callmanager-introspec.xml --adaptor=$SRCDIR/dbus/callmanager-glue-tmp.h
+sed -e 's/const introspect()/introspect()/' <$SRCDIR/dbus/callmanager-glue-tmp.h >$SRCDIR/dbus/callmanager-glue.h
+rm $SRCDIR/dbus/callmanager-glue-tmp.h
+
+echo "Generating configurationmanager glue..."
+dbusxx-xml2cpp $SRCDIR/dbus/configurationmanager-introspec.xml --adaptor=$SRCDIR/dbus/configurationmanager-glue-tmp.h
+sed -e 's/const introspect()/introspect()/' <$SRCDIR/dbus/configurationmanager-glue-tmp.h >$SRCDIR/dbus/configurationmanager-glue.h
+rm $SRCDIR/dbus/configurationmanager-glue-tmp.h
+
+#echo "Generating contactmanager glue..."
+#dbusxx-xml2cpp $SRCDIR/dbus/contactmanager-introspec.xml --adaptor=$SRCDIR/dbus/contactmanager-glue-tmp.h
+#sed -e 's/const introspect()/introspect()/' <$SRCDIR/dbus/contactmanager-glue-tmp.h >$SRCDIR/dbus/contactmanager-glue.h
+#rm $SRCDIR/dbus/contactmanager-glue-tmp.h
+
+echo "Generating instance glue..."
+dbusxx-xml2cpp $SRCDIR/dbus/instance-introspec.xml --adaptor=$SRCDIR/dbus/instance-glue-tmp.h 
+sed -e 's/const introspect()/introspect()/' <$SRCDIR/dbus/instance-glue-tmp.h >$SRCDIR/dbus/instance-glue.h
+rm $SRCDIR/dbus/instance-glue-tmp.h
\ No newline at end of file
diff --git a/make-swig.sh b/make-swig.sh
index 7f679480f39bd6a8e3bca34d7e5569889ec71c27..bb86eb89de170e5aca19b0446c9ac69c7630a324 100755
--- a/make-swig.sh
+++ b/make-swig.sh
@@ -83,6 +83,9 @@ else
     exit 3
 fi
 
+
+
+
 # FIXME
 echo "Generating callmanager_wrap.cpp..."
 mkdir -p $NATIVEDIR
diff --git a/project.properties b/project.properties
index 0840b4a05983ca8ad72e34b77ca397d168125224..a3ee5ab64f5e1901414e83e26717725e035b2aae 100644
--- a/project.properties
+++ b/project.properties
@@ -11,4 +11,4 @@
 #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
 
 # Project target.
-target=android-15
+target=android-17
diff --git a/res/drawable-hdpi/ic_checkmark_holo_light.png b/res/drawable-hdpi/ic_checkmark_holo_light.png
new file mode 100644
index 0000000000000000000000000000000000000000..1607f35857df6796c7c8cf13b2c4c3b089cb988e
Binary files /dev/null and b/res/drawable-hdpi/ic_checkmark_holo_light.png differ
diff --git a/res/layout/account_management_layout.xml b/res/layout/account_management_layout.xml
deleted file mode 100644
index 004b63ed6f0c507ddee430ce0786612746c996fb..0000000000000000000000000000000000000000
--- a/res/layout/account_management_layout.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 
-Copyright (C) 2004-2012 Savoir-Faire Linux Inc.                     
-                                                                    
-Author: Alexandre Savard <alexandre.savard@gmail.com>
-                                                                    
-This program 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.                                 
-                                                                    
-This program 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 this program; if not, write to the Free Software         
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.          
-                                                                    
-Additional permission under GNU GPL version 3 section 7:            
-                                                                    
-If you modify this program, or any covered work, by linking or      
-combining it with the OpenSSL project's OpenSSL library (or a       
-modified version of that library), containing parts covered by the  
-terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.    
-grants you additional permission to convey the resulting work.      
-Corresponding Source for a non-source form of such a combination    
-shall include the source code for the parts of OpenSSL used as well 
-as that of the covered work.
- -->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_height="match_parent"
-    android:layout_width="match_parent"
-    android:orientation="vertical"
-    android:gravity="center_horizontal"
-    android:layout_below="@+id/editTo"
-    android:id="@+id/accountManagementLayout"
-    android:weightSum="1.0"
-    android:paddingLeft="8dp"
-    android:paddingRight="8dp" >
-
-    <Button
-        android:id="@+id/buttonAddAccount"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_alignParentTop="true"
-        android:onClick="onClick"
-        android:text="Add Account" />
-
-    <Button
-        android:id="@+id/buttonRemoveAccount"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_alignParentTop="true"
-        android:onClick="onClick"
-        android:text="Remove Account" />
-
-</LinearLayout>
diff --git a/res/layout/call_activity_layout.xml b/res/layout/activity_call_layout.xml
similarity index 100%
rename from res/layout/call_activity_layout.xml
rename to res/layout/activity_call_layout.xml
diff --git a/res/layout/activity_sflphone_home.xml b/res/layout/activity_sflphone_home.xml
index 29edf5d9f3bacbdf9e21e3e61e05fd05b8f9e79d..22f80220fd0bd0f303865abd28feacd1153f218d 100644
--- a/res/layout/activity_sflphone_home.xml
+++ b/res/layout/activity_sflphone_home.xml
@@ -56,6 +56,7 @@ as that of the covered work.
         android:id="@+id/phoneNumberTextEntry"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
+        android:inputType="phone"
         android:hint="Type phone number"
         android:layout_below="@+id/buttonCall"/>
 
@@ -72,6 +73,7 @@ as that of the covered work.
             android:layout_width="0dp"
             android:layout_height="match_parent"
             android:layout_weight=".5"
+            android:layout_margin="10dp"
             android:background="@drawable/call_button"
             android:gravity="center_vertical"
             android:onClick="onClick"
@@ -82,6 +84,7 @@ as that of the covered work.
             android:layout_width="0dp"
             android:layout_height="match_parent"
             android:layout_weight=".5"
+            android:layout_margin="10dp"
             android:background="@drawable/hangup_button"
             android:gravity="center_vertical"
             android:onClick="onClick"
diff --git a/res/layout/test_layout.xml b/res/layout/frag_button_section.xml
similarity index 99%
rename from res/layout/test_layout.xml
rename to res/layout/frag_button_section.xml
index 07e58f9fd71bcac850ce03efa4bfaea9812b9c59..f8b6890b3239217e000c888820aeb0714d4efc6b 100644
--- a/res/layout/test_layout.xml
+++ b/res/layout/frag_button_section.xml
@@ -107,7 +107,7 @@ as that of the covered work.
         <include layout="@layout/dialpad"/>
     </LinearLayout>
     -->
-    <com.savoirfairelinux.sflphone.client.Numpad
+    <com.savoirfairelinux.sflphone.model.Numpad
         android:id="@+id/numPad"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
diff --git a/res/layout/call_element_list.xml b/res/layout/frag_call_element.xml
similarity index 94%
rename from res/layout/call_element_list.xml
rename to res/layout/frag_call_element.xml
index 5517004effc97f66d2f383a97f39ced42eb8dd22..5f5bd844324603f769c4489784e2840853b3b7a7 100644
--- a/res/layout/call_element_list.xml
+++ b/res/layout/frag_call_element.xml
@@ -37,11 +37,10 @@ as that of the covered work.
 	android:paddingLeft="8dp"
 	android:paddingRight="8dp" >
 
-    <com.savoirfairelinux.sflphone.utils.AccountSelectionButton
+    <com.savoirfairelinux.sflphone.account.AccountSelectionSpinner
         android:id="@+id/account_selection_button"
         android:layout_height="wrap_content"
-        android:layout_width="match_parent"
-        android:text="No Account Selected (for now)"/>
+        android:layout_width="match_parent"/>
 
 	<ListView
 		android:id="@id/android:list"
diff --git a/res/layout/pref_management_layout.xml b/res/layout/frag_contact_list.xml
similarity index 69%
rename from res/layout/pref_management_layout.xml
rename to res/layout/frag_contact_list.xml
index 95593aae0ae6ac6f7bf2423b49ccc25be2304790..015f1b4609270ebe330ace320ab8100aaa8cc547 100644
--- a/res/layout/pref_management_layout.xml
+++ b/res/layout/frag_contact_list.xml
@@ -2,7 +2,7 @@
 <!-- 
 Copyright (C) 2004-2012 Savoir-Faire Linux Inc.                     
                                                                     
-Author: Alexandre Savard <alexandre.savard@gmail.com>                     
+Author: Adrien Beraud <adrien.beraud@gmail.com>                     
                                                                     
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -29,29 +29,28 @@ Corresponding Source for a non-source form of such a combination
 shall include the source code for the parts of OpenSSL used as well 
 as that of the covered work.
  -->
+
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_height="match_parent"
-    android:layout_width="match_parent"
-    android:orientation="vertical"
-    android:gravity="center_horizontal"
-    android:layout_below="@+id/editTo"
-    android:id="@+id/prefManagementLayout"
-    android:weightSum="1.0"
-    android:paddingLeft="8dp"
-    android:paddingRight="8dp" >
+	android:layout_width="match_parent"
+	android:layout_height="match_parent"
+	android:orientation="vertical"
+	android:paddingLeft="8dp"
+	android:paddingRight="8dp" >
 
-    <Button
-        android:id="@+id/buttonCodecUp"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_alignParentTop="true"
-        android:text="Codec Up" />
+	<ListView
+		android:id="@id/android:list"
+		android:layout_width="match_parent"
+		android:layout_height="match_parent"
+		android:layout_weight="1"
+		style="@style/CallElementList"
+		android:drawSelectorOnTop="false" />
 
-    <Button
-        android:id="@+id/buttonCodecDown"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_alignParentTop="true"
-        android:text="Codec Down" />
+	<TextView
+		android:id="@id/android:empty"
+		android:layout_width="match_parent"
+		android:layout_height="match_parent"
+		android:layout_gravity="center"
+		android:gravity="center"
+		android:text="No data" />
 
 </LinearLayout>
diff --git a/res/layout/item_account.xml b/res/layout/item_account.xml
new file mode 100644
index 0000000000000000000000000000000000000000..2ebaca89fb89606ba5ce110a9cb57ab1fb588e40
--- /dev/null
+++ b/res/layout/item_account.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content" >
+
+    <TextView
+        android:id="@+id/account_alias"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentLeft="true"
+        android:layout_alignParentTop="true"
+        android:textAppearance="?android:attr/textAppearanceLarge" />
+
+    <TextView
+        android:id="@+id/account_host"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentLeft="true"
+        android:layout_below="@+id/account_alias"
+        android:textAppearance="?android:attr/textAppearanceSmall" />
+    
+    <RadioButton 
+        android:id="@+id/account_checked"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:focusable="false"
+        android:clickable="false"
+        android:layout_alignParentRight="true"
+        android:layout_centerVertical="true"/>
+
+</RelativeLayout>
\ No newline at end of file
diff --git a/res/layout/call_element.xml b/res/layout/item_contact.xml
similarity index 100%
rename from res/layout/call_element.xml
rename to res/layout/item_contact.xml
diff --git a/res/layout/numpad.xml b/res/layout/numpad.xml
index d7cbb82ab7b3fcf1ac0a30896dccacc084f60931..c149042b36f84b71aa14917cbac886592427bcc5 100644
--- a/res/layout/numpad.xml
+++ b/res/layout/numpad.xml
@@ -1,38 +1,56 @@
 <?xml version="1.0" encoding="utf-8"?>
-
 <merge xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    android:layout_height="match_parent" >
+
     <TableRow
         android:layout_width="match_parent"
         android:layout_height="0px"
-        android:layout_weight="1">
-        <Button android:id="@+id/numButton1"/>
-        <Button android:id="@+id/numButton2"/>
-        <Button android:id="@+id/numButton3"/>
+        android:layout_weight="1" >
+
+        <Button
+            android:id="@+id/numButton1"
+            style="?android:attr/buttonBarButtonStyle" />
+
+        <Button android:id="@+id/numButton2" />
+
+        <Button android:id="@+id/numButton3" />
     </TableRow>
+
     <TableRow
         android:layout_width="match_parent"
         android:layout_height="0px"
-        android:layout_weight="1">
-        <Button android:id="@+id/numButton4"/>
-        <Button android:id="@+id/numButton5"/>
-        <Button android:id="@+id/numButton6"/>
+        android:layout_weight="1" >
+
+        <Button android:id="@+id/numButton4" />
+
+        <Button android:id="@+id/numButton5" />
+
+        <Button android:id="@+id/numButton6" />
     </TableRow>
+
     <TableRow
         android:layout_width="match_parent"
         android:layout_height="0px"
-        android:layout_weight="1">
-        <Button android:id="@+id/numButton7"/>
-        <Button android:id="@+id/numButton8"/>
-        <Button android:id="@+id/numButton9"/>
+        android:layout_weight="1" >
+
+        <Button android:id="@+id/numButton7" />
+
+        <Button android:id="@+id/numButton8" />
+
+        <Button android:id="@+id/numButton9" />
     </TableRow>
+
     <TableRow
         android:layout_width="match_parent"
         android:layout_height="0px"
-        android:layout_weight="1">
-        <Button android:id="@+id/numButtonStar"/>
-        <Button android:id="@+id/numButton0"/>
-        <Button android:id="@+id/numButtonSharp"/>
+        android:layout_weight="1" >
+
+        <Button android:id="@+id/numButtonStar" />
+
+        <Button android:id="@+id/numButton0" />
+
+        <Button android:id="@+id/numButtonSharp" />
     </TableRow>
-</merge>
+
+</merge>
\ No newline at end of file
diff --git a/res/menu/account_creation.xml b/res/menu/account_creation.xml
new file mode 100644
index 0000000000000000000000000000000000000000..9fc56fd4c15c6305f29e5fb87203ff2457617a60
--- /dev/null
+++ b/res/menu/account_creation.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <item
+        android:id="@+id/menuitem_create"
+        android:icon="@drawable/ic_checkmark_holo_light"
+        android:showAsAction="ifRoom"
+        android:title="Create"/>
+
+</menu>
\ No newline at end of file
diff --git a/res/menu/account_edition.xml b/res/menu/account_edition.xml
new file mode 100644
index 0000000000000000000000000000000000000000..4714e87ff7ac6f710324cba948f18c1565fc0070
--- /dev/null
+++ b/res/menu/account_edition.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <item
+        android:id="@+id/menuitem_delete"
+        android:title="Delete"
+        android:showAsAction="ifRoom"
+        android:icon="@android:drawable/ic_menu_delete"/>
+    
+        <item
+        android:id="@+id/menuitem_edit"
+        android:title="Edit"
+        android:showAsAction="ifRoom"
+        android:icon="@android:drawable/ic_menu_edit"/>
+    
+
+</menu>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f1e17c3916f5477f5ee1c79728741f121594f784..5ea9b6b2132b376e8779dddaff2e013f4a401574 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -152,6 +152,5 @@ as that of the covered work.
         <string name="default_account_category">Default Account</string> 
         <string name="account_list_category">Account List</string>
 
-        <string name="account_current_value_label">Current value:: </string>
 
 </resources>
diff --git a/res/xml/account_creation_preferences.xml b/res/xml/account_creation_preferences.xml
index 41791acc53992b6e7603fbe90f79d79ca72e530e..e7261491c2c637f09f564db19a8994ab66acd29b 100644
--- a/res/xml/account_creation_preferences.xml
+++ b/res/xml/account_creation_preferences.xml
@@ -39,64 +39,64 @@ as that of the covered work.
         android:persistent="false"
         android:defaultValue="true"
         android:title="Account enabled"
-        android:summaryOn="Current value:: enabled"
-        android:summaryOff="Current value:: disabled"/>
+        android:summaryOn="enabled"
+        android:summaryOff="disabled"/>
     <EditTextPreference
         android:id="@+id/account_creation_type"
         android:key="Account.type"
         android:persistent="false"
         android:defaultValue="SIP"
         android:title="Type"
-        android:summary="Current value:: SIP"/>
+        android:summary="SIP"/>
     <EditTextPreference
         android:id="@+id/account_creation_alias"
         android:key="Account.alias"
         android:persistent="false"
         android:defaultValue=""
         android:title="Alias"
-        android:summary="Current value:: "/>
+        android:summary=""/>
     <EditTextPreference
         android:id="@+id/account_creation_hostname"
         android:key="Account.hostname"
         android:persistent="false"
         android:defaultValue=""
         android:title="Hostname"
-        android:summary="Current value:: "/>
+        android:summary=""/>
     <EditTextPreference
         android:id="@+id/account_creation_username"
         android:key="Account.username"
         android:persistent="false"
         android:defaultValue=""
         android:title="Username"
-        android:summary="Current value:: "/>
+        android:summary=""/>
     <EditTextPreference
         android:id="@+id/account_creation_routeset"
         android:key="Account.routeset"
         android:persistent="false"
         android:defaultValue=""
         android:title="Route Set"
-        android:summary="Current value:: "/>
+        android:summary=""/>
     <EditTextPreference
         android:id="@+id/account_creation_password"
         android:key="Account.password"
         android:persistent="false"
         android:defaultValue=""
         android:title="Password"
-        android:summary="Current value:: "/>
+        android:summary=""/>
     <EditTextPreference
         android:id="@+id/account_creation_realm"
         android:key="Account.realm"
         android:persistent="false"
         android:defaultValue="*"
         android:title="Realm"
-        android:summary="Current value:: *"/>
+        android:summary="*"/>
     <EditTextPreference
         android:id="@+id/account_creation_useragent"
         android:key="Account.useragent"
         android:persistent="false"
         android:defaultValue="SFLPhone"
         android:title="User Agent"
-        android:summary="Current value:: SFLPhone"/>
+        android:summary="SFLPhone"/>
   </PreferenceCategory>
   <PreferenceCategory
       android:id="@+id/account_advanced_category"
@@ -107,138 +107,133 @@ as that of the covered work.
         android:persistent="false"
         android:defaultValue="60"
         android:title="Registration Expire"
-        android:summary="Current value:: 60"/>
+        android:summary="60"/>
     <CheckBoxPreference
         android:id="@+id/account_creation_autoanswer"
         android:key="Account.autoAnswer"
         android:persistent="false"
         android:defaultValue="false"
         android:title="Auto Answer"
-        android:summaryOn="Current value:: enabled"
-        android:summaryOff="Current value:: disabled"/>
+        android:summaryOn="enabled"
+        android:summaryOff="disabled"/>
     <EditTextPreference
         android:id="@+id/account_creation_registration_status"
         android:key="Account.registrationStatus"
         android:persistent="false"
         android:defaultValue=""
         android:title="Registration Status"
-        android:summary="Current value:: "/>
+        android:summary=""/>
     <EditTextPreference
         android:id="@+id/account_creation_registration_state_code"
         android:key="Account.registrationCode"
         android:persistent="false"
         android:defaultValue=""
         android:title="Registration Code"
-        android:summary="Current value:: "/>
+        android:summary=""/>
     <EditTextPreference
         android:id="@+id/account_creation_registration_state_desc"
         android:key="Account.registrationDescription"
         android:persistent="false"
         android:defaultValue=""
         android:title="Registration Desciption"
-        android:summary="Current value:: "/>
+        android:summary=""/>
     <EditTextPreference
         android:id="@+id/account_creation_credential_number"
         android:key="Credential.count"
         android:persistent="false"
         android:defaultValue="0"
         android:title="Credential Number"
-        android:summary="Current value:: 0"/>
+        android:summary="0"/>
     <EditTextPreference
         android:id="@+id/account_creation_dtmf_type"
         android:key="Account.dtmfType"
         android:persistent="false"
         android:defaultValue="SIP"
         android:title="DTMF Type"
-        android:summary="Current value:: SIP"/>
+        android:summary="SIP"/>
     <EditTextPreference
         android:id="@+id/account_creation_ringtone_path"
         android:key="Account.ringtonePath"
         android:persistent="false"
         android:defaultValue=""
-        android:title="Ringtone Path"
-        android:summary="Current value:: "/>
+        android:title="Ringtone Path"/>
     <CheckBoxPreference
         android:id="@+id/account_creation_ringtone_enabled"
         android:key="Account.ringtoneEnabled"
         android:persistent="false"
         android:defaultValue="true"
-        android:title="Ringtone Enabled"
-        android:summaryOn="Current value:: enabled"
-        android:summaryOff="Current value:: disabled"/>
+        android:title="Ringtone Enabled"/>
     <CheckBoxPreference
         android:id="@+id/account_creation_keep_alive"
         android:key="Account.keepAliveEnabled"
         android:persistent="false"
         android:defaultValue="false"
-        android:title="Keep Alive"
-        android:summaryOn="Current value:: enabled"
-        android:summaryOff="Current value:: disabled"/>
+        android:title="Keep Alive"/>
     <EditTextPreference
         android:id="@+id/account_creation_local_interface"
         android:key="Account.localInterface"
         android:persistent="false"
         android:defaultValue="eth0"
         android:title="Local Interface"
-        android:summary="Current value:: eth0"/>
+        android:summary="eth0"/>
     <EditTextPreference
         android:id="@+id/account_creation_interface"
         android:key="Account.interface"
         android:persistent="false"
         android:defaultValue="eht0"
         android:title="Interface"
-        android:summary="Current value:: eth0"/>
+        android:summary="eth0"/>
     <CheckBoxPreference
         android:id="@+id/account_creation_published_sameas_local"
         android:key="Account.publishedSameAsLocal"
         android:persistent="false"
         android:defaultValue="false"
         android:title="Published same as local"
-        android:summaryOn="Current value:: yes"
-        android:summaryOff="Current value:: no"/>
+        android:summaryOn="yes"
+        android:summaryOff="no"/>
     <EditTextPreference
         android:id="@+id/account_creation_local_port"
         android:key="Account.localPort"
         android:persistent="false"
         android:defaultValue="5060"
         android:title="Local Port"
-        android:summary="Current value:: 5060"/>
+        android:summary="5060"/>
     <EditTextPreference
         android:id="@+id/account_creation_published_port"
         android:key="Account.publishedPort"
         android:persistent="false"
         android:defaultValue="5060"
         android:title="Published Port"
-        android:summary="Current value:: 5060"/>
+        android:summary="5060"/>
     <EditTextPreference
         android:id="@+id/account_creation_published_address"
         android:key="Account.publishedAddress"
         android:persistent="false"
         android:defaultValue="0.0.0.0"
         android:title="Published Address"
-        android:summary="Current value:: 0.0.0.0"/>
+        android:summary="0.0.0.0"/>
     <EditTextPreference
         android:id="@+id/account_creation_display_name"
         android:key="Account.displayName"
         android:persistent="false"
         android:defaultValue="SFLPhone"
         android:title="Display Name"
-        android:summary="Current value:: SFLPhone"/>
+        android:summary="SFLPhone"/>
     <CheckBoxPreference
         android:id="@+id/account_creation_stun_enable"
         android:key="STUN.enable"
         android:persistent="false"
         android:defaultValue="false"
         android:title="Stun Enabled"
-        android:summaryOn="Current value:: enabled"
-        android:summaryOff="Current value:: disabled"/>
+        android:summaryOn="enabled"
+        android:summaryOff="disabled"/>
     <EditTextPreference
         android:id="@+id/account_creation_stun_server"
         android:key="STUN.server"
         android:persistent="false"
         android:defaultValue=""
         android:title="Stun Server"
-        android:summary="Current value:: "/>
+        android:summary=""/>
   </PreferenceCategory>
   <PreferenceCategory
       android:id="@+id/account_srtp_category"
@@ -249,64 +244,64 @@ as that of the covered work.
         android:persistent="false"
         android:defaultValue="false"
         android:title="SRTP Enabled"
-        android:summaryOn="Current value:: enabled"
-        android:summaryOff="Current value:: disabled"/>
+        android:summaryOn="enabled"
+        android:summaryOff="disabled"/>
     <CheckBoxPreference
         android:id="@+id/account_creation_srtp_key_exchange"
         android:key="SRTP.keyExchange"
         android:persistent="false"
         android:defaultValue="false"
         android:title="SRTP Key Exchange"
-        android:summaryOn="Current value:: enabled"
-        android:summaryOff="Current value:: disabled"/>
+        android:summaryOn="enabled"
+        android:summaryOff="disabled"/>
     <CheckBoxPreference
         android:id="@+id/account_creation_srtp_encryp_algo"
         android:key="SRTP.encryptionAlgorithm"
         android:persistent="false"
         android:defaultValue="false"
         android:title="SRTP Encrypt Algo"
-        android:summaryOn="Current value:: enabled"
-        android:summaryOff="Current value:: disabled"/>
+        android:summaryOn="enabled"
+        android:summaryOff="disabled"/>
     <CheckBoxPreference
         android:id="@+id/account_creation_srtp_rtp_fallback"
         android:key="SRTP.rtpFallback"
         android:persistent="false"
         android:defaultValue="false"
         android:title="SRTP RTP Fallback"
-        android:summaryOn="Current value:: enabled"
-        android:summaryOff="Current value:: disabled"/>
+        android:summaryOn="enabled"
+        android:summaryOff="disabled"/>
     <CheckBoxPreference
         android:id="@+id/account_creation_srtp_hello_hash"
         android:key="ZRTP.helloHashEnable"
         android:persistent="false"
         android:defaultValue="disabled"
         android:title="ZRTP Hello Hash"
-        android:summaryOn="Current value:: enabled"
-        android:summaryOff="Current value:: disabled"/>
+        android:summaryOn="enabled"
+        android:summaryOff="disabled"/>
     <CheckBoxPreference
         android:id="@+id/account_creation_srtp_display_sas"
         android:key="ZRTP.displaySAS"
         android:persistent="false"
         android:defaultValue="false"
         android:title="ZRTP Display SAS"
-        android:summaryOn="Current value:: enabled"
-        android:summaryOff="Current value:: disabled"/>
+        android:summaryOn="enabled"
+        android:summaryOff="disabled"/>
     <CheckBoxPreference
         android:id="@+id/account_creation_srtp_supported_warning"
         android:key="ZRTP.notSuppWarning"
         android:persistent="false"
         android:defaultValue="false"
         android:title="ZRTP Not Supported Warning"
-        android:summaryOn="Current value:: enabled"
-        android:summaryOff="Current value:: disabled"/>
+        android:summaryOn="enabled"
+        android:summaryOff="disabled"/>
     <CheckBoxPreference
         android:id="@+id/account_creation_srtp_displaysas_once"
         android:key="ZRTP.displaySasOnce"
         android:persistent="false"
         android:defaultValue="false"
         android:title="ZRTP Display SAS Once"
-        android:summaryOn="Current value:: enabled"
-        android:summaryOff="Current value:: disabled"/>
+        android:summaryOn="enabled"
+        android:summaryOff="disabled"/>
   </PreferenceCategory>
   <PreferenceCategory
       android:id="@+id/account_tls_category"
@@ -317,101 +312,101 @@ as that of the covered work.
         android:persistent="false"
         android:defaultValue="false"
         android:title="TLS Enabled"
-        android:summaryOn="Current value:: enabled"
-        android:summaryOff="Current value:: disabled"/>
+        android:summaryOn="enabled"
+        android:summaryOff="disabled"/>
     <EditTextPreference
         android:id="@+id/account_creation_tls_listener_port"
         android:key="TLS.listenerPort"
         android:persistent="false"
         android:defaultValue="5061"
         android:title="Listener Port"
-        android:summary="Current value:: 5061"/>
+        android:summary="5061"/>
     <EditTextPreference
         android:id="@+id/account_creation_tls_certificate_list_file"
         android:key="TLS.certificateListFile"
         android:persistent="false"
         android:defaultValue=""
         android:title="TLS Certificate List File"
-        android:summary="Current value:: "/>
+        android:summary=""/>
     <EditTextPreference
         android:id="@+id/account_creation_tls_certificate_file"
         android:key="TLS.certificateFile"
         android:persistent="false"
         android:defaultValue=""
         android:title="TLS Certificate File"
-        android:summary="Current value:: "/>
+        android:summary=""/>
     <EditTextPreference
         android:id="@+id/account_creation_tls_private_key_file"
         android:key="TLS.privateKeyFile"
         android:persistent="false"
         android:defaultValue="disabled"
         android:title="TLS Private Key File"
-        android:summary="Current value:: disabled"/>
+        android:summary="disabled"/>
     <EditTextPreference
         android:id="@+id/account_creation_tls_password"
         android:key="TLS.password"
         android:persistent="false"
         android:defaultValue=""
         android:title="TLS Password"
-        android:summary="Current value:: "/>
+        android:summary=""/>
     <EditTextPreference
         android:id="@+id/account_creation_tls_method"
         android:key="TLS.method"
         android:persistent="false"
         android:defaultValue=""
         android:title="TLS Method"
-        android:summary="Current value:: "/>
+        android:summary=""/>
     <EditTextPreference
         android:id="@+id/account_creation_tls_ciphers"
         android:key="TLS.ciphers"
         android:persistent="false"
         android:defaultValue=""
         android:title="TLS Ciphers"
-        android:summary="Current value:: "/>
+        android:summary=""/>
     <EditTextPreference
         android:id="@+id/account_creation_tls_server_name"
         android:key="TLS.serverName"
         android:persistent="false"
         android:defaultValue=""
         android:title="TLS Server Name"
-        android:summary="Current value:: "/>
+        android:summary=""/>
     <CheckBoxPreference
         android:id="@+id/account_creation_tls_verify_server"
         android:key="TLS.verifyServer"
         android:persistent="false"
         android:defaultValue="false"
         android:title="TLS Verify Server"
-        android:summaryOn="Current value:: enabled"
-        android:summaryOff="Current value:: disabled"/>
+        android:summaryOn="enabled"
+        android:summaryOff="disabled"/>
     <CheckBoxPreference
         android:id="@+id/account_creation_tls_verify_client"
         android:key="TLS.verifyClient"
         android:persistent="false"
         android:defaultValue="false"
         android:title="TLS Verify Client"
-        android:summaryOn="Current value:: enabled"
-        android:summaryOff="Current value:: disabled"/>
+        android:summaryOn="enabled"
+        android:summaryOff="disabled"/>
     <CheckBoxPreference
         android:id="@+id/account_creation_tls_require_client_cert"
         android:key="TLS.requireClientCertificate"
         android:persistent="false"
         android:defaultValue="false"
         android:title="TLS Require Client Certificate"
-        android:summaryOn="Current value:: enabled"
-        android:summaryOff="Current value:: disabled"/>
+        android:summaryOn="enabled"
+        android:summaryOff="disabled"/>
     <EditTextPreference
         android:id="@+id/account_creation_tls_timeout_sec"
         android:key="TLS.negotiationTimeoutSec"
         android:persistent="false"
         android:defaultValue="60"
         android:title="TLS Timeout Sec"
-        android:summary="Current value:: 60"/>
+        android:summary="60"/>
     <EditTextPreference
         android:id="@+id/account_creation_tls_timeout_msec"
         android:key="TLS.negotiationTimeoutMsec"
         android:persistent="false"
         android:defaultValue="0"
         android:title="TLS Timeout Msec"
-        android:summary="Current value:: 0"/>
+        android:summary="0"/>
   </PreferenceCategory>
 </PreferenceScreen>
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountDetail.java b/src/com/savoirfairelinux/sflphone/account/AccountDetail.java
similarity index 95%
rename from src/com/savoirfairelinux/sflphone/utils/AccountDetail.java
rename to src/com/savoirfairelinux/sflphone/account/AccountDetail.java
index 4992356e3d48ceadc93ce4b43fdd28c738536a1d..9507c2497efda620e15b30c49a1609b0a6ba597f 100644
--- a/src/com/savoirfairelinux/sflphone/utils/AccountDetail.java
+++ b/src/com/savoirfairelinux/sflphone/account/AccountDetail.java
@@ -19,7 +19,7 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-package com.savoirfairelinux.sflphone.utils;
+package com.savoirfairelinux.sflphone.account;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -58,6 +58,8 @@ public interface AccountDetail {
         }
     }
 
+    public static final String TAG = "PreferenceHashMap";
+
     public ArrayList<PreferenceEntry> getDetailValues();
 
     public ArrayList<String> getValuesOnly();
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountDetailAdvanced.java b/src/com/savoirfairelinux/sflphone/account/AccountDetailAdvanced.java
similarity index 98%
rename from src/com/savoirfairelinux/sflphone/utils/AccountDetailAdvanced.java
rename to src/com/savoirfairelinux/sflphone/account/AccountDetailAdvanced.java
index d3bace15117cdf2608c5f7a6e1f62b02a9b220f2..04de9ffce6db6589a8adc3321ca3affef49649a2 100644
--- a/src/com/savoirfairelinux/sflphone/utils/AccountDetailAdvanced.java
+++ b/src/com/savoirfairelinux/sflphone/account/AccountDetailAdvanced.java
@@ -19,10 +19,10 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-package com.savoirfairelinux.sflphone.utils;
+package com.savoirfairelinux.sflphone.account;
 
 import com.savoirfairelinux.sflphone.R;
-import com.savoirfairelinux.sflphone.utils.AccountDetail;
+import com.savoirfairelinux.sflphone.account.AccountDetail;
 
 import android.util.Log;
 
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountDetailBasic.java b/src/com/savoirfairelinux/sflphone/account/AccountDetailBasic.java
similarity index 97%
rename from src/com/savoirfairelinux/sflphone/utils/AccountDetailBasic.java
rename to src/com/savoirfairelinux/sflphone/account/AccountDetailBasic.java
index cb07474fc7735c37cd536d349df8685d5af7e467..0db25230427e13a1bc83ca595d93f1dbc9e9108b 100644
--- a/src/com/savoirfairelinux/sflphone/utils/AccountDetailBasic.java
+++ b/src/com/savoirfairelinux/sflphone/account/AccountDetailBasic.java
@@ -19,10 +19,10 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-package com.savoirfairelinux.sflphone.utils;
+package com.savoirfairelinux.sflphone.account;
 
 import com.savoirfairelinux.sflphone.R;
-import com.savoirfairelinux.sflphone.utils.AccountDetail;
+import com.savoirfairelinux.sflphone.account.AccountDetail;
 
 import android.util.Log;
 
@@ -107,6 +107,7 @@ public class AccountDetailBasic implements AccountDetail {
         ArrayList<String> valueList = new ArrayList<String>();
 
         for(AccountDetail.PreferenceEntry p : privateArray) {
+            Log.i(TAG,""+p.mValue);
             valueList.add(p.mValue);
         }
 
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountDetailSrtp.java b/src/com/savoirfairelinux/sflphone/account/AccountDetailSrtp.java
similarity index 97%
rename from src/com/savoirfairelinux/sflphone/utils/AccountDetailSrtp.java
rename to src/com/savoirfairelinux/sflphone/account/AccountDetailSrtp.java
index 7cf814948d33b5db124ea066ff20fa69e19d8cf4..d0b67ec7d8e5c2c0e86b552ec61e2941c2fa42b3 100644
--- a/src/com/savoirfairelinux/sflphone/utils/AccountDetailSrtp.java
+++ b/src/com/savoirfairelinux/sflphone/account/AccountDetailSrtp.java
@@ -19,10 +19,10 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-package com.savoirfairelinux.sflphone.utils;
+package com.savoirfairelinux.sflphone.account;
 
 import com.savoirfairelinux.sflphone.R;
-import com.savoirfairelinux.sflphone.utils.AccountDetail;
+import com.savoirfairelinux.sflphone.account.AccountDetail;
 
 import android.util.Log;
 
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountDetailTls.java b/src/com/savoirfairelinux/sflphone/account/AccountDetailTls.java
similarity index 98%
rename from src/com/savoirfairelinux/sflphone/utils/AccountDetailTls.java
rename to src/com/savoirfairelinux/sflphone/account/AccountDetailTls.java
index 1bbd5048167e974e2bb7b1191d05a3b8d145c1b7..0db164066b37bdaa098fe6ea34e7f1146e3cd63a 100644
--- a/src/com/savoirfairelinux/sflphone/utils/AccountDetailTls.java
+++ b/src/com/savoirfairelinux/sflphone/account/AccountDetailTls.java
@@ -19,10 +19,10 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-package com.savoirfairelinux.sflphone.utils;
+package com.savoirfairelinux.sflphone.account;
 
 import com.savoirfairelinux.sflphone.R;
-import com.savoirfairelinux.sflphone.utils.AccountDetail;
+import com.savoirfairelinux.sflphone.account.AccountDetail;
 
 import android.util.Log;
 
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountDetailsHandler.java b/src/com/savoirfairelinux/sflphone/account/AccountDetailsHandler.java
similarity index 99%
rename from src/com/savoirfairelinux/sflphone/utils/AccountDetailsHandler.java
rename to src/com/savoirfairelinux/sflphone/account/AccountDetailsHandler.java
index 111469fa3eb871e0dcfa920f817e32a06c0bcd37..6b8c41baaf3cbf16a1db335032d6b1fb8fa8c6e4 100644
--- a/src/com/savoirfairelinux/sflphone/utils/AccountDetailsHandler.java
+++ b/src/com/savoirfairelinux/sflphone/account/AccountDetailsHandler.java
@@ -19,18 +19,15 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-package com.savoirfairelinux.sflphone.utils;
+package com.savoirfairelinux.sflphone.account;
 
-import android.util.Log;
+import java.util.ArrayList;
+import java.util.HashMap;
 
 import com.savoirfairelinux.sflphone.R;
 import com.savoirfairelinux.sflphone.service.ServiceConstants;
 import com.savoirfairelinux.sflphone.service.StringMap;
 
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-
 public class AccountDetailsHandler {
     private static final String TAG = "AccountDetailsHandler";
 
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountManagementUI.java b/src/com/savoirfairelinux/sflphone/account/AccountManagementUI.java
similarity index 90%
rename from src/com/savoirfairelinux/sflphone/utils/AccountManagementUI.java
rename to src/com/savoirfairelinux/sflphone/account/AccountManagementUI.java
index c6ec2179b2a8a8872b25ed78c70138c3dedecdb1..d58aa7cfa68900476f91d1511aba09571f91c7e9 100644
--- a/src/com/savoirfairelinux/sflphone/utils/AccountManagementUI.java
+++ b/src/com/savoirfairelinux/sflphone/account/AccountManagementUI.java
@@ -28,15 +28,15 @@
  *  shall include the source code for the parts of OpenSSL used as well
  *  as that of the covered work.
  */
-package com.savoirfairelinux.sflphone.utils;
+package com.savoirfairelinux.sflphone.account;
 
 import java.util.ArrayList;
 
-import com.savoirfairelinux.sflphone.utils.AccountList;
+import com.savoirfairelinux.sflphone.client.receiver.AccountListReceiver;
 
 public interface AccountManagementUI
 {
-    public void setAccountList(AccountList accountList);
+    public void setAccountList(AccountListReceiver accountList);
 
     public void accountSelectedNotifyAccountList(String accountID);
 
diff --git a/src/com/savoirfairelinux/sflphone/account/AccountSelectionSpinner.java b/src/com/savoirfairelinux/sflphone/account/AccountSelectionSpinner.java
new file mode 100644
index 0000000000000000000000000000000000000000..f0f63cca65f766d719b40d9f94cc2ef81627669a
--- /dev/null
+++ b/src/com/savoirfairelinux/sflphone/account/AccountSelectionSpinner.java
@@ -0,0 +1,154 @@
+/*
+ *  Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
+ *
+ *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
+ *
+ *  This program 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.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *  Additional permission under GNU GPL version 3 section 7:
+ *
+ *  If you modify this program, or any covered work, by linking or
+ *  combining it with the OpenSSL project's OpenSSL library (or a
+ *  modified version of that library), containing parts covered by the
+ *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
+ *  grants you additional permission to convey the resulting work.
+ *  Corresponding Source for a non-source form of such a combination
+ *  shall include the source code for the parts of OpenSSL used as well
+ *  as that of the covered work.
+ */
+package com.savoirfairelinux.sflphone.account;
+
+import java.util.ArrayList;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.RadioButton;
+import android.widget.Spinner;
+
+import com.savoirfairelinux.sflphone.R;
+import com.savoirfairelinux.sflphone.adapters.AccountSelectionAdapter;
+import com.savoirfairelinux.sflphone.client.receiver.AccountListReceiver;
+import com.savoirfairelinux.sflphone.service.ISipService;
+
+public class AccountSelectionSpinner extends Spinner implements AccountManagementUI {
+    private static final String TAG = AccountSelectionSpinner.class.getSimpleName();
+    public static final String DEFAULT_ACCOUNT_ID = "IP2IP";
+    private Context mContext;
+    private AccountListReceiver mAccountList = null;
+    AccountSelectionAdapter mAdapter;
+    ISipService serviceRef;
+
+    public AccountSelectionSpinner(Context context) {
+        super(context);
+        mContext = context;
+
+    }
+
+    public AccountSelectionSpinner(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        mContext = context;
+
+    }
+
+    public AccountSelectionSpinner(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+        mContext = context;
+
+    }
+
+    private AdapterView.OnItemSelectedListener onClick = new AdapterView.OnItemSelectedListener() {
+
+        @Override
+        public void onItemSelected(AdapterView<?> arg0, View view, int pos, long arg3) {
+            // public void onClick(DialogInterface dialog, int which) {
+
+            Log.i(TAG, "Selected Account: " + mAdapter.getItem(pos));
+            if (null != view) {
+                ((RadioButton) view.findViewById(R.id.account_checked)).toggle();
+            }
+            mAdapter.setSelectedAccount(pos);
+            accountSelectedNotifyAccountList(mAdapter.getItem(pos));
+            // setSelection(cursor.getPosition(),true);
+
+        }
+
+        @Override
+        public void onNothingSelected(AdapterView<?> arg0) {
+            // TODO Auto-generated method stub
+
+        }
+
+    };
+
+    public void populate(ISipService service, ArrayList<String> accountList) {
+        Log.i(TAG, "populate");
+        serviceRef = service;
+        mAdapter = new AccountSelectionAdapter(mContext, serviceRef, accountList);
+        setOnItemSelectedListener(onClick);
+        setAdapter(mAdapter);
+    }
+
+    /****************************************
+     * AccountManagementUI Interface
+     ****************************************/
+
+    @Override
+    public void setAccountList(AccountListReceiver accountList) {
+        Log.i(TAG, "setAccountList");
+        mAccountList = accountList;
+
+    }
+
+    @Override
+    public void accountSelectedNotifyAccountList(String accountID) {
+        Log.i(TAG, "->accountSelectedNotifyAccountList");
+        if (mAccountList != null) {
+            mAccountList.accountSelected(accountID, this);
+        }
+    }
+
+    @Override
+    public void setSelectedAccount(String accountID) {
+        Log.i(TAG, "Account Selected");
+        // setText(accountID);
+    }
+
+    @Override
+    public void accountAdded(ArrayList<String> newList) {
+        mAdapter = new AccountSelectionAdapter(mContext, serviceRef, newList);
+        setOnItemSelectedListener(onClick);
+        setAdapter(mAdapter);
+        // Log.i(TAG, "Account added");
+        // mList = newList;
+        //
+        // if(newList.size() == 1) {
+        // setText(newList.get(0));
+        // }
+    }
+
+    @Override
+    public void accountRemoved() {
+        Log.i(TAG, "Account Removed");
+    }
+
+    @Override
+    public void accountUpdated() {
+        Log.i(TAG, "Account Updated");
+    }
+
+}
diff --git a/src/com/savoirfairelinux/sflphone/adapters/AccountSelectionAdapter.java b/src/com/savoirfairelinux/sflphone/adapters/AccountSelectionAdapter.java
new file mode 100644
index 0000000000000000000000000000000000000000..7f4b099303ab5e439c541b97f9bb615217dd8e95
--- /dev/null
+++ b/src/com/savoirfairelinux/sflphone/adapters/AccountSelectionAdapter.java
@@ -0,0 +1,232 @@
+package com.savoirfairelinux.sflphone.adapters;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Stack;
+
+import android.app.Activity;
+import android.content.Context;
+import android.net.Uri;
+import android.os.RemoteException;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.RadioButton;
+import android.widget.TextView;
+
+import com.savoirfairelinux.sflphone.R;
+import com.savoirfairelinux.sflphone.account.AccountDetailBasic;
+import com.savoirfairelinux.sflphone.service.ISipService;
+
+public class AccountSelectionAdapter extends BaseAdapter {
+
+    private static final String TAG = AccountSelectionAdapter.class.getSimpleName();
+
+    ArrayList<String> accountIDs;
+    Context mContext;
+    AccountManager accManager;
+    ISipService service;
+    int selectedAccount = 0;
+
+    public AccountSelectionAdapter(Context cont, ISipService s, ArrayList<String> newList) {
+        super();
+        accountIDs = newList;
+        mContext = cont;
+        service = s;
+        accManager = new AccountManager(mContext);
+    }
+
+    @Override
+    public int getCount() {
+        return accountIDs.size();
+    }
+
+    @Override
+    public String getItem(int pos) {
+        return accountIDs.get(pos);
+    }
+
+    @Override
+    public long getItemId(int pos) {
+        return 0;
+    }
+
+    @Override
+    public View getView(int pos, View convertView, ViewGroup parent) {
+        View rowView = convertView;
+        AccountView entryView = null;
+
+        if (rowView == null) {
+            LayoutInflater inflater = LayoutInflater.from(mContext);
+            rowView = inflater.inflate(R.layout.item_account, null);
+
+            entryView = new AccountView();
+            entryView.alias = (TextView) rowView.findViewById(R.id.account_alias);
+            entryView.host = (TextView) rowView.findViewById(R.id.account_host);
+            entryView.select = (RadioButton) rowView.findViewById(R.id.account_checked);
+            rowView.setTag(entryView);
+        } else {
+            entryView = (AccountView) rowView.getTag();
+        }
+
+        accManager.displayAccountDetails(accountIDs.get(pos), entryView);
+        if(pos == selectedAccount){
+            entryView.select.setChecked(true);
+        }
+
+        return rowView;
+    }
+
+    /*********************
+     * ViewHolder Pattern
+     *********************/
+    public class AccountView {
+        public TextView alias;
+        public TextView host;
+        public RadioButton select;
+    }
+
+    /**
+     * Asynchronous account details retriever
+     */
+    public class AccountManager {
+
+        // private static final String TAG = ImageManager.class.getSimpleName();
+
+        private HashMap<String, HashMap<String, String>> accountMap = new HashMap<String, HashMap<String, String>>();
+        private AccountQueue accountQueue = new AccountQueue();
+        private Thread accountLoaderThread = new Thread(new AccountQueueManager());
+
+
+        public AccountManager(Context context) {
+            accountLoaderThread.setPriority(Thread.NORM_PRIORITY - 1);
+
+        }
+
+        public void displayAccountDetails(String id, AccountView account) {
+
+            if (accountMap.containsKey(id)) {
+
+                HashMap<String, String> details = accountMap.get(id);
+                account.alias.setText(details.get(AccountDetailBasic.CONFIG_ACCOUNT_ALIAS));
+                account.host.setText(details.get(AccountDetailBasic.CONFIG_ACCOUNT_HOSTNAME));
+
+            } else {
+                queueAccount(id, account);
+            }
+        }
+
+        private void queueAccount(String id, AccountView row) {
+            // This ImageView might have been used for other images, so we clear
+            // the queue of old tasks before starting.
+            accountQueue.Clean(row);
+            AccountRef p = new AccountRef(id, row);
+
+            synchronized (accountQueue.accountRefsStack) {
+                accountQueue.accountRefsStack.push(p);
+                accountQueue.accountRefsStack.notifyAll();
+            }
+
+            // Start thread if it's not started yet
+            if (accountLoaderThread.getState() == Thread.State.NEW) {
+                accountLoaderThread.start();
+            }
+        }
+
+        /** Classes **/
+
+        private class AccountRef {
+            public String accountID;
+            public AccountView row;
+
+            public AccountRef(String u, AccountView i) {
+                accountID = u;
+                row = i;
+            }
+        }
+
+        private class AccountQueue {
+            private Stack<AccountRef> accountRefsStack = new Stack<AccountRef>();
+
+            // removes all instances of this account
+            public void Clean(AccountView view) {
+
+                for (int i = 0; i < accountRefsStack.size();) {
+                    if (accountRefsStack.get(i).row == view)
+                        accountRefsStack.remove(i);
+                    else
+                        ++i;
+                }
+            }
+        }
+
+        private class AccountQueueManager implements Runnable {
+            @Override
+            public void run() {
+                try {
+                    while (true) {
+                        // Thread waits until there are accountsID in the queue to be retrieved
+                        if (accountQueue.accountRefsStack.size() == 0) {
+                            synchronized (accountQueue.accountRefsStack) {
+                                accountQueue.accountRefsStack.wait();
+                            }
+                        }
+
+                        // When we have accounts to load
+                        if (accountQueue.accountRefsStack.size() != 0) {
+                            AccountRef accountToLoad;
+
+                            synchronized (accountQueue.accountRefsStack) {
+                                accountToLoad = accountQueue.accountRefsStack.pop();
+                            }
+
+                            HashMap<String, String> details = (HashMap<String, String>) service.getAccountDetails(accountToLoad.accountID);
+                            accountMap.put(accountToLoad.accountID, details);
+                            AccountDisplayer accDisplayer = new AccountDisplayer(details, accountToLoad.row);
+                            Activity a = (Activity) mContext;
+
+                            a.runOnUiThread(accDisplayer);
+
+                        }
+
+                        if (Thread.interrupted())
+                            break;
+                    }
+                } catch (InterruptedException e) {
+                    Log.e(TAG, e.toString());
+                } catch (RemoteException e) {
+                    Log.e(TAG, e.toString());
+                }
+            }
+        }
+
+        // Used to display details in the UI thread
+        private class AccountDisplayer implements Runnable {
+            HashMap<String, String> displayDetails;
+            AccountView displayRow;
+
+            public AccountDisplayer(HashMap<String, String> details, AccountView row) {
+                displayRow = row;
+                displayDetails = details;
+            }
+
+            public void run() {
+                displayRow.alias.setText(displayDetails.get(AccountDetailBasic.CONFIG_ACCOUNT_ALIAS));
+                displayRow.host.setText(displayDetails.get(AccountDetailBasic.CONFIG_ACCOUNT_HOSTNAME));
+            }
+        }
+
+        public void removeFromCache(Uri uri) {
+            if (accountMap.containsKey(uri)) {
+                accountMap.remove(uri);
+            }
+        }
+    }
+
+    public void setSelectedAccount(int pos) {
+       selectedAccount = pos;
+    }
+
+}
diff --git a/src/com/savoirfairelinux/sflphone/adapters/CallElementAdapter.java b/src/com/savoirfairelinux/sflphone/adapters/CallElementAdapter.java
new file mode 100644
index 0000000000000000000000000000000000000000..5196cf894fc9b22f8cfc04462d84bbedf327e673
--- /dev/null
+++ b/src/com/savoirfairelinux/sflphone/adapters/CallElementAdapter.java
@@ -0,0 +1,87 @@
+package com.savoirfairelinux.sflphone.adapters;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.savoirfairelinux.sflphone.R;
+import com.savoirfairelinux.sflphone.model.SipCall;
+
+/**
+ * A CursorAdapter that creates and update call elements using corresponding contact infos. TODO: handle contact list separatly to allow showing
+ * synchronized contacts on Call cards with multiple contacts etc.
+ */
+public class CallElementAdapter extends ArrayAdapter {
+    private ExecutorService infos_fetcher = Executors.newCachedThreadPool();
+    private Context mContext;
+    private final List mCallList;
+    private static final String CURRENT_STATE_LABEL = "    CURRENT STATE: ";
+
+    public CallElementAdapter(Context context, List callList) {
+        super(context, R.layout.item_contact, callList);
+        mContext = context;
+        mCallList = callList;
+    }
+
+    @Override
+    public View getView(int position, View convertView, ViewGroup parent) {
+        View rowView = convertView;
+        CallElementView entryView = null;
+
+        if (rowView == null) {
+            // Get a new instance of the row layout view
+            LayoutInflater inflater = LayoutInflater.from(mContext);
+            rowView = inflater.inflate(R.layout.item_contact, null);
+
+            // Hold the view objects in an object
+            // so they don't need to be re-fetched
+            entryView = new CallElementView();
+            entryView.toggleButton = (ImageButton) rowView.findViewById(R.id.toggleButton1);
+            entryView.button = (Button) rowView.findViewById(R.id.button2);
+            entryView.photo = (ImageView) rowView.findViewById(R.id.photo);
+            entryView.displayName = (TextView) rowView.findViewById(R.id.display_name);
+            entryView.phones = (TextView) rowView.findViewById(R.id.phones);
+            entryView.state = (TextView) rowView.findViewById(R.id.callstate);
+
+            // Cache the view obects in the tag
+            // so they can be re-accessed later
+            rowView.setTag(entryView);
+        } else {
+            entryView = (CallElementView) rowView.getTag();
+        }
+
+        // Transfer the stock data from the data object
+        // to the view objects
+        SipCall call = (SipCall) mCallList.get(position);
+        call.setAssociatedRowView(rowView);
+        entryView.displayName.setText(call.getDisplayName());
+        entryView.phones.setText(call.getPhone());
+        entryView.state.setText(CURRENT_STATE_LABEL + call.getCallStateString());
+
+        return rowView;
+    }
+
+    /*********************
+     * ViewHolder Pattern
+     *********************/
+    public class CallElementView {
+        protected ImageButton toggleButton;
+        protected Button button;
+        protected ImageView photo;
+        protected TextView displayName;
+        protected TextView phones;
+        public TextView state;
+    }
+    
+    
+}
diff --git a/src/com/savoirfairelinux/sflphone/client/AccountCreationActivity.java b/src/com/savoirfairelinux/sflphone/client/AccountCreationActivity.java
deleted file mode 100644
index 010e7f8dc55acff8471637a69185dc757d44dda0..0000000000000000000000000000000000000000
--- a/src/com/savoirfairelinux/sflphone/client/AccountCreationActivity.java
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- *  Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
- *
- *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
- *
- *  This program 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.
- *
- *  This program 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 this program; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-
-package com.savoirfairelinux.sflphone.client;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.preference.Preference;
-import android.preference.PreferenceActivity;
-import android.preference.PreferenceManager;
-import android.preference.EditTextPreference;
-import android.preference.CheckBoxPreference;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.Window;
-
-import com.savoirfairelinux.sflphone.R;
-import com.savoirfairelinux.sflphone.service.SipService;
-import com.savoirfairelinux.sflphone.service.ISipService;
-import com.savoirfairelinux.sflphone.utils.AccountDetail;
-import com.savoirfairelinux.sflphone.utils.AccountDetailsHandler;
-import com.savoirfairelinux.sflphone.utils.AccountDetailBasic;
-import com.savoirfairelinux.sflphone.utils.AccountDetailAdvanced;
-import com.savoirfairelinux.sflphone.utils.AccountDetailSrtp;
-import com.savoirfairelinux.sflphone.utils.AccountDetailTls;
-
-import java.util.ArrayList; 
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.Set;
-
-public class AccountCreationActivity extends PreferenceActivity
-{
-    static final String TAG = "SFLPhonePreferenceActivity";
-    private ISipService service;
-    private boolean mBound = false;
-    private PreferenceManager mPreferenceManager = null;
-    private AccountDetailBasic basicDetails;
-    private AccountDetailAdvanced advancedDetails;
-    private AccountDetailSrtp srtpDetails;
-    private AccountDetailTls tlsDetails;
-    private MenuItem createAccountAction = null;
-    private ArrayList<String> requiredFields = null;
-
-    Preference.OnPreferenceChangeListener changeNewAccountPreferenceListener = new Preference.OnPreferenceChangeListener() {
-        public boolean onPreferenceChange(Preference preference, Object newValue) {
-            preference.setSummary(getString(R.string.account_current_value_label) + (CharSequence)newValue);
-            return true;
-        }
-    };
-
-    Preference.OnPreferenceChangeListener changeNewAccountTwoStateListener = new Preference.OnPreferenceChangeListener() {
-        public boolean onPreferenceChange(Preference preference, Object newValue) {
-            return true;
-        } 
-    };
-
-    private ServiceConnection mConnection = new ServiceConnection() {
-        @Override
-        public void onServiceConnected(ComponentName className, IBinder binder) {
-            service = ISipService.Stub.asInterface(binder);
-            mBound = true;
-            Log.d(TAG, "Service connected");
-        }
-
-        @Override
-        public void onServiceDisconnected(ComponentName arg0) {
-            mBound = false;
-            Log.d(TAG, "Service disconnected");
-        }
-    };
-
-    public AccountCreationActivity()
-    {
-        basicDetails = new AccountDetailBasic();
-        advancedDetails = new AccountDetailAdvanced();
-        srtpDetails = new AccountDetailSrtp();
-        tlsDetails = new AccountDetailTls();
-
-        requiredFields = new ArrayList<String>();
-
-        requiredFields.add(AccountDetailBasic.CONFIG_ACCOUNT_ALIAS);
-        requiredFields.add(AccountDetailBasic.CONFIG_ACCOUNT_HOSTNAME);
-        requiredFields.add(AccountDetailBasic.CONFIG_ACCOUNT_USERNAME);
-        requiredFields.add(AccountDetailBasic.CONFIG_ACCOUNT_PASSWORD);
-    }
-
-    private AlertDialog createAlertDialog()
-    {
-        Activity ownerActivity = this;
-        AlertDialog.Builder builder = new AlertDialog.Builder(ownerActivity);
-        builder.setMessage("All parameters will be lost").setTitle("Account Creation")
-               .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
-                    public void onClick(DialogInterface dialog, int whichButton) {
-                        Activity activity = ((Dialog)dialog).getOwnerActivity();
-                        activity.finish();
-                    }
-                })
-                .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
-                    public void onClick(DialogInterface dialog, int whichButton) {
-                        /* Terminate with no action */
-                    }
-                });
-
-        AlertDialog alertDialog = builder.create();
-        alertDialog.setOwnerActivity(ownerActivity);
-
-        return alertDialog;
-    }
-
-    private AlertDialog createCouldNotValidateDialog(ArrayList<String> missingValue)
-    {
-        String message = "The following parameters are missing:";
-
-        for(String s : missingValue)
-            message += "\n    - " + s;
-
-        Activity ownerActivity = this;
-        AlertDialog.Builder builder = new AlertDialog.Builder(ownerActivity);
-        builder.setMessage(message).setTitle("Missing Parameters")
-               .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
-                   public void onClick(DialogInterface dialog, int whichButton) {
-                       /* Nothing to be done */
-                   }
-               });
-
-        AlertDialog alertDialog = builder.create();
-        return alertDialog;
-    }
-
-    public boolean validateAccountCreation(ArrayList<String> missingValue)
-    {
-        boolean valid = true;
-
-        for(String s : requiredFields) {
-            EditTextPreference pref = (EditTextPreference)mPreferenceManager.findPreference(s);
-            Log.i(TAG, "Looking for " + s);
-            if(pref.getText().isEmpty()) {
-                Log.i(TAG, "    INVALIDATED " + s + " " + pref.getText() + ";");
-                valid = false;
-                missingValue.add(pref.getTitle().toString());
-            }
-        }
-
-        return valid;
-    }
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        addPreferencesFromResource(R.xml.account_creation_preferences);
-        mPreferenceManager = getPreferenceManager();
-    }
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        createAccountAction = menu.add("Create Account");
-        createAccountAction.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
-        return true;
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        ArrayList<String> missingValue = new ArrayList<String>();
-        if(validateAccountCreation(missingValue)) {
-            createNewAccount();
-            finish();
-        }
-        else {
-            AlertDialog dialog = createCouldNotValidateDialog(missingValue);
-            dialog.show();
-        }
-
-        return true;
-    }
-
-    private void addPreferenceListener(AccountDetail details) {
-        for(AccountDetail.PreferenceEntry p : details.getDetailValues()) {
-            Preference pref = mPreferenceManager.findPreference(p.mKey);
-            if(pref != null) {
-                if(!p.isTwoState) {
-                    pref.setOnPreferenceChangeListener(changeNewAccountPreferenceListener);
-                }
-            }
-        }
-    }
-
-    @Override
-    protected void onStart() {
-        super.onStart();
-
-        addPreferenceListener(basicDetails);
-        addPreferenceListener(advancedDetails);
-        addPreferenceListener(srtpDetails);
-        addPreferenceListener(tlsDetails);
- 
-        if(!mBound) {
-            Log.i(TAG, "onStart: Binding service...");
-            Intent intent = new Intent(this, SipService.class);
-            bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
-        }
-    }
-
-    @Override
-    protected void onStop() {
-        super.onStop();
-
-        if(mBound) {
-            Log.i(TAG, "onStop: Unbinding service...");
-            unbindService(mConnection);
-            mBound = false;
-        }
-    }
-
-    @Override
-    public void onBackPressed() {
-
-        AlertDialog dialog = createAlertDialog();
-        dialog.show();
-    }
-
-    private void updateAccountDetails(HashMap<String, String> accountDetails, AccountDetail det) {
-        for(AccountDetail.PreferenceEntry p : det.getDetailValues()) {
-            Preference pref = mPreferenceManager.findPreference(p.mKey);
-            if(pref != null) {
-                if(p.isTwoState) {
-                    CheckBoxPreference boxPref = (CheckBoxPreference) pref;
-                    accountDetails.put(p.mKey, boxPref.isChecked() ? "true" : "false");
-                }
-                else {
-                    EditTextPreference textPref = (EditTextPreference) pref;
-                    accountDetails.put(p.mKey, textPref.getText());
-                }
-            }
-        }
-    }
-
-    private void createNewAccount() {
-
-        HashMap<String, String> accountDetails = new HashMap<String, String>();
-
-        updateAccountDetails(accountDetails, basicDetails);
-        updateAccountDetails(accountDetails, advancedDetails);
-        updateAccountDetails(accountDetails, srtpDetails);
-        updateAccountDetails(accountDetails, tlsDetails);
-
-        try {
-            Log.i(TAG, "ADD ACCOUNT");
-            service.addAccount(accountDetails);
-        } catch (RemoteException e) {
-            Log.e(TAG, "Cannot call service method", e);
-        }
-    }
-}
diff --git a/src/com/savoirfairelinux/sflphone/client/AccountPreferenceActivity.java b/src/com/savoirfairelinux/sflphone/client/AccountPreferenceActivity.java
index 5c105e0953bf4a22528fffab8fd22f2dd6b9b231..a11b80cc223f8c1be1f195d059cc8180b62703fb 100644
--- a/src/com/savoirfairelinux/sflphone/client/AccountPreferenceActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/AccountPreferenceActivity.java
@@ -31,75 +31,98 @@
 
 package com.savoirfairelinux.sflphone.client;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+
 import android.app.Activity;
 import android.app.AlertDialog;
 import android.app.Dialog;
-import android.content.ComponentName;
-import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.os.Bundle;
-import android.os.IBinder;
-import android.os.RemoteException;
+import android.preference.CheckBoxPreference;
+import android.preference.EditTextPreference;
 import android.preference.Preference;
 import android.preference.PreferenceActivity;
 import android.preference.PreferenceManager;
-import android.preference.PreferenceScreen;
-import android.preference.EditTextPreference;
-import android.preference.CheckBoxPreference;
 import android.util.Log;
 import android.view.Menu;
+import android.view.MenuInflater;
 import android.view.MenuItem;
 
 import com.savoirfairelinux.sflphone.R;
-import com.savoirfairelinux.sflphone.utils.AccountDetail;
-import com.savoirfairelinux.sflphone.utils.AccountDetailsHandler;
-import com.savoirfairelinux.sflphone.utils.AccountDetailBasic;
-import com.savoirfairelinux.sflphone.utils.AccountDetailAdvanced;
-import com.savoirfairelinux.sflphone.utils.AccountDetailSrtp;
-import com.savoirfairelinux.sflphone.utils.AccountDetailTls;
-
-import java.util.HashMap;
-import java.util.ArrayList;
+import com.savoirfairelinux.sflphone.account.AccountDetail;
+import com.savoirfairelinux.sflphone.account.AccountDetailAdvanced;
+import com.savoirfairelinux.sflphone.account.AccountDetailBasic;
+import com.savoirfairelinux.sflphone.account.AccountDetailSrtp;
+import com.savoirfairelinux.sflphone.account.AccountDetailTls;
 
-public class AccountPreferenceActivity extends PreferenceActivity
-{
+public class AccountPreferenceActivity extends PreferenceActivity {
     private static final String TAG = "AccoutPreferenceActivity";
-    public static final int ACCOUNT_MODIFIED = Activity.RESULT_FIRST_USER + 0;
-    public static final int ACCOUNT_NOT_MODIFIED = Activity.RESULT_FIRST_USER + 1;
-    public static final int ACCOUNT_DELETED = Activity.RESULT_FIRST_USER + 2;
+
+    public static final String KEY_MODE = "mode";
+
+    public interface mode {
+        static final int CREATION_MODE = 0;
+        static final int EDITION_MODE = 1;
+    }
+
+    public interface result {
+        static final int ACCOUNT_CREATED = Activity.RESULT_FIRST_USER + 0;
+        static final int ACCOUNT_MODIFIED = Activity.RESULT_FIRST_USER + 1;
+        static final int ACCOUNT_DELETED = Activity.RESULT_FIRST_USER + 2;
+    }
 
     private AccountDetailBasic basicDetails = null;
     private AccountDetailAdvanced advancedDetails = null;
     private AccountDetailSrtp srtpDetails = null;
     private AccountDetailTls tlsDetails = null;
     private PreferenceManager mPreferenceManager;
-    private HashMap<String, String> mPreferenceMap;
-    private MenuItem deleteAccountAction = null;
     private String mAccountID;
-           
-    Preference.OnPreferenceChangeListener changeBasicPreferenceListener = 
-                                            new Preference.OnPreferenceChangeListener() {
-        public boolean onPreferenceChange(Preference preference, Object newValue) {
-            preference.setSummary(getString(R.string.account_current_value_label)+(CharSequence)newValue);
-            
-            // String preferenceKey = basicDetailKeys.get(preference.getOrder()).mKey; 
-            // accountPreference.preferenceMap.put(preferenceKey, ((CharSequence)newValue).toString());
-            basicDetails.setDetailString(preference.getOrder(), ((CharSequence)newValue).toString());
-            // if(preferenceKey == AccountDetailBasic.CONFIG_ACCOUNT_ALIAS)
-            //     accountPreference.mScreen.setTitle(((CharSequence)newValue.toString()));
-            return true;
-        }
-    };
+    private ArrayList<String> requiredFields = null;
 
-    Preference.OnPreferenceChangeListener changeNewAccountTwoStateListener = 
-                                            new Preference.OnPreferenceChangeListener() {
-        public boolean onPreferenceChange(Preference preference, Object newValue) {
-            return true;
+    
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        addPreferencesFromResource(R.xml.account_creation_preferences);
+        mPreferenceManager = getPreferenceManager();
+
+        Bundle b = getIntent().getExtras();
+
+        switch (b.getInt(KEY_MODE)) {
+        case mode.CREATION_MODE:
+            Log.i(TAG, "CREATION");
+            initCreation();
+            break;
+        case mode.EDITION_MODE:
+            Log.i(TAG, "ESDITION");
+            initEdition();
+            break;
         }
-    };
 
-    private void init() {
+        requiredFields = new ArrayList<String>();
+        requiredFields.add(AccountDetailBasic.CONFIG_ACCOUNT_ALIAS);
+        requiredFields.add(AccountDetailBasic.CONFIG_ACCOUNT_HOSTNAME);
+        requiredFields.add(AccountDetailBasic.CONFIG_ACCOUNT_USERNAME);
+        requiredFields.add(AccountDetailBasic.CONFIG_ACCOUNT_PASSWORD);
+
+    }
+
+    private void initCreation() {
+        basicDetails = new AccountDetailBasic();
+        advancedDetails = new AccountDetailAdvanced();
+        srtpDetails = new AccountDetailSrtp();
+        tlsDetails = new AccountDetailTls();
+
+        addPreferenceListener(basicDetails);
+        addPreferenceListener(advancedDetails);
+        addPreferenceListener(srtpDetails);
+        addPreferenceListener(tlsDetails);
+
+    }
+    
+    private void initEdition() {
 
         Bundle b = getIntent().getExtras();
         mAccountID = b.getString("AccountID");
@@ -108,7 +131,7 @@ public class AccountPreferenceActivity extends PreferenceActivity
         ArrayList<String> srtpPreferenceList = b.getStringArrayList(AccountDetailSrtp.BUNDLE_TAG);
         ArrayList<String> tlsPreferenceList = b.getStringArrayList(AccountDetailTls.BUNDLE_TAG);
 
-        basicDetails = new AccountDetailBasic(basicPreferenceList); 
+        basicDetails = new AccountDetailBasic(basicPreferenceList);
         advancedDetails = new AccountDetailAdvanced(advancedPreferenceList);
         srtpDetails = new AccountDetailSrtp(srtpPreferenceList);
         tlsDetails = new AccountDetailTls(tlsPreferenceList);
@@ -124,143 +147,230 @@ public class AccountPreferenceActivity extends PreferenceActivity
         addPreferenceListener(tlsDetails);
     }
 
-    private void setPreferenceDetails(AccountDetail details) {
-        for(AccountDetail.PreferenceEntry p : details.getDetailValues()) {
-            Preference pref = mPreferenceManager.findPreference(p.mKey);
-            if(pref != null) {
-                if(!p.isTwoState) {
-                    ((EditTextPreference)pref).setText(p.mValue);
-                    pref.setSummary(getString(R.string.account_current_value_label) + p.mValue);
-                }
-            }
-        }
-    }
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        MenuInflater inflater = getMenuInflater();
 
-    private void addPreferenceListener(AccountDetail details) {
-        for(AccountDetail.PreferenceEntry p : details.getDetailValues()) {
-            Preference pref = mPreferenceManager.findPreference(p.mKey);
-            if(pref != null) {
-                if(!p.isTwoState) {
-                    pref.setOnPreferenceChangeListener(changeBasicPreferenceListener);
-                }
-            }
-        }
-    }
+        Bundle b = getIntent().getExtras();
 
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
+        switch (b.getInt(KEY_MODE)) {
+        case mode.CREATION_MODE:
+            Log.i(TAG, "CREATION");
+            inflater.inflate(R.menu.account_creation, menu);
+            break;
+        case mode.EDITION_MODE:
+            Log.i(TAG, "onCreateOptionsMenu: " + mAccountID);
 
-        addPreferencesFromResource(R.xml.account_creation_preferences);
-        mPreferenceManager = getPreferenceManager();
+            if (mAccountID.equals("IP2IP"))
+                return true;
 
-        init();
-    }
+            inflater.inflate(R.menu.account_edition, menu);
+            break;
+        }
 
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        Log.i(TAG, "onCreateOptionsMenu: " + mAccountID);
-        if(mAccountID.equals("IP2IP"))
-            return true;
-          
-          
-        deleteAccountAction = menu.add("Delete Account");
-        deleteAccountAction.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
         return true;
     }
 
     @Override
-    protected void onStart() {
-        super.onStart();
-    }
-
-    @Override
-    protected void onStop() {
-       super.onStop();
-    }
+    public void onBackPressed() {
+        Bundle b = getIntent().getExtras();
+        switch (b.getInt(KEY_MODE)) {
+        case mode.CREATION_MODE:
+            Log.i(TAG, "CREATION");
+            AlertDialog dialog = createCancelDialog();
+            dialog.show();
+            break;
+        case mode.EDITION_MODE:
+            finish();
+        }
 
-    @Override
-    protected void onDestroy() {
-        super.onDestroy();
     }
 
-    @Override
-    public void onBackPressed() {
-        Bundle bundle = new Bundle();
-        bundle.putString("AccountID", mAccountID);
-        bundle.putStringArrayList(AccountDetailBasic.BUNDLE_TAG, basicDetails.getValuesOnly()); 
-        bundle.putStringArrayList(AccountDetailAdvanced.BUNDLE_TAG, advancedDetails.getValuesOnly());
-        bundle.putStringArrayList(AccountDetailSrtp.BUNDLE_TAG, srtpDetails.getValuesOnly());
-        bundle.putStringArrayList(AccountDetailTls.BUNDLE_TAG, tlsDetails.getValuesOnly());
-
-        Intent resultIntent = new Intent();
-        resultIntent.putExtras(bundle);
-
-        setResult(ACCOUNT_MODIFIED, resultIntent);
-        finish(); 
-    }
 
     @Override
     public boolean onOptionsItemSelected(MenuItem item) {
-        AlertDialog dialog = createAlertDialog();
-        dialog.show();
+
+        switch (item.getItemId()) {
+        case R.id.menuitem_delete:
+            AlertDialog dialog = createDeleteDialog();
+            dialog.show();
+            break;
+        case R.id.menuitem_create:
+            processAccount(result.ACCOUNT_CREATED);
+            break;
+        case R.id.menuitem_edit:
+            processAccount(result.ACCOUNT_MODIFIED);
+            break;
+
+        }
 
         return true;
     }
 
-    private AlertDialog createAlertDialog()
-    {
-        Activity ownerActivity = this;
-        AlertDialog.Builder builder = new AlertDialog.Builder(ownerActivity);
-        builder.setMessage("Do you realy want to delete this account").setTitle("Delete Account")
-               .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
-                   public void onClick(DialogInterface dialog, int whichButton) {
-                       Bundle bundle = new Bundle();
-                       bundle.putString("AccountID", mAccountID);
-
-                       Intent resultIntent = new Intent();
-                       resultIntent.putExtras(bundle);
-
-                       Activity activity = ((Dialog)dialog).getOwnerActivity();
-                       activity.setResult(ACCOUNT_DELETED, resultIntent);
-                       activity.finish();
-                   }
-               })
-               .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
-                   public void onClick(DialogInterface dialog, int whichButton) {
-                       /* Terminate with no action */
-                   }
-               });
+    private void processAccount(int resultCode) {
+        AlertDialog dialog;
+        ArrayList<String> missingValue = new ArrayList<String>();
+        if (validateAccountCreation(missingValue)) {
+
+            Bundle bundle = new Bundle();
+            bundle.putString("AccountID", mAccountID);
+            HashMap<String, String> accountDetails = new HashMap<String, String>();
+
+            updateAccountDetails(accountDetails, basicDetails);
+            updateAccountDetails(accountDetails, advancedDetails);
+            updateAccountDetails(accountDetails, srtpDetails);
+            updateAccountDetails(accountDetails, tlsDetails);
+
+            bundle.putSerializable(AccountDetail.TAG, accountDetails);
+            Intent resultIntent = new Intent();
+            resultIntent.putExtras(bundle);
+
+            setResult(resultCode, resultIntent);
+            finish();
+        } else {
+            dialog = createCouldNotValidateDialog(missingValue);
+            dialog.show();
+        }
 
-        AlertDialog alertDialog = builder.create();
-        alertDialog.setOwnerActivity(ownerActivity);
+    }
 
-        return alertDialog;
+    public boolean validateAccountCreation(ArrayList<String> missingValue) {
+        boolean valid = true;
+
+        for (String s : requiredFields) {
+            EditTextPreference pref = (EditTextPreference) mPreferenceManager.findPreference(s);
+            Log.i(TAG, "Looking for " + s);
+            if (pref.getText().isEmpty()) {
+                Log.i(TAG, "    INVALIDATED " + s + " " + pref.getText() + ";");
+                valid = false;
+                missingValue.add(pref.getTitle().toString());
+            }
+        }
+
+        return valid;
     }
 
+   
     private void updateAccountDetails(HashMap<String, String> accountDetails, AccountDetail det) {
-        for(AccountDetail.PreferenceEntry p : det.getDetailValues()) {
+        for (AccountDetail.PreferenceEntry p : det.getDetailValues()) {
             Preference pref = mPreferenceManager.findPreference(p.mKey);
-            if(pref != null) {
-                if(p.isTwoState) {
+            if (pref != null) {
+                if (p.isTwoState) {
                     CheckBoxPreference boxPref = (CheckBoxPreference) pref;
                     accountDetails.put(p.mKey, boxPref.isChecked() ? "true" : "false");
-                }
-                else {
-                    EditTextPreference textPref = (EditTextPreference)pref;
+                } else {
+                    EditTextPreference textPref = (EditTextPreference) pref;
                     accountDetails.put(p.mKey, textPref.getText());
                 }
             }
         }
     }
 
-    private void updateAccountDetails() {
-        HashMap<String, String> accountDetails = new HashMap<String, String>();
+    Preference.OnPreferenceChangeListener changeBasicPreferenceListener = new Preference.OnPreferenceChangeListener() {
+        public boolean onPreferenceChange(Preference preference, Object newValue) {
+            preference.setSummary((CharSequence) newValue);
+            basicDetails.setDetailString(preference.getOrder(), ((CharSequence) newValue).toString());
+            return true;
+        }
+    };
+    
+    private void setPreferenceDetails(AccountDetail details) {
+        for (AccountDetail.PreferenceEntry p : details.getDetailValues()) {
+            Preference pref = mPreferenceManager.findPreference(p.mKey);
+            if (pref != null) {
+                if (!p.isTwoState) {
+                    ((EditTextPreference) pref).setText(p.mValue);
+                    pref.setSummary(p.mValue);
+                }
+            }
+        }
+    }
 
-        updateAccountDetails(accountDetails, basicDetails);
-        updateAccountDetails(accountDetails, advancedDetails);
-        updateAccountDetails(accountDetails, srtpDetails);
-        updateAccountDetails(accountDetails, tlsDetails);
+    private void addPreferenceListener(AccountDetail details) {
+        for (AccountDetail.PreferenceEntry p : details.getDetailValues()) {
+            Preference pref = mPreferenceManager.findPreference(p.mKey);
+            if (pref != null) {
+                if (!p.isTwoState) {
+                    pref.setOnPreferenceChangeListener(changeBasicPreferenceListener);
+                }
+            }
+        }
     }
-}
 
+    
+    
+    
+    
+    /******************************************
+     * 
+     * AlertDialogs
+     * 
+     ******************************************/
+    
+    private AlertDialog createCouldNotValidateDialog(ArrayList<String> missingValue) {
+        String message = "The following parameters are missing:";
+
+        for (String s : missingValue)
+            message += "\n    - " + s;
+
+        Activity ownerActivity = this;
+        AlertDialog.Builder builder = new AlertDialog.Builder(ownerActivity);
+        builder.setMessage(message).setTitle("Missing Parameters").setPositiveButton("Ok", new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialog, int whichButton) {
+                /* Nothing to be done */
+            }
+        });
+
+        AlertDialog alertDialog = builder.create();
+        return alertDialog;
+    }
+    
+    private AlertDialog createCancelDialog() {
+        Activity ownerActivity = this;
+        AlertDialog.Builder builder = new AlertDialog.Builder(ownerActivity);
+        builder.setMessage("All parameters will be lost").setTitle("Account Creation").setPositiveButton("Ok", new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialog, int whichButton) {
+                Activity activity = ((Dialog) dialog).getOwnerActivity();
+                activity.finish();
+            }
+        }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialog, int whichButton) {
+                /* Terminate with no action */
+            }
+        });
+
+        AlertDialog alertDialog = builder.create();
+        alertDialog.setOwnerActivity(ownerActivity);
+
+        return alertDialog;
+    }
+    
+    private AlertDialog createDeleteDialog() {
+        Activity ownerActivity = this;
+        AlertDialog.Builder builder = new AlertDialog.Builder(ownerActivity);
+        builder.setMessage("Do you realy want to delete this account").setTitle("Delete Account")
+                .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialog, int whichButton) {
+                        Bundle bundle = new Bundle();
+                        bundle.putString("AccountID", mAccountID);
+
+                        Intent resultIntent = new Intent();
+                        resultIntent.putExtras(bundle);
+
+                        Activity activity = ((Dialog) dialog).getOwnerActivity();
+                        activity.setResult(result.ACCOUNT_DELETED, resultIntent);
+                        activity.finish();
+                    }
+                }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialog, int whichButton) {
+                        /* Terminate with no action */
+                    }
+                });
+
+        AlertDialog alertDialog = builder.create();
+        alertDialog.setOwnerActivity(ownerActivity);
+
+        return alertDialog;
+    }
+
+}
diff --git a/src/com/savoirfairelinux/sflphone/client/AccountSelectionDialog.java b/src/com/savoirfairelinux/sflphone/client/AccountSelectionDialog.java
deleted file mode 100644
index 32d8a1b8628fdbcfd524dce2b88a0752a2c7ef2a..0000000000000000000000000000000000000000
--- a/src/com/savoirfairelinux/sflphone/client/AccountSelectionDialog.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- *  Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
- *
- *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
- *
- *  This program 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.
- *
- *  This program 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 this program; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-package com.savoirfairelinux.sflphone.client;
-
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-import android.widget.TextView;
-
-import java.util.ArrayList;
-
-import com.savoirfairelinux.sflphone.utils.AccountSelectionButton;
-
-public class AccountSelectionDialog extends AlertDialog
-{
-    private static final String TAG = "AccountSelectionDialog";
-    Context mContext;
-    ListView mListView;
-    ArrayAdapter mListAdapter;
-    ArrayList<String> mItems;
-    AccountSelectionButton mButton;
-
-    public AccountSelectionDialog(Context context, ArrayList<String> items, AccountSelectionButton b)
-    {
-        super(context);
-        mContext = context;
-        mItems = items;
-        mButton = b;
-    } 
-
-    private AdapterView.OnItemClickListener onClick = new AdapterView.OnItemClickListener() 
-    {
-        // public void onClick(DialogInterface dialog, int which) {
-        public void onItemClick (AdapterView<?> parent, View view, int position, long id) {
-            Log.i(TAG, "Selected Account: " + ((TextView)view).getText());
-            // mButton.setText(((TextView)view).getText());
-            mButton.accountSelectedNotifyAccountList(((TextView)view).getText().toString());
-        }
-    };
-
-    public void onCreate(Bundle savedInstanceState)
-    {
-        mListView = new ListView(mContext);
-
-        mListAdapter = new ArrayAdapter(mContext, android.R.layout.simple_expandable_list_item_1, mItems.toArray());
-
-        mListView.setOnItemClickListener(onClick);
-        mListView.setAdapter(mListAdapter);
-        setContentView(mListView);
-    }
-
-    public Dialog onCreateDialog(Bundle savedInstanceState)
-    {
-        AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
-        builder.setTitle("Account Selection");
-
-        return builder.create();
-    }
-}
diff --git a/src/com/savoirfairelinux/sflphone/client/CallActivity.java b/src/com/savoirfairelinux/sflphone/client/CallActivity.java
index 91c52b0e7c70afa2c1b9df6b01a9d3262f66371c..3b0bfd5ab7fca67268b97846acc0376c942304c2 100644
--- a/src/com/savoirfairelinux/sflphone/client/CallActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/CallActivity.java
@@ -48,7 +48,7 @@ import android.view.View.OnClickListener;
 import android.widget.TextView;
 
 import com.savoirfairelinux.sflphone.R;
-import com.savoirfairelinux.sflphone.client.SipCall;
+import com.savoirfairelinux.sflphone.model.SipCall;
 import com.savoirfairelinux.sflphone.service.CallManagerCallBack;
 import com.savoirfairelinux.sflphone.service.ISipService;
 import com.savoirfairelinux.sflphone.service.SipService;
@@ -77,7 +77,7 @@ public class CallActivity extends Activity implements OnClickListener
     protected void onCreate(Bundle savedInstanceState)
     {
         super.onCreate(savedInstanceState);
-        setContentView(R.layout.call_activity_layout);
+        setContentView(R.layout.activity_call_layout);
 
         Bundle b = getIntent().getExtras();
         // Parcelable value = b.getParcelable("CallInfo");
diff --git a/src/com/savoirfairelinux/sflphone/client/CallElementList.java b/src/com/savoirfairelinux/sflphone/client/CallElementList.java
deleted file mode 100644
index bc115339fa3669da0639b5b1f348be5f86e9240d..0000000000000000000000000000000000000000
--- a/src/com/savoirfairelinux/sflphone/client/CallElementList.java
+++ /dev/null
@@ -1,424 +0,0 @@
-/*
- *  Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
- *
- *  Author: Adrien Beraud <adrien.beraud@gmail.com>
- *
- *  This program 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.
- *
- *  This program 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 this program; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-package com.savoirfairelinux.sflphone.client;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import android.app.Activity;
-import android.app.ListFragment;
-import android.app.LoaderManager;
-import android.app.AlertDialog;
-import android.app.AlertDialog.Builder;
-import android.content.ContentResolver;
-import android.content.ContentUris;
-import android.content.Context;
-import android.content.CursorLoader;
-import android.content.DialogInterface;
-import android.content.Loader;
-import android.database.Cursor;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.RemoteException;
-import android.provider.*;
-import android.provider.ContactsContract.CommonDataKinds;
-import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.provider.ContactsContract.CommonDataKinds.SipAddress;
-import android.provider.ContactsContract.Contacts;
-import android.util.Log;
-import android.view.*;
-import android.widget.AdapterView.OnItemLongClickListener;
-import android.widget.AdapterView.OnItemSelectedListener;
-import android.widget.*;
-import java.util.List;
-import java.util.ArrayList;
-
-import com.savoirfairelinux.sflphone.R;
-import com.savoirfairelinux.sflphone.service.ISipService;
-import com.savoirfairelinux.sflphone.utils.AccountSelectionButton;
-import com.savoirfairelinux.sflphone.utils.AccountList;
-
-/**
- * Main list of Call Elements.
- * We don't manage contacts ourself so they are
- */
-public class CallElementList extends ListFragment implements LoaderManager.LoaderCallbacks<Cursor>
-{
-    private static final String TAG = "CallElementList";
-    private static final String CURRENT_STATE_LABEL = "    CURRENT STATE: ";
-    private ContactManager mContactManager;
-    private CallElementAdapter mAdapter;
-    private String mCurFilter;
-    private SFLPhoneHome sflphoneHome;
-    private SFLphoneApplication sflphoneApplication;
-    private ISipService service;
-    private AccountSelectionButton mAccountSelectionButton;
-    private AccountList mAccountList;
-
-    static final String[] CONTACTS_SUMMARY_PROJECTION = new String[] { Contacts._ID, Contacts.DISPLAY_NAME,
-                                                                       Contacts.PHOTO_ID, Contacts.LOOKUP_KEY };
-    static final String[] CONTACTS_PHONES_PROJECTION = new String[] { Phone.NUMBER, Phone.TYPE };
-    static final String[] CONTACTS_SIP_PROJECTION = new String[] { SipAddress.SIP_ADDRESS, SipAddress.TYPE };
-
-    @Override
-    public void onAttach(Activity activity) {
-        super.onAttach(activity);
-        sflphoneHome = (SFLPhoneHome) activity;
-        service = ((SFLphoneApplication) sflphoneHome.getApplication()).getSipService();
-        mAccountList = ((SFLphoneApplication) sflphoneHome.getApplication()).getAccountList();
-        Log.w(TAG, "onAttach() service=" + service + ", accountList=" + mAccountList);
-    }
-
-    public String getSelectedAccount() {
-        return mAccountSelectionButton.getText().toString();
-    }
-
-    /**
-     * Runnable that fill information in a contact card asynchroniously.
-     */
-    public static class InfosLoader implements Runnable
-    {
-        private View view;
-        private long cid;
-        private ContentResolver cr;
-
-        public InfosLoader(Context context, View element, long contact_id)
-        {
-            cid = contact_id;
-            cr = context.getContentResolver();
-            view = element;
-        }
-
-        public static Bitmap loadContactPhoto(ContentResolver cr, long  id) {
-            Uri uri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, id);
-            InputStream input = ContactsContract.Contacts.openContactPhotoInputStream(cr, uri);
-            if (input == null) {
-                return null;
-            }
-            return BitmapFactory.decodeStream(input);
-        }
-		
-        @Override
-        public void run()
-        {
-             final Bitmap photo_bmp = loadContactPhoto(cr, cid);
-
-             Cursor phones = cr.query(CommonDataKinds.Phone.CONTENT_URI,
-                                      CONTACTS_PHONES_PROJECTION,
-                                      CommonDataKinds.Phone.CONTACT_ID + " = ?",
-                                      new String[] { Long.toString(cid) }, null);
-
-            final List<String> numbers = new ArrayList<String>();
-            while (phones.moveToNext()) {
-                String number = phones.getString(phones.getColumnIndex(CommonDataKinds.Phone.NUMBER));
-                //int type = phones.getInt(phones.getColumnIndex(CommonDataKinds.Phone.TYPE));
-                numbers.add(number);
-            }
-            phones.close();
-            // TODO: same for SIP adresses.
-
-            final Bitmap bmp = photo_bmp;
-            view.post(new Runnable()
-            {
-                @Override
-                public void run()
-                {
-                /*
-                ImageView photo_view = (ImageView) view.findViewById(R.id.photo);
-                TextView phones_txt = (TextView) view.findViewById(R.id.phones);
-
-                if (photo_bmp != null) {
-                    photo_view.setImageBitmap(bmp);
-                    photo_view.setVisibility(View.VISIBLE);
-                } else {
-                    photo_view.setVisibility(View.GONE);
-                }
-
-                if (numbers.size() > 0) {
-                    String phonestxt = numbers.get(0);
-                    for (int i = 1, n = numbers.size(); i < n; i++)
-                        phonestxt += "\n" + numbers.get(i);
-                    phones_txt.setText(phonestxt);
-                    phones_txt.setVisibility(View.VISIBLE);
-                } else
-                    phones_txt.setVisibility(View.GONE);
-                */
-                }
-            });
-        }
-    }
-
-    /**
-     * A CursorAdapter that creates and update call elements using corresponding contact infos.
-     * TODO: handle contact list separatly to allow showing synchronized contacts on Call cards with multiple contacts etc.
-     */
-    public static class CallElementAdapter extends ArrayAdapter
-    {
-        private ExecutorService infos_fetcher = Executors.newCachedThreadPool();
-        private Context mContext;
-        private final List mCallList;
-
-        public CallElementAdapter(Context context, List callList)
-        {
-            super(context, R.layout.call_element, callList);
-            mContext = context;
-            mCallList = callList;
-        }
-
-        @Override
-        public View getView(int position, View convertView, ViewGroup parent)
-        {
-            View rowView = convertView;
-            CallElementView entryView = null;
-
-            if(rowView == null)
-            {
-                // Get a new instance of the row layout view
-                LayoutInflater inflater = LayoutInflater.from(mContext);
-                rowView = inflater.inflate(R.layout.call_element, null);
-
-                // Hold the view objects in an object
-                // so they don't need to be re-fetched
-                entryView = new CallElementView();
-                entryView.toggleButton = (ImageButton) rowView.findViewById(R.id.toggleButton1);
-                entryView.button = (Button) rowView.findViewById(R.id.button2);
-                entryView.photo = (ImageView) rowView.findViewById(R.id.photo);
-                entryView.displayName = (TextView) rowView.findViewById(R.id.display_name);
-                entryView.phones = (TextView) rowView.findViewById(R.id.phones);
-                entryView.state = (TextView) rowView.findViewById(R.id.callstate);
-
-                // Cache the view obects in the tag
-                // so they can be re-accessed later
-                rowView.setTag(entryView);
-            } else {
-                entryView = (CallElementView) rowView.getTag();
-            }
-
-            // Transfer the stock data from the data object
-            // to the view objects
-            SipCall call = (SipCall) mCallList.get(position);
-            call.setAssociatedRowView(rowView);
-            entryView.displayName.setText(call.getDisplayName());
-            entryView.phones.setText(call.getPhone());
-            entryView.state.setText(CURRENT_STATE_LABEL + call.getCallStateString());
-
-            return rowView;
-        }
-    };
-
-    public static class CallElementView
-    {
-        protected ImageButton toggleButton;
-        protected Button button;
-        protected ImageView photo;
-        protected TextView displayName;
-        protected TextView phones;
-        protected TextView state;
-    }
-
-    public CallElementList()
-    {
-        super();
-    }
-
-    public void setAccountList(AccountList accountList) {
-        mAccountList = accountList;
-    }
-
-    public void addCall(SipCall c)
-    {
-        Log.i(TAG, "Adding call " + c.mCallInfo.mDisplayName);
-        mAdapter.add(c);
-    }
-
-    public void removeCall(SipCall c)
-    {
-        Log.i(TAG, "Removing call " + c.mCallInfo.mDisplayName);
-        mAdapter.remove(c);
-    }
-        
-
-    @Override
-    public void onActivityCreated(Bundle savedInstanceState)
-    {
-        super.onActivityCreated(savedInstanceState);
-
-        // Give some text to display if there is no data.  In a real
-        // application this would come from a resource.
-        //setEmptyText("No phone numbers");
-
-        // We have a menu item to show in action bar.
-        setHasOptionsMenu(true);
-
-
-        // Create an empty adapter we will use to display the loaded data.
-        ArrayList calls = new ArrayList();
-        mAdapter = new CallElementAdapter(getActivity(), calls);
-        setListAdapter(mAdapter);
-
-        // Start out with a progress indicator.
-        //setListShown(false);
-
-        // Prepare the loader.  Either re-connect with an existing one,
-        // or start a new one.
-        // getLoaderManager().initLoader(0, null, this)
-
-        final Context context = getActivity();
-        ListView lv = getListView();
-        lv.setOnItemLongClickListener(new OnItemLongClickListener() {
-            @Override
-            public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) {
-                Log.i(TAG, "On Long Click");
-                final CharSequence[] items = {"Hang up Call", "Send Message", "Add to Conference"};
-                final SipCall call = (SipCall) mAdapter.getItem(pos);
-                // FIXME
-                service = sflphoneApplication.getSipService();
-                AlertDialog.Builder builder = new AlertDialog.Builder(context);
-                builder.setTitle("Action to perform with " + call.mCallInfo.mDisplayName)
-                      .setCancelable(true)
-                      .setItems(items, new DialogInterface.OnClickListener() {
-                          public void onClick(DialogInterface dialog, int item) {
-                              Log.i(TAG, "Selected " + items[item]);
-                              switch (item) {
-                                  case 0:
-                                      call.notifyServiceHangup(service);
-                                      break;
-                                  case 1:
-                                      call.sendTextMessage();
-                                      // Need to hangup this call immediately since no way to do it after this action
-                                      call.notifyServiceHangup(service);
-                                      break;
-                                  case 2:
-                                      call.addToConference();
-                                      // Need to hangup this call immediately since no way to do it after this action
-                                      call.notifyServiceHangup(service);
-                                      break;
-                                  default:
-                                      break; 
-                              }
-                          }
-                });
-                AlertDialog alert = builder.create();
-                alert.show();
-
-                return true;
-            }
-        });
-    }
-
-    @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
-        View inflatedView = inflater.inflate(R.layout.call_element_list, container, false);
-
-        mAccountSelectionButton = (AccountSelectionButton) inflatedView.findViewById(R.id.account_selection_button);
-        mAccountList.addManagementUI(mAccountSelectionButton);
-        mAccountSelectionButton.setAccountList(mAccountList);
-
-        return inflatedView;
-    }
-	
-    public void onListItemClick(ListView l, View v, int position, long id)
-    {
-        // Insert desired behavior here.
-        SipCall call = (SipCall) mAdapter.getItem(position);
-        Log.i(TAG, "Call Clicked: " + call.getCallId());
-
-        call.launchCallActivity(getActivity());
-
-        sflphoneHome.onSelectedCallAction(call);
-    }
-
-	@Override
-	public Loader<Cursor> onCreateLoader(int id, Bundle args)
-	{
-
-		//return new CursorLoader(getActivity(), CommonDataKinds.Phone.CONTENT_URI, null,null,null, null);
-
-		// This is called when a new Loader needs to be created.  This
-		// sample only has one Loader, so we don't care about the ID.
-		// First, pick the base URI to use depending on whether we are
-		// currently filtering.
-		Uri baseUri;
-
-		if (mCurFilter != null) {
-			baseUri = Uri.withAppendedPath(Contacts.CONTENT_FILTER_URI, Uri.encode(mCurFilter));
-		} else {
-			baseUri = Contacts.CONTENT_URI;
-		}
-
-		// Now create and return a CursorLoader that will take care of
-		// creating a Cursor for the data being displayed.
-		String select = "((" + Contacts.DISPLAY_NAME
-						+ " NOTNULL) AND ("
-						+ Contacts.HAS_PHONE_NUMBER
-						+ "=1) AND ("
-						+ Contacts.DISPLAY_NAME
-						+ " != '' ))";
-		//String select = "((" + Contacts.DISPLAY_NAME + " NOTNULL) AND (" + Contacts.DISPLAY_NAME + " != '' ))";
-
-		return new CursorLoader(getActivity(),
-								baseUri,
-								CONTACTS_SUMMARY_PROJECTION,
-								select,
-								null,
-								Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC");
-	}
-
-	@Override
-	public void onLoadFinished(Loader<Cursor> loader, Cursor data)
-	{
-		// Swap the new cursor in.  (The framework will take care of closing the
-		// old cursor once we return.)
-		// mAdapter.swapCursor(data);
-
-		// The list should now be shown.
-		/*
-		if (isResumed()) {
-			setListShown(true);
-		} else {
-			setListShownNoAnimation(true);
-		}*/
-	}
-
-	@Override
-	public void onLoaderReset(Loader<Cursor> loader)
-	{
-		// This is called when the last Cursor provided to onLoadFinished()
-		// above is about to be closed.  We need to make sure we are no
-		// longer using it.
-		// mAdapter.swapCursor(null);
-	}
-}
diff --git a/src/com/savoirfairelinux/sflphone/client/CallElementView.java b/src/com/savoirfairelinux/sflphone/client/CallElementView.java
index 82606f02f298d7360e44b0814b2ead359db1750c..1031e09530a07ec059554fa38a3073d43562efd7 100644
--- a/src/com/savoirfairelinux/sflphone/client/CallElementView.java
+++ b/src/com/savoirfairelinux/sflphone/client/CallElementView.java
@@ -44,39 +44,34 @@ import android.widget.FrameLayout;
 
 import com.savoirfairelinux.sflphone.R;
 
-public class CallElementView extends FrameLayout
-{
-	private ViewGroup contactCard = null;
-	private ViewGroup callCard = null;
-	
-	public CallElementView(Context context, AttributeSet attrs)
-	{
-		super(context, attrs);
-	}
-	
-	public CallElementView(Context context, AttributeSet attrs, int defStyle)
-	{
-		super(context, attrs, defStyle);
-	}
-	
-	@Override
-	protected void onAttachedToWindow()
-	{
-		// Layouts may be inflated or we may use fragments.
-		// contactCard = (ViewGroup) findViewById(R.id.contactview);
-		// callCard = (ViewGroup) findViewById(R.id.callview);
-		//callCard.setVisibility(View.GONE);
-	}
-	
+public class CallElementView extends FrameLayout {
+    private ViewGroup contactCard = null;
+    private ViewGroup callCard = null;
+
+    public CallElementView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public CallElementView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    @Override
+    protected void onAttachedToWindow() {
+        // Layouts may be inflated or we may use fragments.
+        // contactCard = (ViewGroup) findViewById(R.id.contactview);
+        // callCard = (ViewGroup) findViewById(R.id.callview);
+        // callCard.setVisibility(View.GONE);
+    }
+
     private Interpolator accelerator = new AccelerateInterpolator();
     private Interpolator decelerator = new DecelerateInterpolator();
 
     // from Android API Demo "ListFlipper"
-    private void flipit()
-    {
-    	if(contactCard == null || callCard == null)
-    		return;
-    	
+    private void flipit() {
+        if (contactCard == null || callCard == null)
+            return;
+
         final View visibleList;
         final View invisibleList;
         if (contactCard.getVisibility() == View.GONE) {
@@ -89,8 +84,7 @@ public class CallElementView extends FrameLayout
         ObjectAnimator visToInvis = ObjectAnimator.ofFloat(visibleList, "rotationY", 0f, 90f);
         visToInvis.setDuration(500);
         visToInvis.setInterpolator(accelerator);
-        final ObjectAnimator invisToVis = ObjectAnimator.ofFloat(invisibleList, "rotationY",
-                -90f, 0f);
+        final ObjectAnimator invisToVis = ObjectAnimator.ofFloat(invisibleList, "rotationY", -90f, 0f);
         invisToVis.setDuration(500);
         invisToVis.setInterpolator(decelerator);
         visToInvis.addListener(new AnimatorListenerAdapter() {
@@ -104,5 +98,4 @@ public class CallElementView extends FrameLayout
         visToInvis.start();
     }
 
-
 }
diff --git a/src/com/savoirfairelinux/sflphone/client/CustomListEntry.java b/src/com/savoirfairelinux/sflphone/client/CustomListEntry.java
deleted file mode 100644
index c9d1da7085f8dd7846cd5a6c15185c8755e26c15..0000000000000000000000000000000000000000
--- a/src/com/savoirfairelinux/sflphone/client/CustomListEntry.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.savoirfairelinux.sflphone.client;
-
-public class CustomListEntry
-{
-    private String mTextAlpha;
-    private String mTextBeta;
-
-    public CustomListEntry(String textA, String textB)
-    {
-        mTextAlpha = textA;
-        mTextBeta = textB;
-    }
-
-    public String getTextAlpha()
-    {
-        return mTextAlpha;
-    }
-
-    public String getTextBeta()
-    {
-        return mTextBeta;
-    }
-}
diff --git a/src/com/savoirfairelinux/sflphone/client/Data.java b/src/com/savoirfairelinux/sflphone/client/Data.java
deleted file mode 100644
index 27e56542601c03a3ea1c2aaad4f25aacae8c826b..0000000000000000000000000000000000000000
--- a/src/com/savoirfairelinux/sflphone/client/Data.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.savoirfairelinux.sflphone.client;
-
-public class Data {
-	public int i;
-	public String s;
-	
-	public Data() {}
-	
-	public Data(int i, String s) {
-		this.i = i;
-		this.s = s;
-	}
-}
diff --git a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java
deleted file mode 100644
index 666278a521fc9054fda3460f301093dd87d09c0d..0000000000000000000000000000000000000000
--- a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java
+++ /dev/null
@@ -1,594 +0,0 @@
-/*
- *  Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
- *
- *  Author: Adrien Beraud <adrien.beraud@gmail.com>
- *
- *  This program 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.
- *
- *  This program 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 this program; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-package com.savoirfairelinux.sflphone.client;
-
-import java.util.Random;
-
-import android.app.ActionBar;
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Fragment;
-import android.app.FragmentManager;
-import android.app.FragmentTransaction;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.ServiceConnection;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.Message;
-import android.os.RemoteException;
-import android.support.v13.app.FragmentStatePagerAdapter;
-import android.support.v4.view.ViewPager;
-import android.support.v4.content.LocalBroadcastManager;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.View.OnClickListener;
-import android.view.animation.AlphaAnimation;
-import android.view.animation.Animation;
-import android.view.animation.LinearInterpolator;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ImageButton;
-import android.widget.TextView;
-
-import com.savoirfairelinux.sflphone.R;
-import com.savoirfairelinux.sflphone.service.ISipService;
-import com.savoirfairelinux.sflphone.service.SipService;
-import com.savoirfairelinux.sflphone.utils.AccountList;
-import com.savoirfairelinux.sflphone.utils.CallList;
-
-import java.util.HashMap;
-
-public class SFLPhoneHome extends Activity implements ActionBar.TabListener, OnClickListener
-{
-    SectionsPagerAdapter mSectionsPagerAdapter = null;
-    static final String TAG = "SFLPhoneHome";
-    private static final int REQUEST_CODE_PREFERENCES = 1;
-    ImageButton buttonCall, buttonHangup;
-    static Animation animation;
-    private ContactListFragment mContactListFragment = null;
-    private CallElementList mCallElementList = null;
-    private HistorySectionFragment mHistorySectionFragment = null;
-    private ButtonSectionFragment mButtonSectionFragment = null;
-    private boolean mBound = false;
-    private ISipService service;
-    public AccountList mAccountList;
-    public CallList mCallList = new CallList(this);
-    private SFLphoneApplication mApplication;
-
-    private static final int ACTION_BAR_TAB_CONTACT = 0;
-    private static final int ACTION_BAR_TAB_CALL = 1;
-    private static final int ACTION_BAR_TAB_HISTORY = 2;
-    private static final int ACTION_BAR_TAB_TEST = 3;
-
-    /**
-     * The {@link ViewPager} that will host the section contents.
-     */
-    ViewPager mViewPager;
-
-    final private int[] icon_res_id = {R.drawable.ic_tab_call, R.drawable.ic_tab_call, R.drawable.ic_tab_history, R.drawable.ic_tab_play_selected};
-
-    // public SFLPhoneHome extends Activity implements ActionBar.TabListener, OnClickListener
-
-    /* called before activity is killed, e.g. rotation */
-    @Override
-    protected void onSaveInstanceState(Bundle bundle) {
-        super.onSaveInstanceState(bundle);
-        for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
-            try {
-                /* putFragment (Bundle bundle, String key, Fragment fragment) */
-                getFragmentManager().putFragment(bundle, mSectionsPagerAdapter.getClassName(i), mSectionsPagerAdapter.getFragment(i));
-            } catch (IllegalStateException e) {
-                Log.e(TAG, "IllegalStateException: fragment=" + mSectionsPagerAdapter.getFragment(i));
-            }
-        }
-        Log.w(TAG, "onSaveInstanceState()");
-    }
-
-    @Override
-    public void onCreate(Bundle savedInstanceState)
-    {
-        super.onCreate(savedInstanceState);
-
-        mApplication = (SFLphoneApplication) getApplication();
-
-        // Bind to LocalService
-        if (!mBound) {
-            Log.i(TAG, "onStart: Binding service...");
-            Intent intent = new Intent(this, SipService.class);
-            bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
-        }
-
-        setContentView(R.layout.activity_sflphone_home);
-
-        if (mSectionsPagerAdapter == null) {
-            mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());
-        }
-
-        /* getFragment(Bundle, String) */
-        if (savedInstanceState != null) {
-            Log.w(TAG, "Activity restarted, recreating PagerAdapter...");
-            /* getFragment (Bundle bundle, String key) */
-            mContactListFragment = (ContactListFragment) getFragmentManager().getFragment(
-                    savedInstanceState, mSectionsPagerAdapter.getClassName(ACTION_BAR_TAB_CONTACT));
-            mCallElementList = (CallElementList) getFragmentManager().getFragment(
-                    savedInstanceState, mSectionsPagerAdapter.getClassName(ACTION_BAR_TAB_CALL));
-            mHistorySectionFragment = (HistorySectionFragment) getFragmentManager().getFragment(
-                    savedInstanceState, mSectionsPagerAdapter.getClassName(ACTION_BAR_TAB_HISTORY));
-            mButtonSectionFragment = (ButtonSectionFragment) getFragmentManager().getFragment(
-                    savedInstanceState, mSectionsPagerAdapter.getClassName(ACTION_BAR_TAB_TEST));
-        }
-
-        if (mContactListFragment == null) {
-            mContactListFragment = new ContactListFragment();
-            Log.w(TAG, "Recreated mContactListFragment=" + mContactListFragment);
-        }
-        if (mCallElementList == null) {
-            mCallElementList = new CallElementList();
-            Log.w(TAG, "Recreated mCallElementList=" + mCallElementList);
-        }
-        if (mHistorySectionFragment == null) {
-            mHistorySectionFragment = new HistorySectionFragment();
-            Log.w(TAG, "Recreated mHistorySectionFragment=" + mHistorySectionFragment);
-        }
-        if (mButtonSectionFragment == null) {
-            mButtonSectionFragment = new ButtonSectionFragment();
-            Log.w(TAG, "Recreated mButtonSectionFragment=" + mButtonSectionFragment);
-        }
-
-        final ActionBar actionBar = getActionBar();
-        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
-        // final ActionBar actionBar = getActionBar();
-
-        // Set up the ViewPager with the sections adapter.
-        mViewPager = (ViewPager) findViewById(R.id.pager);
-        mViewPager.setAdapter(mSectionsPagerAdapter);
-
-        // When swiping between different sections, select the corresponding tab.
-        // We can also use ActionBar.Tab#select() to do this if we have a reference to the
-        // Tab.
-        mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener()
-        {
-            @Override
-            public void onPageSelected(int position)
-            {
-                actionBar.setSelectedNavigationItem(position);
-            }
-        });
-
-        // For each of the sections in the app, add a tab to the action bar.
-        for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
-            // Create a tab with text corresponding to the page title defined by the adapter.
-            // Also specify this Activity object, which implements the TabListener interface, as the
-            // listener for when this tab is selected.
-            actionBar.addTab(actionBar.newTab().setIcon(icon_res_id[i]).setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
-        }
-
-        actionBar.setSelectedNavigationItem(ACTION_BAR_TAB_CALL);
-
-        buttonCall = (ImageButton) findViewById(R.id.buttonCall);
-        buttonHangup = (ImageButton) findViewById(R.id.buttonHangUp);
-
-        // Change alpha from fully visible to invisible
-        animation = new AlphaAnimation(1, 0);
-        // duration - half a second
-        animation.setDuration(500);
-        // do not alter animation rate
-        animation.setInterpolator(new LinearInterpolator());
-        // Repeat animation infinitely
-        animation.setRepeatCount(Animation.INFINITE);
-        // Reverse
-        animation.setRepeatMode(Animation.REVERSE);
-
-        LocalBroadcastManager.getInstance(this).registerReceiver(mCallList, new IntentFilter("new-call-created"));
-        LocalBroadcastManager.getInstance(this).registerReceiver(mCallList, new IntentFilter("call-state-changed"));
-        LocalBroadcastManager.getInstance(this).registerReceiver(mCallList, new IntentFilter("incoming-call"));
-
-        mAccountList = mApplication.getAccountList();
-        Log.w(TAG, "mAccountList=" + mAccountList + ", mCallElementList=" + mCallElementList);
-
-        LocalBroadcastManager.getInstance(this).registerReceiver(mAccountList, new IntentFilter("accounts-changed"));
-        LocalBroadcastManager.getInstance(this).registerReceiver(mAccountList, new IntentFilter("account-state-changed"));
-
-        SipCall.setSFLPhoneHomeContext(this);
-    }
-
-    @Override
-    protected void onStart() {
-        Log.i(TAG, "onStart");
-        super.onStart();
-    }
-
-    /* user gets back to the activity, e.g. through task manager */
-    @Override
-    protected void onRestart() {
-        super.onRestart();
-    }
-
-    /* activity gets back to the foreground and user input */
-    @Override
-    protected void onResume() {
-        Log.i(TAG, "onResume");
-        super.onResume();
-    }
-
-    /* activity no more in foreground */
-    @Override
-    protected void onPause() {
-        super.onPause();
-    }
-
-    /* activity is no longer visible */
-    @Override
-    protected void onStop() {
-        super.onStop();
-    }
-
-    /* activity finishes itself or is being killed by the system */
-    @Override
-    protected void onDestroy() {
-        /* stop the service, if no other bound user, no need to check if it is running */
-        if (mBound) {
-            Log.i(TAG, "onStop: Unbinding service...");
-            unbindService(mConnection);
-            mBound = false;
-        }
-//        Log.i(TAG, "onDestroy: stopping SipService...");
-//        stopService(new Intent(this, SipService.class));
-//        mApplication.setServiceRunning(false);
-
-        /* unregister broadcast receiver */
-        LocalBroadcastManager.getInstance(this).unregisterReceiver(mCallList);
-        LocalBroadcastManager.getInstance(this).unregisterReceiver(mAccountList);
-
-        super.onDestroy();
-    }
-    
-    /** Defines callbacks for service binding, passed to bindService() */
-    private ServiceConnection mConnection = new ServiceConnection() {
-
-        @Override
-        public void onServiceConnected(ComponentName className,
-                IBinder binder) {
-            service = ISipService.Stub.asInterface(binder);
-            mApplication.setSipService(service);
-            mBound = true;
-            mAccountList.setSipService(service);
-            Log.d(TAG, "Service connected service=" + service);
-        }
-
-        @Override
-        public void onServiceDisconnected(ComponentName arg0) {
-            mApplication.setSipService(null);
-            mBound = false;
-            Log.d(TAG, "Service disconnected service=" + service);
-        }
-    };
-
-//    private void startSipService() {
-//        Thread thread = new Thread("StartSFLphoneService") {
-//            public void run() {
-//                Intent sipServiceIntent = new Intent(SFLPhoneHome.this, SipService.class);
-//                //sipServiceIntent.putExtra(ServiceConstants.EXTRA_OUTGOING_ACTIVITY, new ComponentName(SFLPhoneHome.this, SFLPhoneHome.class));
-//                startService(sipServiceIntent);
-//                mApplication.setServiceRunning(true);
-//            };
-//        };
-//        try {
-//            thread.start();
-//        } catch (IllegalThreadStateException e) {
-//            AlertDialog.Builder builder = new AlertDialog.Builder(this);
-//            builder.setMessage("Cannot start SFLPhone SipService!");
-//            AlertDialog alert = builder.create();
-//            alert.show();
-//            finish();
-//        }
-//    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        Log.i("SFLphone", "onOptionsItemSelected " + item.getItemId());
-        if(item.getItemId() != 0) {
-            // When the button is clicked, launch an activity through this intent
-            Intent launchPreferencesIntent = new Intent().setClass(this, SFLPhonePreferenceActivity.class);
-
-            // Make it a subactivity so we know when it returns
-            startActivityForResult(launchPreferencesIntent, REQUEST_CODE_PREFERENCES);
-        }
-
-        return super.onOptionsItemSelected(item);
-    }
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu)
-    {
-        getMenuInflater().inflate(R.menu.activity_sflphone_home, menu);
-        return true;
-    }
-
-    @Override
-    public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction)
-    {
-    }
-
-    @Override
-    public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction)
-    {
-        // When the given tab is selected, switch to the corresponding page in the ViewPager.
-        mViewPager.setCurrentItem(tab.getPosition());
-    }
-
-    @Override
-    public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction)
-    {
-        //		Log.d(TAG, "onTabReselected");
-    }
-
-    public void onSelectedCallAction(SipCall call) {
-        int callState = call.getCallStateInt();
-
-        if((callState == SipCall.CALL_STATE_NONE) ||
-           (callState == SipCall.CALL_STATE_CURRENT)) {
-            buttonCall.setEnabled(false);
-            buttonHangup.setEnabled(true);
-        }
-        else {
-            buttonCall.setEnabled(true);
-            buttonHangup.setEnabled(false);
-        }
-
-        buttonCall.setTag(call);
-        buttonHangup.setTag(call);
-    }
-
-    public void onUnselectedCallAction() {
-        buttonCall.setTag(null);
-        buttonCall.setTag(null);
-
-        buttonCall.setEnabled(true);
-        buttonHangup.setEnabled(false);
-    }
-
-    public void setIncomingCallID(String accountID, String callID, String from) {
-        Log.i(TAG, "incomingCall(" + accountID + ", " + callID + ", " + from + ")");
-        buttonCall.startAnimation(animation);
-        buttonCall.setImageResource(R.drawable.ic_incomingcall);
-    }
-
-    /**
-     * A {@link FragmentStatePagerAdapter} that returns a fragment corresponding to
-     * one of the primary sections of the app.
-     */
-    public class SectionsPagerAdapter extends FragmentStatePagerAdapter
-    {
-
-        public SectionsPagerAdapter(FragmentManager fm)
-        {
-            super(fm);
-        }
-
-        @Override
-        public Fragment getItem(int i)
-        {
-            Fragment fragment;
-
-            switch (i) {
-            case 0:
-                mContactListFragment = new ContactListFragment();
-                fragment = mContactListFragment;
-                Log.w(TAG, "getItem() ContactListFragment=" + fragment);
-                break;
-            case 1:
-                mCallElementList = new CallElementList();
-                SipCall.setCallElementList(mCallElementList);
-                mCallElementList.setAccountList(mAccountList);
-                fragment = mCallElementList;
-                Log.w(TAG, "getItem() CallElementList=" + fragment);
-                break;
-            case 2:
-                fragment = new HistorySectionFragment();
-                Log.w(TAG, "getItem() HistorySectionFragment=" + fragment);
-                break;
-            case 3:
-                fragment = new ButtonSectionFragment();
-                Log.w(TAG, "getItem() ButtonSectionFragment=" + fragment);
-                break;
-            default:
-                Log.e(TAG, "getItem() unknown tab position " + i);
-                return null;
-            }
-
-//            Log.i(TAG, "getItem() fragment is " + fragment);
-            Bundle args = new Bundle();
-            args.putInt(HistorySectionFragment.ARG_SECTION_NUMBER, i + 1);
-            fragment.setArguments(args);
-            return fragment;
-        }
-
-        public Fragment getFragment(int i)
-        {
-            Fragment fragment;
-
-            switch (i) {
-            case 0:
-                fragment = mContactListFragment;
-                break;
-            case 1:
-                fragment = mCallElementList;
-                break;
-            case 2:
-                fragment = mHistorySectionFragment;
-                break;
-            case 3:
-                fragment = mButtonSectionFragment;
-                break;
-            default:
-                Log.e(TAG, "getClassName: unknown fragment position " + i);
-                fragment = null;
-            }
-
-//            Log.w(TAG, "getFragment: fragment=" + fragment);
-            return fragment;
-        }
-
-        public String getClassName(int i)
-        {
-            String name;
-
-            switch (i) {
-            case 0:
-                name = ContactListFragment.class.getName();
-                break;
-            case 1:
-                name = CallElementList.class.getName();
-                break;
-            case 2:
-                name = HistorySectionFragment.class.getName();
-                break;
-            case 3:
-                name = ButtonSectionFragment.class.getName();
-                break;
-            default:
-                Log.e(TAG, "getClassName: unknown fragment position " + i);
-                return null;
-            }
-
-//            Log.w(TAG, "getClassName: name=" + name);
-            return name;
-        }
-
-        @Override
-        public int getCount()
-        {
-            return 4;
-        }
-
-        @Override
-        public CharSequence getPageTitle(int position)
-        {
-            switch (position) {
-            case 0:
-                return getString(R.string.title_section0).toUpperCase();
-            case 1:
-                return getString(R.string.title_section1).toUpperCase();
-            case 2:
-                return getString(R.string.title_section2).toUpperCase();
-            case 3:
-                return getString(R.string.title_section3).toUpperCase();
-            default:
-                Log.e(TAG, "getPageTitle: unknown tab position " + position);
-                break;
-            }
-            return null;
-        }
-    }
-
-    /**
-     * A dummy fragment representing a section of the app, but that simply
-     * displays dummy text.
-     */
-    public static class HistorySectionFragment extends Fragment
-    {
-        public HistorySectionFragment()
-        {
-            setRetainInstance(true);
-        }
-
-        public static final String ARG_SECTION_NUMBER = "section_number";
-
-        @Override
-        public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState)
-        {
-            TextView textView = new TextView(getActivity());
-            textView.setGravity(Gravity.CENTER);
-            Bundle args = getArguments();
-            textView.setText("ARG_SECTION_NUMBER=" + Integer.toString(args.getInt(ARG_SECTION_NUMBER)));
-            return textView;
-        }
-    }
-
-    @Override
-    public void onClick(View view)
-    {
-        Log.i(TAG, "onClic from SFLPhoneHome");
-        switch (view.getId()) {
-            case R.id.buttonCall:
-                processingNewCallAction();
-                break;
-            case R.id.buttonHangUp:
-                processingHangUpAction();
-                break;
-            default:
-                Log.w(TAG, "unknown button " + view.getId());
-                break;
-        }
-    }
-
-    public void processingNewCallAction() {
-        // String accountID = mAccountList.currentAccountID;
-        Log.w(TAG, "processingNewCallAction() mCallElementList=" + mCallElementList);
-        String accountID = mCallElementList.getSelectedAccount();
-        EditText editText = (EditText) findViewById(R.id.phoneNumberTextEntry);
-        String to = editText.getText().toString();
-
-        Random random = new Random();
-        String callID = Integer.toString(random.nextInt());
-        SipCall.CallInfo info = new SipCall.CallInfo();
-
-        info.mCallID = callID;
-        info.mAccountID = accountID;
-        info.mDisplayName = "Cool Guy!";
-        info.mPhone = to;
-        info.mEmail = "coolGuy@coolGuy.com";
-        info.mCallType = SipCall.CALL_TYPE_OUTGOING;
-
-        SipCall call = CallList.getCallInstance(info);
-        call.launchCallActivity(this);
-        call.placeCallUpdateUi();
-        call.notifyServicePlaceCall(service);
-     
-        onSelectedCallAction(call);
-    }
-
-    public void processingHangUpAction() {
-        SipCall call = (SipCall)buttonHangup.getTag();
-        if(call != null)
-            call.notifyServiceHangup(service);
-    }
-}
diff --git a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java
new file mode 100644
index 0000000000000000000000000000000000000000..226a4a3f0d8fedd3f6dba1d6239da44c8becfc99
--- /dev/null
+++ b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java
@@ -0,0 +1,530 @@
+/*
+ *  Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
+ *
+ *  Author: Adrien Beraud <adrien.beraud@gmail.com>
+ *
+ *  This program 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.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *  Additional permission under GNU GPL version 3 section 7:
+ *
+ *  If you modify this program, or any covered work, by linking or
+ *  combining it with the OpenSSL project's OpenSSL library (or a
+ *  modified version of that library), containing parts covered by the
+ *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
+ *  grants you additional permission to convey the resulting work.
+ *  Corresponding Source for a non-source form of such a combination
+ *  shall include the source code for the parts of OpenSSL used as well
+ *  as that of the covered work.
+ */
+package com.savoirfairelinux.sflphone.client;
+
+import java.util.Random;
+
+import android.app.ActionBar;
+import android.app.Activity;
+import android.app.Fragment;
+import android.app.FragmentManager;
+import android.app.FragmentTransaction;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.support.v13.app.FragmentStatePagerAdapter;
+import android.support.v4.content.LocalBroadcastManager;
+import android.support.v4.view.ViewPager;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.animation.AlphaAnimation;
+import android.view.animation.Animation;
+import android.view.animation.LinearInterpolator;
+import android.widget.EditText;
+import android.widget.ImageButton;
+
+import com.savoirfairelinux.sflphone.R;
+import com.savoirfairelinux.sflphone.client.receiver.AccountListReceiver;
+import com.savoirfairelinux.sflphone.client.receiver.CallListReceiver;
+import com.savoirfairelinux.sflphone.fragments.ButtonSectionFragment;
+import com.savoirfairelinux.sflphone.fragments.CallElementListFragment;
+import com.savoirfairelinux.sflphone.fragments.ContactListFragment;
+import com.savoirfairelinux.sflphone.fragments.HistoryFragment;
+import com.savoirfairelinux.sflphone.model.SipCall;
+import com.savoirfairelinux.sflphone.service.CallManagerCallBack;
+import com.savoirfairelinux.sflphone.service.ConfigurationManagerCallback;
+import com.savoirfairelinux.sflphone.service.ISipService;
+import com.savoirfairelinux.sflphone.service.SipService;
+
+public class SFLPhoneHomeActivity extends Activity implements ActionBar.TabListener, OnClickListener {
+	SectionsPagerAdapter mSectionsPagerAdapter = null;
+	static final String TAG = "SFLPhoneHome";
+	private static final int REQUEST_CODE_PREFERENCES = 1;
+	ImageButton buttonCall, buttonHangup;
+	static Animation animation;
+	private ContactListFragment mContactListFragment = null;
+	private CallElementListFragment mCallElementList = null;
+	private HistoryFragment mHistorySectionFragment = null;
+	private ButtonSectionFragment mButtonSectionFragment = null;
+	private boolean mBound = false;
+	private ISipService service;
+	public AccountListReceiver mAccountList;
+	public CallListReceiver mCallList = new CallListReceiver(this);
+	private SFLphoneApplication mApplication;
+
+	private static final int ACTION_BAR_TAB_CONTACT = 0;
+	private static final int ACTION_BAR_TAB_CALL = 1;
+	private static final int ACTION_BAR_TAB_HISTORY = 2;
+	private static final int ACTION_BAR_TAB_TEST = 3;
+
+	/**
+	 * The {@link ViewPager} that will host the section contents.
+	 */
+	ViewPager mViewPager;
+
+	final private int[] icon_res_id = { R.drawable.ic_tab_call, R.drawable.ic_tab_call, R.drawable.ic_tab_history, R.drawable.ic_tab_play_selected };
+
+	// public SFLPhoneHome extends Activity implements ActionBar.TabListener, OnClickListener
+
+	/* called before activity is killed, e.g. rotation */
+	@Override
+	protected void onSaveInstanceState(Bundle bundle) {
+		super.onSaveInstanceState(bundle);
+		for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
+			try {
+				/* putFragment (Bundle bundle, String key, Fragment fragment) */
+				getFragmentManager().putFragment(bundle, mSectionsPagerAdapter.getClassName(i), mSectionsPagerAdapter.getFragment(i));
+			} catch (IllegalStateException e) {
+				Log.e(TAG, "IllegalStateException: fragment=" + mSectionsPagerAdapter.getFragment(i));
+			}
+		}
+		Log.w(TAG, "onSaveInstanceState()");
+	}
+
+	@Override
+	public void onCreate(Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+
+		mApplication = (SFLphoneApplication) getApplication();
+
+		// Bind to LocalService
+		if (!mBound) {
+			Log.i(TAG, "onStart: Binding service...");
+			Intent intent = new Intent(this, SipService.class);
+			bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
+		}
+
+		setContentView(R.layout.activity_sflphone_home);
+
+		if (mSectionsPagerAdapter == null) {
+			mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());
+		}
+
+		/* getFragment(Bundle, String) */
+		if (savedInstanceState != null) {
+			Log.w(TAG, "Activity restarted, recreating PagerAdapter...");
+			/* getFragment (Bundle bundle, String key) */
+			mContactListFragment = (ContactListFragment) getFragmentManager().getFragment(savedInstanceState,
+			        mSectionsPagerAdapter.getClassName(ACTION_BAR_TAB_CONTACT));
+			mCallElementList = (CallElementListFragment) getFragmentManager().getFragment(savedInstanceState,
+			        mSectionsPagerAdapter.getClassName(ACTION_BAR_TAB_CALL));
+			mHistorySectionFragment = (HistoryFragment) getFragmentManager().getFragment(savedInstanceState,
+			        mSectionsPagerAdapter.getClassName(ACTION_BAR_TAB_HISTORY));
+			mButtonSectionFragment = (ButtonSectionFragment) getFragmentManager().getFragment(savedInstanceState,
+			        mSectionsPagerAdapter.getClassName(ACTION_BAR_TAB_TEST));
+		}
+
+		if (mContactListFragment == null) {
+			mContactListFragment = new ContactListFragment();
+			Log.w(TAG, "Recreated mContactListFragment=" + mContactListFragment);
+		}
+		if (mCallElementList == null) {
+			mCallElementList = new CallElementListFragment();
+			Log.w(TAG, "Recreated mCallElementList=" + mCallElementList);
+		}
+		if (mHistorySectionFragment == null) {
+			mHistorySectionFragment = new HistoryFragment();
+			Log.w(TAG, "Recreated mHistorySectionFragment=" + mHistorySectionFragment);
+		}
+		if (mButtonSectionFragment == null) {
+			mButtonSectionFragment = new ButtonSectionFragment();
+			Log.w(TAG, "Recreated mButtonSectionFragment=" + mButtonSectionFragment);
+		}
+
+		final ActionBar actionBar = getActionBar();
+		actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
+		// final ActionBar actionBar = getActionBar();
+
+		// Set up the ViewPager with the sections adapter.
+		mViewPager = (ViewPager) findViewById(R.id.pager);
+		mViewPager.setAdapter(mSectionsPagerAdapter);
+
+		// When swiping between different sections, select the corresponding tab.
+		// We can also use ActionBar.Tab#select() to do this if we have a reference to the
+		// Tab.
+		mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
+			@Override
+			public void onPageSelected(int position) {
+				actionBar.setSelectedNavigationItem(position);
+			}
+		});
+
+		// For each of the sections in the app, add a tab to the action bar.
+		for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
+			// Create a tab with text corresponding to the page title defined by the adapter.
+			// Also specify this Activity object, which implements the TabListener interface, as the
+			// listener for when this tab is selected.
+			actionBar.addTab(actionBar.newTab().setIcon(icon_res_id[i]).setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
+		}
+
+		actionBar.setSelectedNavigationItem(ACTION_BAR_TAB_CALL);
+
+		buttonCall = (ImageButton) findViewById(R.id.buttonCall);
+		buttonHangup = (ImageButton) findViewById(R.id.buttonHangUp);
+
+		// Change alpha from fully visible to invisible
+		animation = new AlphaAnimation(1, 0);
+		// duration - half a second
+		animation.setDuration(500);
+		// do not alter animation rate
+		animation.setInterpolator(new LinearInterpolator());
+		// Repeat animation infinitely
+		animation.setRepeatCount(Animation.INFINITE);
+		// Reverse
+		animation.setRepeatMode(Animation.REVERSE);
+
+		IntentFilter callFilter = new IntentFilter(CallManagerCallBack.NEW_CALL_CREATED);
+		callFilter.addAction(CallManagerCallBack.INCOMING_CALL);
+		callFilter.addAction(CallManagerCallBack.CALL_STATE_CHANGED);
+		LocalBroadcastManager.getInstance(this).registerReceiver(mCallList, callFilter);
+
+		mAccountList = mApplication.getAccountList();
+		Log.w(TAG, "mAccountList=" + mAccountList + ", mCallElementList=" + mCallElementList);
+
+		IntentFilter accountFilter = new IntentFilter(ConfigurationManagerCallback.ACCOUNTS_CHANGED);
+        accountFilter.addAction(ConfigurationManagerCallback.ACCOUNT_STATE_CHANGED);
+		LocalBroadcastManager.getInstance(this).registerReceiver(mAccountList, accountFilter);
+
+		SipCall.setSFLPhoneHomeContext(this);
+	}
+
+	@Override
+	protected void onStart() {
+		Log.i(TAG, "onStart");
+		super.onStart();
+	}
+
+	/* user gets back to the activity, e.g. through task manager */
+	@Override
+	protected void onRestart() {
+		super.onRestart();
+	}
+
+	/* activity gets back to the foreground and user input */
+	@Override
+	protected void onResume() {
+		Log.i(TAG, "onResume");
+		super.onResume();
+	}
+
+	/* activity no more in foreground */
+	@Override
+	protected void onPause() {
+		super.onPause();
+	}
+
+	/* activity is no longer visible */
+	@Override
+	protected void onStop() {
+		super.onStop();
+	}
+
+	/* activity finishes itself or is being killed by the system */
+	@Override
+	protected void onDestroy() {
+		/* stop the service, if no other bound user, no need to check if it is running */
+		if (mBound) {
+			Log.i(TAG, "onStop: Unbinding service...");
+			unbindService(mConnection);
+			mBound = false;
+		}
+
+		/* unregister broadcast receiver */
+		LocalBroadcastManager.getInstance(this).unregisterReceiver(mCallList);
+		LocalBroadcastManager.getInstance(this).unregisterReceiver(mAccountList);
+
+		super.onDestroy();
+	}
+	
+	
+
+	/** Defines callbacks for service binding, passed to bindService() */
+	private ServiceConnection mConnection = new ServiceConnection() {
+
+		@Override
+		public void onServiceConnected(ComponentName className, IBinder binder) {
+			service = ISipService.Stub.asInterface(binder);
+			mApplication.setSipService(service);
+			mBound = true;
+			mAccountList.setSipService(service);
+			mCallElementList.onServiceSipBinded(service);
+			Log.d(TAG, "Service connected service=" + service);
+		}
+
+		@Override
+		public void onServiceDisconnected(ComponentName arg0) {
+			mApplication.setSipService(null);
+			mBound = false;
+			Log.d(TAG, "Service disconnected service=" + service);
+		}
+	};
+
+
+	@Override
+	public boolean onOptionsItemSelected(MenuItem item) {
+		Log.i("SFLphone", "onOptionsItemSelected " + item.getItemId());
+		if (item.getItemId() != 0) {
+			// When the button is clicked, launch an activity through this intent
+			Intent launchPreferencesIntent = new Intent().setClass(this, SFLPhonePreferenceActivity.class);
+
+			// Make it a subactivity so we know when it returns
+			startActivityForResult(launchPreferencesIntent, REQUEST_CODE_PREFERENCES);
+		}
+
+		return super.onOptionsItemSelected(item);
+	}
+
+	@Override
+	public boolean onCreateOptionsMenu(Menu menu) {
+		getMenuInflater().inflate(R.menu.activity_sflphone_home, menu);
+		return true;
+	}
+
+	@Override
+	public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
+	}
+
+	@Override
+	public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
+		// When the given tab is selected, switch to the corresponding page in the ViewPager.
+		mViewPager.setCurrentItem(tab.getPosition());
+	}
+
+	@Override
+	public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
+		// Log.d(TAG, "onTabReselected");
+	}
+
+	public void onSelectedCallAction(SipCall call) {
+		int callState = call.getCallStateInt();
+
+		if ((callState == SipCall.CALL_STATE_NONE) || (callState == SipCall.CALL_STATE_CURRENT)) {
+			buttonCall.setEnabled(false);
+			buttonHangup.setEnabled(true);
+		} else {
+			buttonCall.setEnabled(true);
+			buttonHangup.setEnabled(false);
+		}
+
+		buttonCall.setTag(call);
+		buttonHangup.setTag(call);
+	}
+
+	public void onUnselectedCallAction() {
+		buttonCall.setTag(null);
+		buttonCall.setTag(null);
+
+		buttonCall.setEnabled(true);
+		buttonHangup.setEnabled(false);
+	}
+
+	public void setIncomingCallID(String accountID, String callID, String from) {
+		Log.i(TAG, "incomingCall(" + accountID + ", " + callID + ", " + from + ")");
+		buttonCall.startAnimation(animation);
+		buttonCall.setImageResource(R.drawable.ic_incomingcall);
+	}
+
+	/**
+	 * A {@link FragmentStatePagerAdapter} that returns a fragment corresponding to one of the primary sections of the app.
+	 */
+	public class SectionsPagerAdapter extends FragmentStatePagerAdapter {
+
+		public SectionsPagerAdapter(FragmentManager fm) {
+			super(fm);
+		}
+
+		@Override
+		public Fragment getItem(int i) {
+			Fragment fragment;
+
+			switch (i) {
+			case 0:
+				mContactListFragment = new ContactListFragment();
+				fragment = mContactListFragment;
+				Log.w(TAG, "getItem() ContactListFragment=" + fragment);
+				break;
+			case 1:
+				mCallElementList = new CallElementListFragment();
+				SipCall.setCallElementList(mCallElementList);
+				mCallElementList.setAccountList(mAccountList);
+				fragment = mCallElementList;
+				Log.w(TAG, "getItem() CallElementList=" + fragment);
+				break;
+			case 2:
+				fragment = new HistoryFragment();
+				Log.w(TAG, "getItem() HistoryFragment=" + fragment);
+				break;
+			case 3:
+				fragment = new ButtonSectionFragment();
+				Log.w(TAG, "getItem() ButtonSectionFragment=" + fragment);
+				break;
+			default:
+				Log.e(TAG, "getItem() unknown tab position " + i);
+				return null;
+			}
+
+			// Log.i(TAG, "getItem() fragment is " + fragment);
+			Bundle args = new Bundle();
+			args.putInt(HistoryFragment.ARG_SECTION_NUMBER, i + 1);
+			fragment.setArguments(args);
+			return fragment;
+		}
+
+		public Fragment getFragment(int i) {
+			Fragment fragment;
+
+			switch (i) {
+			case 0:
+				fragment = mContactListFragment;
+				break;
+			case 1:
+				fragment = mCallElementList;
+				break;
+			case 2:
+				fragment = mHistorySectionFragment;
+				break;
+			case 3:
+				fragment = mButtonSectionFragment;
+				break;
+			default:
+				Log.e(TAG, "getClassName: unknown fragment position " + i);
+				fragment = null;
+			}
+
+			// Log.w(TAG, "getFragment: fragment=" + fragment);
+			return fragment;
+		}
+
+		public String getClassName(int i) {
+			String name;
+
+			switch (i) {
+			case 0:
+				name = ContactListFragment.class.getName();
+				break;
+			case 1:
+				name = CallElementListFragment.class.getName();
+				break;
+			case 2:
+				name = HistoryFragment.class.getName();
+				break;
+			case 3:
+				name = ButtonSectionFragment.class.getName();
+				break;
+			default:
+				Log.e(TAG, "getClassName: unknown fragment position " + i);
+				return null;
+			}
+
+			// Log.w(TAG, "getClassName: name=" + name);
+			return name;
+		}
+
+		@Override
+		public int getCount() {
+			return 4;
+		}
+
+		@Override
+		public CharSequence getPageTitle(int position) {
+			switch (position) {
+			case 0:
+				return getString(R.string.title_section0).toUpperCase();
+			case 1:
+				return getString(R.string.title_section1).toUpperCase();
+			case 2:
+				return getString(R.string.title_section2).toUpperCase();
+			case 3:
+				return getString(R.string.title_section3).toUpperCase();
+			default:
+				Log.e(TAG, "getPageTitle: unknown tab position " + position);
+				break;
+			}
+			return null;
+		}
+	}
+
+
+	@Override
+	public void onClick(View view) {
+		Log.i(TAG, "onClic from SFLPhoneHome");
+		switch (view.getId()) {
+		case R.id.buttonCall:
+			processingNewCallAction();
+			break;
+		case R.id.buttonHangUp:
+			processingHangUpAction();
+			break;
+		default:
+			Log.w(TAG, "unknown button " + view.getId());
+			break;
+		}
+	}
+
+	public void processingNewCallAction() {
+		// String accountID = mAccountList.currentAccountID;
+		Log.w(TAG, "processingNewCallAction() mCallElementList=" + mCallElementList);
+		String accountID = mCallElementList.getSelectedAccount();
+		EditText editText = (EditText) findViewById(R.id.phoneNumberTextEntry);
+		String to = editText.getText().toString();
+
+		Random random = new Random();
+		String callID = Integer.toString(random.nextInt());
+		SipCall.CallInfo info = new SipCall.CallInfo();
+
+		info.mCallID = callID;
+		info.mAccountID = accountID;
+		info.mDisplayName = "Cool Guy!";
+		info.mPhone = to;
+		info.mEmail = "coolGuy@coolGuy.com";
+		info.mCallType = SipCall.CALL_TYPE_OUTGOING;
+
+		SipCall call = CallListReceiver.getCallInstance(info);
+		call.launchCallActivity(this);
+		call.placeCallUpdateUi();
+		call.notifyServicePlaceCall(service);
+
+		onSelectedCallAction(call);
+	}
+
+	public void processingHangUpAction() {
+		SipCall call = (SipCall) buttonHangup.getTag();
+		if (call != null)
+			call.notifyServiceHangup(service);
+	}
+}
diff --git a/src/com/savoirfairelinux/sflphone/client/SFLPhonePreferenceActivity.java b/src/com/savoirfairelinux/sflphone/client/SFLPhonePreferenceActivity.java
index 57f1e2c54cdf5596607c1a0c8623085e10db3fa6..00d302350fda9e0e369143eda2cc94abfca44302 100644
--- a/src/com/savoirfairelinux/sflphone/client/SFLPhonePreferenceActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/SFLPhonePreferenceActivity.java
@@ -31,9 +31,6 @@
 
 package com.savoirfairelinux.sflphone.client;
 
-import java.util.List;
-
-import android.app.AlertDialog;
 import android.app.ActionBar;
 import android.app.Activity;
 import android.app.Fragment;
@@ -46,22 +43,20 @@ import android.content.Intent;
 import android.content.ServiceConnection;
 import android.os.Bundle;
 import android.os.IBinder;
-import android.preference.PreferenceActivity;
-import android.util.Log;
-import android.support.v4.view.ViewPager;
 import android.support.v13.app.FragmentStatePagerAdapter;
-import android.view.View;
-import android.widget.Button;
-import android.widget.TextView;
+import android.support.v4.view.ViewPager;
+import android.util.Log;
 
 import com.savoirfairelinux.sflphone.R;
-import com.savoirfairelinux.sflphone.service.SipService;
+import com.savoirfairelinux.sflphone.fragments.AccountManagementFragment;
+import com.savoirfairelinux.sflphone.fragments.AudioManagementFragment;
 import com.savoirfairelinux.sflphone.service.ISipService;
+import com.savoirfairelinux.sflphone.service.SipService;
 
 public class SFLPhonePreferenceActivity extends Activity implements ActionBar.TabListener
 {
     static final int NUM_PAGES = 2;
-    static final String TAG = "SFLPhonePreferenceActivity";
+    static final String TAG = SFLPhonePreferenceActivity.class.getSimpleName();
     PreferencesPagerAdapter mPreferencesPagerAdapter;
     private boolean mBound = false;
     static boolean serviceIsOn = false;
@@ -190,7 +185,7 @@ public class SFLPhonePreferenceActivity extends Activity implements ActionBar.Ta
                 fragment = new AccountManagementFragment();
                 break;
             case 1:
-                fragment = new PrefManagementFragment();
+                fragment = new AudioManagementFragment();
                 break;
             default:
                 Log.i(TAG, "Get new fragment " + position + " is null");
@@ -216,32 +211,4 @@ public class SFLPhonePreferenceActivity extends Activity implements ActionBar.Ta
         }
     }
 
-    public static class ArrayListFragment extends ListFragment {
-        int mNum;
-
-        static ArrayListFragment newInstance(int num) {
-            ArrayListFragment f = new ArrayListFragment();
-
-            // Supply num input as an argument.
-            Bundle args = new Bundle();
-            args.putInt("num", num);
-            f.setArguments(args);
-
-            return f;
-        }
-
-        @Override
-        public void onCreate(Bundle savedInstanceState) {
-            super.onCreate(savedInstanceState);
-            mNum = getArguments() != null ? getArguments().getInt("num") : 1;
-        }
-
-        @Override
-        public void onActivityCreated(Bundle savedInstanceState) {
-            super.onActivityCreated(savedInstanceState);
-            // setListAdapter(new ArrayAdapter<String>(getActivity(),
-            //        android.R.layout.simple_list_item_1, Cheeses.sCheeseStrings));
-        }
-
-    }
 }
diff --git a/src/com/savoirfairelinux/sflphone/client/SFLphoneApplication.java b/src/com/savoirfairelinux/sflphone/client/SFLphoneApplication.java
index 13739475aee9ade53965ca610ac091a5f893a47c..4fc44271971db1815b8acf3a2ebdc7c9fc494d28 100644
--- a/src/com/savoirfairelinux/sflphone/client/SFLphoneApplication.java
+++ b/src/com/savoirfairelinux/sflphone/client/SFLphoneApplication.java
@@ -8,16 +8,16 @@ import android.content.pm.PackageManager;
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.util.Log;
 
+import com.savoirfairelinux.sflphone.client.receiver.AccountListReceiver;
 import com.savoirfairelinux.sflphone.service.ISipService;
 import com.savoirfairelinux.sflphone.service.SipService;
-import com.savoirfairelinux.sflphone.utils.AccountList;
 
 public class SFLphoneApplication extends Application {
 
     static final String TAG = "SFLphoneApplication";
     private boolean serviceRunning = false;
     private ISipService sipService;
-    private AccountList accountList = new AccountList();
+    private AccountListReceiver accountList = new AccountListReceiver();
 
     private void startSipService() {
         Thread thread = new Thread("StartSFLphoneService") {
@@ -79,7 +79,7 @@ public class SFLphoneApplication extends Application {
         sipService = service;
     }
 
-    public AccountList getAccountList() {
+    public AccountListReceiver getAccountList() {
         return accountList;
     }
 
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountList.java b/src/com/savoirfairelinux/sflphone/client/receiver/AccountListReceiver.java
similarity index 95%
rename from src/com/savoirfairelinux/sflphone/utils/AccountList.java
rename to src/com/savoirfairelinux/sflphone/client/receiver/AccountListReceiver.java
index 3a8c791be4bd96b4f3ea396d0fc1da8e11c40224..efd6c5b2ef9d7e8d2a4fa6b09142ff1ba945b194 100644
--- a/src/com/savoirfairelinux/sflphone/utils/AccountList.java
+++ b/src/com/savoirfairelinux/sflphone/client/receiver/AccountListReceiver.java
@@ -29,7 +29,7 @@
  *  as that of the covered work.
  */
 
-package com.savoirfairelinux.sflphone.utils;
+package com.savoirfairelinux.sflphone.client.receiver;
 
 import android.content.BroadcastReceiver;
 import android.content.Intent;
@@ -39,10 +39,11 @@ import android.util.Log;
 
 import java.util.ArrayList;
 
+import com.savoirfairelinux.sflphone.account.AccountManagementUI;
 import com.savoirfairelinux.sflphone.service.ConfigurationManagerCallback;
 import com.savoirfairelinux.sflphone.service.ISipService;
 
-public class AccountList extends BroadcastReceiver 
+public class AccountListReceiver extends BroadcastReceiver 
 {
     private static final long serialVersionUID = -9178386308804218835L;
     static final String TAG = "AccountList";
@@ -54,7 +55,7 @@ public class AccountList extends BroadcastReceiver
 
     public static final String DEFAULT_ACCOUNT_ID = "IP2IP";
 
-    public AccountList() {
+    public AccountListReceiver() {
     }
 
     public void setSipService(ISipService service) {
@@ -80,7 +81,7 @@ public class AccountList extends BroadcastReceiver
     {
         String signalName = intent.getStringExtra(ConfigurationManagerCallback.SIGNAL_NAME);
         Log.d(TAG, "Signal received: " + signalName);
-
+        
         if(signalName.equals(ConfigurationManagerCallback.ACCOUNTS_CHANGED)) {
             processAccountsChangedSignal(intent);
         } else if(signalName.equals(ConfigurationManagerCallback.ACCOUNT_STATE_CHANGED)) {
diff --git a/src/com/savoirfairelinux/sflphone/utils/CallList.java b/src/com/savoirfairelinux/sflphone/client/receiver/CallListReceiver.java
similarity index 93%
rename from src/com/savoirfairelinux/sflphone/utils/CallList.java
rename to src/com/savoirfairelinux/sflphone/client/receiver/CallListReceiver.java
index 1bf60e0e037314aedabeb1952970cf4477b93d1b..ddf4efa6f0e1402cba8e0817a20580ca699f9edc 100644
--- a/src/com/savoirfairelinux/sflphone/utils/CallList.java
+++ b/src/com/savoirfairelinux/sflphone/client/receiver/CallListReceiver.java
@@ -29,9 +29,8 @@
  *  as that of the covered work.
  */
 
-package com.savoirfairelinux.sflphone.utils;
+package com.savoirfairelinux.sflphone.client.receiver;
 
-import com.savoirfairelinux.sflphone.client.SipCall;
 
 import android.content.BroadcastReceiver;
 import android.content.Context;
@@ -41,15 +40,16 @@ import android.util.Log;
 
 import java.util.ArrayList;
 
+import com.savoirfairelinux.sflphone.model.SipCall;
 import com.savoirfairelinux.sflphone.service.CallManagerCallBack;
-import com.savoirfairelinux.sflphone.client.SFLPhoneHome;
+import com.savoirfairelinux.sflphone.client.SFLPhoneHomeActivity;
 
-public class CallList extends BroadcastReceiver
+public class CallListReceiver extends BroadcastReceiver
 {
     static final String TAG = "CallList";
     static ArrayList<SipCall> mList = new ArrayList<SipCall>();
     // Requires a reference to the main context when sending call activity
-    static private SFLPhoneHome mHome = null;
+    static private SFLPhoneHomeActivity mHome = null;
 
     private enum Signals {
         NEW_CALL_CREATED,
@@ -81,7 +81,7 @@ public class CallList extends BroadcastReceiver
         return call;
     }
 
-    public CallList(SFLPhoneHome home) {
+    public CallListReceiver(SFLPhoneHomeActivity home) {
         mHome = home;
     }
 
@@ -92,6 +92,7 @@ public class CallList extends BroadcastReceiver
         Log.d(TAG, "Signal received: " + signalName);
 
         if(signalName.equals(CallManagerCallBack.NEW_CALL_CREATED)) {
+            
         } else if(signalName.equals(CallManagerCallBack.CALL_STATE_CHANGED)) {
             processCallStateChangedSignal(intent);
         } else if(signalName.equals(CallManagerCallBack.INCOMING_CALL)) {
diff --git a/src/com/savoirfairelinux/sflphone/client/AccountManagementFragment.java b/src/com/savoirfairelinux/sflphone/fragments/AccountManagementFragment.java
similarity index 66%
rename from src/com/savoirfairelinux/sflphone/client/AccountManagementFragment.java
rename to src/com/savoirfairelinux/sflphone/fragments/AccountManagementFragment.java
index 52fabeddc47d843495b2c23a14ac57a5d9451309..e4d72c9edd3d0945874cd10fc41dc6f6db22b100 100644
--- a/src/com/savoirfairelinux/sflphone/client/AccountManagementFragment.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/AccountManagementFragment.java
@@ -29,44 +29,39 @@
  *  as that of the covered work.
  */
 
-package com.savoirfairelinux.sflphone.client;
+package com.savoirfairelinux.sflphone.fragments;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Set;
 
 import android.app.Activity;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
-import android.preference.EditTextPreference;
+import android.os.Bundle;
+import android.os.RemoteException;
 import android.preference.Preference;
 import android.preference.PreferenceCategory;
 import android.preference.PreferenceFragment;
 import android.preference.PreferenceScreen;
-import android.preference.ListPreference;
-import android.preference.PreferenceManager;
-import android.os.Bundle;
-import android.os.RemoteException;
 import android.support.v4.content.LocalBroadcastManager;
 import android.util.Log;
-import android.view.View;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-
-import java.util.Set;
-import java.util.HashMap;
-import java.util.ArrayList;
 
 import com.savoirfairelinux.sflphone.R;
-import com.savoirfairelinux.sflphone.service.ISipService;
-import com.savoirfairelinux.sflphone.utils.AccountDetail;
-import com.savoirfairelinux.sflphone.utils.AccountDetailsHandler;
-import com.savoirfairelinux.sflphone.utils.AccountDetailBasic;
-import com.savoirfairelinux.sflphone.utils.AccountDetailAdvanced;
-import com.savoirfairelinux.sflphone.utils.AccountDetailSrtp;
-import com.savoirfairelinux.sflphone.utils.AccountDetailTls;
+import com.savoirfairelinux.sflphone.account.AccountDetail;
+import com.savoirfairelinux.sflphone.account.AccountDetailAdvanced;
+import com.savoirfairelinux.sflphone.account.AccountDetailBasic;
+import com.savoirfairelinux.sflphone.account.AccountDetailSrtp;
+import com.savoirfairelinux.sflphone.account.AccountDetailTls;
 import com.savoirfairelinux.sflphone.client.AccountPreferenceActivity;
+import com.savoirfairelinux.sflphone.client.SFLPhonePreferenceActivity;
+import com.savoirfairelinux.sflphone.client.SFLphoneApplication;
+import com.savoirfairelinux.sflphone.service.ConfigurationManagerCallback;
+import com.savoirfairelinux.sflphone.service.ISipService;
 
-public class AccountManagementFragment extends PreferenceFragment
-{
+public class AccountManagementFragment extends PreferenceFragment {
     static final String TAG = "AccountManagementFragment";
     static final String DEFAULT_ACCOUNT_ID = "IP2IP";
     static final int ACCOUNT_CREATE_REQUEST = 1;
@@ -89,30 +84,27 @@ public class AccountManagementFragment extends PreferenceFragment
         Log.w(TAG, "onAttach() service=" + service);
     }
 
-    public AccountManagementFragment()
-    {
-        basicDetailKeys =  AccountDetailBasic.getPreferenceEntries();
+    public AccountManagementFragment() {
+        basicDetailKeys = AccountDetailBasic.getPreferenceEntries();
         advancedDetailKeys = AccountDetailAdvanced.getPreferenceEntries();
         srtpDetailKeys = AccountDetailSrtp.getPreferenceEntries();
         tlsDetailKeys = AccountDetailTls.getPreferenceEntries();
 
         accountPreferenceHashMap = new HashMap<String, Preference>();
-    } 
+    }
 
     @Override
-    public void onCreate(Bundle savedInstanceState)
-    {
+    public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
         Log.i(TAG, "Create Account Management Fragment");
 
         /*
-         * FIXME if service cannot be obtained from SFLPhonePreferenceActivity,
-         * then get it from Application
+         * FIXME if service cannot be obtained from SFLPhonePreferenceActivity, then get it from Application
          */
         service = sflphonePreferenceActivity.getSipService();
         if (service == null) {
-            service = ((SFLphoneApplication)sflphonePreferenceActivity.getApplication()).getSipService();
+            service = ((SFLphoneApplication) sflphonePreferenceActivity.getApplication()).getSipService();
             if (service == null) {
                 Log.e(TAG, "onCreate() service=" + service);
             }
@@ -121,19 +113,17 @@ public class AccountManagementFragment extends PreferenceFragment
 
         setPreferenceScreen(getAccountListPreferenceScreen());
 
-        LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mMessageReceiver, new IntentFilter("accounts-changed"));
+        LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mMessageReceiver, new IntentFilter(ConfigurationManagerCallback.ACCOUNTS_CHANGED));
     }
 
     @Override
-    public void onStop()
-    {
+    public void onStop() {
         super.onStop();
         Log.i(TAG, "onStop");
     }
 
     @Override
-    public void onDestroy()
-    {
+    public void onDestroy() {
         LocalBroadcastManager.getInstance(getActivity()).unregisterReceiver(mMessageReceiver);
         super.onDestroy();
         Log.i(TAG, "onDestroy");
@@ -141,57 +131,82 @@ public class AccountManagementFragment extends PreferenceFragment
 
     @Override
     public void onActivityResult(int requestCode, int resultCode, Intent data) {
-        switch(requestCode) {
-            case ACCOUNT_CREATE_REQUEST:
-                Log.i(TAG, "ACCOUNT_CREATE_REQUEST Done");
-                break;
-            case ACCOUNT_EDIT_REQUEST:
-                if(resultCode == AccountPreferenceActivity.ACCOUNT_MODIFIED) {
-                    Bundle bundle = data.getExtras();
-                    String accountID = bundle.getString("AccountID");
-                    Log.i(TAG, "Update account settings for " + accountID);
-
-                    AccountDetailBasic basicDetails = 
-                        new AccountDetailBasic(bundle.getStringArrayList(AccountDetailBasic.BUNDLE_TAG));
-                    AccountDetailAdvanced advancedDetails = 
-                        new AccountDetailAdvanced(bundle.getStringArrayList(AccountDetailAdvanced.BUNDLE_TAG));
-                    AccountDetailSrtp srtpDetails = 
-                        new AccountDetailSrtp(bundle.getStringArrayList(AccountDetailSrtp.BUNDLE_TAG));
-                    AccountDetailTls tlsDetails = 
-                        new AccountDetailTls(bundle.getStringArrayList(AccountDetailTls.BUNDLE_TAG));
-
-                    HashMap<String, String> map = new HashMap<String, String>();
-                    map.putAll(basicDetails.getDetailsHashMap()); 
-                    map.putAll(advancedDetails.getDetailsHashMap());
-                    map.putAll(srtpDetails.getDetailsHashMap());
-                    map.putAll(tlsDetails.getDetailsHashMap());
-
-                    setAccountDetails(accountID, map);
-                } else if(resultCode == AccountPreferenceActivity.ACCOUNT_DELETED) {
-                    Bundle bundle = data.getExtras();
-                    String accountID = bundle.getString("AccountID");
-
-                    Log.i(TAG, "Remove account " + accountID);
-                    deleteSelectedAccount(accountID);
-                    Preference accountScreen = accountPreferenceHashMap.get(accountID); 
-                    mRoot.removePreference(accountScreen);
-                    accountPreferenceHashMap.remove(accountID);
-                }
-                break;
-            default:
-                break;
+        switch (requestCode) {
+        case ACCOUNT_CREATE_REQUEST:
+            if (resultCode == AccountPreferenceActivity.result.ACCOUNT_CREATED) {
+                Bundle bundle = data.getExtras();
+                Log.i(TAG, "Create account settings");
+                HashMap<String, String> accountDetails = new HashMap<String, String>();
+                accountDetails = (HashMap<String, String>) bundle.getSerializable(AccountDetail.TAG);
+                createNewAccount(accountDetails);
+            }
+            break;
+        case ACCOUNT_EDIT_REQUEST:
+            if (resultCode == AccountPreferenceActivity.result.ACCOUNT_MODIFIED) {
+                Bundle bundle = data.getExtras();
+                String accountID = bundle.getString("AccountID");
+                Log.i(TAG, "Update account settings for " + accountID);
+
+                HashMap<String, String> accountDetails = new HashMap<String, String>();
+                accountDetails = (HashMap<String, String>) bundle.getSerializable(AccountDetail.TAG);
+                
+                Preference accountScreen = accountPreferenceHashMap.get(accountID);
+                mRoot.removePreference(accountScreen);
+                accountPreferenceHashMap.remove(accountID);
+                setAccountDetails(accountID, accountDetails);
+                
+            } else if (resultCode == AccountPreferenceActivity.result.ACCOUNT_DELETED) {
+                Bundle bundle = data.getExtras();
+                String accountID = bundle.getString("AccountID");
+
+                Log.i(TAG, "Remove account " + accountID);
+                deleteSelectedAccount(accountID);
+                Preference accountScreen = accountPreferenceHashMap.get(accountID);
+                mRoot.removePreference(accountScreen);
+                accountPreferenceHashMap.remove(accountID);
+            } else {
+                Log.i(TAG, "Edition canceled");
+            }
+            break;
+        default:
+            break;
+        }
+    }
+
+    private void createNewAccount(HashMap<String, String> accountDetails) {
+        try {
+            Log.i(TAG, "ADD ACCOUNT");
+            service.addAccount(accountDetails);
+        } catch (RemoteException e) {
+            Log.e(TAG, "Cannot call service method", e);
+        }
+    }
+    
+    private void setAccountDetails(String accountID, HashMap<String, String> accountDetails) {
+        try {
+            service.setAccountDetails(accountID, accountDetails);
+        } catch (RemoteException e) {
+            Log.e(TAG, "Cannot call service method", e);
         }
     }
+    
+    private void deleteSelectedAccount(String accountID) {
+        Log.i(TAG, "DeleteSelectedAccount");
+        try {
+            service.removeAccount(accountID);
+        } catch (RemoteException e) {
+            Log.e(TAG, "Cannot call service method", e);
+        }
+    };
 
     private BroadcastReceiver mMessageReceiver = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
-            String message = intent.getStringExtra("message");
             ArrayList<String> newList = (ArrayList<String>) getAccountList();
             Set<String> currentList = (Set<String>) accountPreferenceHashMap.keySet();
-            if(newList.size() > currentList.size()) {
-                for(String s : newList) {
-                    if(!currentList.contains(s)) {
+            if (newList.size() > currentList.size()) {
+                for (String s : newList) {
+                    if (!currentList.contains(s)) {
                         Preference accountScreen = createAccountPreferenceScreen(s);
                         mRoot.addPreference(accountScreen);
                         accountPreferenceHashMap.put(s, accountScreen);
@@ -203,7 +218,7 @@ public class AccountManagementFragment extends PreferenceFragment
 
     Preference.OnPreferenceClickListener launchAccountCreationOnClick = new Preference.OnPreferenceClickListener() {
         public boolean onPreferenceClick(Preference preference) {
-            if(preference.getTitle() == "Create New Account") {
+            if (preference.getTitle() == "Create New Account") {
                 launchAccountCreationActivity(preference);
             }
             return true;
@@ -219,25 +234,24 @@ public class AccountManagementFragment extends PreferenceFragment
 
     Preference.OnPreferenceClickListener removeSelectedAccountOnClick = new Preference.OnPreferenceClickListener() {
         public boolean onPreferenceClick(Preference preference) {
-            if(preference.getTitle() == "Delete Account") {
+            if (preference.getTitle() == "Delete Account") {
                 deleteSelectedAccount(preference.getKey());
             }
             return true;
         }
     };
 
-    private void launchAccountCreationActivity(Preference preference)
-    {
+    private void launchAccountCreationActivity(Preference preference) {
         Log.i(TAG, "Launch account creation activity");
         Intent intent = preference.getIntent();
+        intent.putExtra(AccountPreferenceActivity.KEY_MODE, AccountPreferenceActivity.mode.CREATION_MODE);
         startActivityForResult(intent, ACCOUNT_CREATE_REQUEST);
     }
 
-    private void launchAccountEditActivity(Preference preference)
-    {
+    private void launchAccountEditActivity(Preference preference) {
         Log.i(TAG, "Launch account edit activity");
         Intent intent = preference.getIntent();
-
+        intent.putExtra(AccountPreferenceActivity.KEY_MODE, AccountPreferenceActivity.mode.EDITION_MODE);
         Bundle bundle = intent.getExtras();
         String accountID = bundle.getString("AccountID");
 
@@ -258,22 +272,14 @@ public class AccountManagementFragment extends PreferenceFragment
         startActivityForResult(intent, ACCOUNT_EDIT_REQUEST);
     }
 
-    private void deleteSelectedAccount(String accountID) {
-        Log.i(TAG, "DeleteSelectedAccount");
-        try {
-            service.removeAccount(accountID);
-        } catch (RemoteException e) {
-            Log.e(TAG, "Cannot call service method", e);
-        }
-    };
+    
 
-    private ArrayList<String> getAccountList()
-    {
+    private ArrayList<String> getAccountList() {
         ArrayList<String> accountList = null;
         try {
-            accountList = (ArrayList) service.getAccountList(); 
+            accountList = (ArrayList<String>) service.getAccountList();
         } catch (RemoteException e) {
-           Log.e(TAG, "Cannot call service method", e); 
+            Log.e(TAG, "Cannot call service method", e);
         }
 
         // Remove the default account from list
@@ -282,11 +288,10 @@ public class AccountManagementFragment extends PreferenceFragment
         return accountList;
     }
 
-    private HashMap getAccountDetails(String accountID)
-    {
-        HashMap accountDetails = null;
+    private HashMap<String, String> getAccountDetails(String accountID) {
+        HashMap<String, String> accountDetails = null;
         try {
-            accountDetails = (HashMap) service.getAccountDetails(accountID);
+            accountDetails = (HashMap<String, String>) service.getAccountDetails(accountID);
         } catch (RemoteException e) {
             Log.e(TAG, "Cannot call service method", e);
         }
@@ -294,17 +299,9 @@ public class AccountManagementFragment extends PreferenceFragment
         return accountDetails;
     }
 
-    private void setAccountDetails(String accountID, HashMap<String, String> accountDetails)
-    {
-        try {
-            service.setAccountDetails(accountID, accountDetails);
-        } catch (RemoteException e) {
-            Log.e(TAG, "Cannot call service method", e);
-        }
-    }
+    
 
-    public PreferenceScreen getAccountListPreferenceScreen()
-    {
+    public PreferenceScreen getAccountListPreferenceScreen() {
         Activity currentContext = getActivity();
 
         mRoot = getPreferenceManager().createPreferenceScreen(currentContext);
@@ -324,32 +321,39 @@ public class AccountManagementFragment extends PreferenceFragment
         Preference createNewAccount = new Preference(currentContext);
         createNewAccount.setTitle("Create New Account");
         createNewAccount.setOnPreferenceClickListener(launchAccountCreationOnClick);
-        createNewAccount.setIntent(new Intent().setClass(getActivity(), AccountCreationActivity.class));
+        createNewAccount.setIntent(new Intent().setClass(getActivity(), AccountPreferenceActivity.class));
         mRoot.addPreference(createNewAccount);
 
         ArrayList<String> accountList = getAccountList();
-        for(String s : accountList) {
+        for (String s : accountList) {
             Preference accountScreen = createAccountPreferenceScreen(s);
             mRoot.addPreference(accountScreen);
-            accountPreferenceHashMap.put(s, accountScreen); 
+            accountPreferenceHashMap.put(s, accountScreen);
         }
-         
+
         return mRoot;
     }
 
     Preference createAccountPreferenceScreen(String accountID) {
 
+        HashMap<String, String> details = getAccountDetails(accountID);
+        // Set<String> keys = details.keySet();
+        // Iterator<String> ite = keys.iterator();
+        // while(ite.hasNext()){
+        // Log.i(TAG,"key : "+ ite.next());
+        // }
         Bundle bundle = new Bundle();
         bundle.putString("AccountID", accountID);
 
-        Intent intent = new Intent().setClass(getActivity(), AccountPreferenceActivity.class); 
+        Intent intent = new Intent().setClass(getActivity(), AccountPreferenceActivity.class);
         intent.putExtras(bundle);
 
         Preference editAccount = new Preference(getActivity());
-        editAccount.setTitle(accountID);
+        editAccount.setTitle(details.get(AccountDetailBasic.CONFIG_ACCOUNT_ALIAS));
+        editAccount.setSummary(details.get(AccountDetailBasic.CONFIG_ACCOUNT_HOSTNAME));
         editAccount.setOnPreferenceClickListener(launchAccountEditOnClick);
         editAccount.setIntent(intent);
-        
+
         return editAccount;
     }
 }
diff --git a/src/com/savoirfairelinux/sflphone/client/PrefManagementFragment.java b/src/com/savoirfairelinux/sflphone/fragments/AudioManagementFragment.java
similarity index 98%
rename from src/com/savoirfairelinux/sflphone/client/PrefManagementFragment.java
rename to src/com/savoirfairelinux/sflphone/fragments/AudioManagementFragment.java
index d1f8697cc8490664806eab0f5a5c3bc5d64caab0..954eb496096ff3710e7412c3532cece3271eed09 100644
--- a/src/com/savoirfairelinux/sflphone/client/PrefManagementFragment.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/AudioManagementFragment.java
@@ -29,7 +29,7 @@
  *  as that of the covered work.
  */
 
-package com.savoirfairelinux.sflphone.client;
+package com.savoirfairelinux.sflphone.fragments;
 
 import android.app.Activity;
 import android.content.Context;
@@ -53,12 +53,12 @@ import android.widget.TextView;
 
 import com.savoirfairelinux.sflphone.R;
 
-public class PrefManagementFragment extends PreferenceFragment
+public class AudioManagementFragment extends PreferenceFragment
 {
     static final String TAG = "PrefManagementFragment";
     static final String CURRENT_VALUE = "Current value:: "; 
 
-    public PrefManagementFragment()
+    public AudioManagementFragment()
     {
     }
 
diff --git a/src/com/savoirfairelinux/sflphone/client/ButtonSectionFragment.java b/src/com/savoirfairelinux/sflphone/fragments/ButtonSectionFragment.java
similarity index 69%
rename from src/com/savoirfairelinux/sflphone/client/ButtonSectionFragment.java
rename to src/com/savoirfairelinux/sflphone/fragments/ButtonSectionFragment.java
index e15dddcec33e3ebe1804f8f9c69e5ef8cef866bb..02c72e58fcd21213b6036e30d22750ba421c11d8 100644
--- a/src/com/savoirfairelinux/sflphone/client/ButtonSectionFragment.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/ButtonSectionFragment.java
@@ -1,19 +1,15 @@
-package com.savoirfairelinux.sflphone.client;
+package com.savoirfairelinux.sflphone.fragments;
 
 import android.app.Fragment;
 import android.os.Bundle;
-import android.text.Editable;
 import android.util.Log;
-import android.view.InflateException;
 import android.view.LayoutInflater;
 import android.view.View;
-import android.view.View.OnClickListener;
 import android.view.ViewGroup;
-import android.widget.Button;
 import android.widget.EditText;
-import android.widget.TextView;
 
 import com.savoirfairelinux.sflphone.R;
+import com.savoirfairelinux.sflphone.model.Numpad;
 
 public class ButtonSectionFragment extends Fragment
 {
@@ -33,15 +29,17 @@ public class ButtonSectionFragment extends Fragment
     {
         View view;
         Log.i(TAG, "onCreateView" );
-        view = inflater.inflate(R.layout.test_layout, parent, false);
-
-        /*
+        view = inflater.inflate(R.layout.frag_button_section, parent, false);
+        
         Numpad numpad = (Numpad) view.findViewById(R.id.numPad);
 
-        mTextEntry = (EditText) view.findViewById(R.id.numDisplay);
+        mTextEntry = (EditText) parent.findViewById(R.id.phoneNumberTextEntry);
+        if(mTextEntry == null){
+            Log.i(TAG,"NULL");
+        }
 
         numpad.setEditText(mTextEntry);
-        */
+        
 
         return view;
     }
diff --git a/src/com/savoirfairelinux/sflphone/fragments/CallElementListFragment.java b/src/com/savoirfairelinux/sflphone/fragments/CallElementListFragment.java
new file mode 100644
index 0000000000000000000000000000000000000000..fb9f83b7b1e34c3bbea04183203d7130cb206ae5
--- /dev/null
+++ b/src/com/savoirfairelinux/sflphone/fragments/CallElementListFragment.java
@@ -0,0 +1,347 @@
+/*
+ *  Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
+ *
+ *  Author: Adrien Beraud <adrien.beraud@gmail.com>
+ *
+ *  This program 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.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *  Additional permission under GNU GPL version 3 section 7:
+ *
+ *  If you modify this program, or any covered work, by linking or
+ *  combining it with the OpenSSL project's OpenSSL library (or a
+ *  modified version of that library), containing parts covered by the
+ *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
+ *  grants you additional permission to convey the resulting work.
+ *  Corresponding Source for a non-source form of such a combination
+ *  shall include the source code for the parts of OpenSSL used as well
+ *  as that of the covered work.
+ */
+package com.savoirfairelinux.sflphone.fragments;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.ListFragment;
+import android.app.LoaderManager;
+import android.content.ContentResolver;
+import android.content.ContentUris;
+import android.content.Context;
+import android.content.CursorLoader;
+import android.content.DialogInterface;
+import android.content.Loader;
+import android.database.Cursor;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.CommonDataKinds;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.CommonDataKinds.SipAddress;
+import android.provider.ContactsContract.Contacts;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemLongClickListener;
+import android.widget.ListView;
+
+import com.savoirfairelinux.sflphone.R;
+import com.savoirfairelinux.sflphone.account.AccountSelectionSpinner;
+import com.savoirfairelinux.sflphone.adapters.CallElementAdapter;
+import com.savoirfairelinux.sflphone.client.SFLPhoneHomeActivity;
+import com.savoirfairelinux.sflphone.client.SFLphoneApplication;
+import com.savoirfairelinux.sflphone.client.receiver.AccountListReceiver;
+import com.savoirfairelinux.sflphone.model.SipCall;
+import com.savoirfairelinux.sflphone.service.ISipService;
+
+/**
+ * Main list of Call Elements. We don't manage contacts ourself so they are
+ */
+public class CallElementListFragment extends ListFragment implements LoaderManager.LoaderCallbacks<Cursor> {
+    private static final String TAG = CallElementListFragment.class.getSimpleName();
+
+    // private ContactManager mContactManager;
+    private CallElementAdapter mAdapter;
+    private String mCurFilter;
+    private SFLPhoneHomeActivity sflphoneHome;
+    // private SFLphoneApplication sflphoneApplication;
+    private ISipService service;
+    private AccountSelectionSpinner mAccountSelectionSpinner;
+
+    private AccountListReceiver mAccountList;
+
+    private boolean isReady = false;
+
+    static final String[] CONTACTS_SUMMARY_PROJECTION = new String[] { Contacts._ID, Contacts.DISPLAY_NAME, Contacts.PHOTO_ID, Contacts.LOOKUP_KEY };
+    static final String[] CONTACTS_PHONES_PROJECTION = new String[] { Phone.NUMBER, Phone.TYPE };
+    static final String[] CONTACTS_SIP_PROJECTION = new String[] { SipAddress.SIP_ADDRESS, SipAddress.TYPE };
+
+    @Override
+    public void onAttach(Activity activity) {
+        super.onAttach(activity);
+        sflphoneHome = (SFLPhoneHomeActivity) activity;
+        service = ((SFLphoneApplication) sflphoneHome.getApplication()).getSipService();
+        mAccountList = ((SFLphoneApplication) sflphoneHome.getApplication()).getAccountList();
+        Log.w(TAG, "onAttach() service=" + service + ", accountList=" + mAccountList);
+    }
+
+    public String getSelectedAccount() {
+        // return mAccountSelectionButton.getText().toString();
+        return "CIOUCOU";
+    }
+
+    /**
+     * Runnable that fill information in a contact card asynchroniously.
+     */
+    public static class InfosLoader implements Runnable {
+        private View view;
+        private long cid;
+        private ContentResolver cr;
+
+        public InfosLoader(Context context, View element, long contact_id) {
+            cid = contact_id;
+            cr = context.getContentResolver();
+            view = element;
+        }
+
+        public static Bitmap loadContactPhoto(ContentResolver cr, long id) {
+            Uri uri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, id);
+            InputStream input = ContactsContract.Contacts.openContactPhotoInputStream(cr, uri);
+            if (input == null) {
+                return null;
+            }
+            return BitmapFactory.decodeStream(input);
+        }
+
+        @Override
+        public void run() {
+            final Bitmap photo_bmp = loadContactPhoto(cr, cid);
+
+            Cursor phones = cr.query(CommonDataKinds.Phone.CONTENT_URI, CONTACTS_PHONES_PROJECTION, CommonDataKinds.Phone.CONTACT_ID + " = ?",
+                    new String[] { Long.toString(cid) }, null);
+
+            final List<String> numbers = new ArrayList<String>();
+            while (phones.moveToNext()) {
+                String number = phones.getString(phones.getColumnIndex(CommonDataKinds.Phone.NUMBER));
+                // int type = phones.getInt(phones.getColumnIndex(CommonDataKinds.Phone.TYPE));
+                numbers.add(number);
+            }
+            phones.close();
+            // TODO: same for SIP adresses.
+
+            final Bitmap bmp = photo_bmp;
+            view.post(new Runnable() {
+                @Override
+                public void run() {
+                    /*
+                     * ImageView photo_view = (ImageView) view.findViewById(R.id.photo); TextView phones_txt = (TextView)
+                     * view.findViewById(R.id.phones);
+                     * 
+                     * if (photo_bmp != null) { photo_view.setImageBitmap(bmp); photo_view.setVisibility(View.VISIBLE); } else {
+                     * photo_view.setVisibility(View.GONE); }
+                     * 
+                     * if (numbers.size() > 0) { String phonestxt = numbers.get(0); for (int i = 1, n = numbers.size(); i < n; i++) phonestxt += "\n"
+                     * + numbers.get(i); phones_txt.setText(phonestxt); phones_txt.setVisibility(View.VISIBLE); } else
+                     * phones_txt.setVisibility(View.GONE);
+                     */
+                }
+            });
+        }
+    }
+
+    public CallElementListFragment() {
+        super();
+    }
+
+    public void setAccountList(AccountListReceiver accountList) {
+        mAccountList = accountList;
+    }
+
+    public void addCall(SipCall c) {
+        Log.i(TAG, "Adding call " + c.mCallInfo.mDisplayName);
+        mAdapter.add(c);
+    }
+
+    public void removeCall(SipCall c) {
+        Log.i(TAG, "Removing call " + c.mCallInfo.mDisplayName);
+        mAdapter.remove(c);
+    }
+
+    @Override
+    public void onActivityCreated(Bundle savedInstanceState) {
+        super.onActivityCreated(savedInstanceState);
+
+        // Give some text to display if there is no data. In a real
+        // application this would come from a resource.
+        // setEmptyText("No phone numbers");
+
+        // We have a menu item to show in action bar.
+        setHasOptionsMenu(true);
+
+        // Create an empty adapter we will use to display the loaded data.
+        ArrayList calls = new ArrayList();
+        mAdapter = new CallElementAdapter(getActivity(), calls);
+        setListAdapter(mAdapter);
+
+        // Start out with a progress indicator.
+        // setListShown(false);
+
+        // Prepare the loader. Either re-connect with an existing one,
+        // or start a new one.
+        // getLoaderManager().initLoader(0, null, this)
+
+        final Context context = getActivity();
+        ListView lv = getListView();
+        lv.setOnItemLongClickListener(new OnItemLongClickListener() {
+            @Override
+            public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) {
+                Log.i(TAG, "On Long Click");
+                final CharSequence[] items = { "Hang up Call", "Send Message", "Add to Conference" };
+                final SipCall call = (SipCall) mAdapter.getItem(pos);
+                // // FIXME
+                // service = sflphoneApplication.getSipService();
+                AlertDialog.Builder builder = new AlertDialog.Builder(context);
+                builder.setTitle("Action to perform with " + call.mCallInfo.mDisplayName).setCancelable(true)
+                        .setItems(items, new DialogInterface.OnClickListener() {
+                            public void onClick(DialogInterface dialog, int item) {
+                                Log.i(TAG, "Selected " + items[item]);
+                                switch (item) {
+                                case 0:
+                                    call.notifyServiceHangup(service);
+                                    break;
+                                case 1:
+                                    call.sendTextMessage();
+                                    // Need to hangup this call immediately since no way to do it after this action
+                                    call.notifyServiceHangup(service);
+                                    break;
+                                case 2:
+                                    call.addToConference();
+                                    // Need to hangup this call immediately since no way to do it after this action
+                                    call.notifyServiceHangup(service);
+                                    break;
+                                default:
+                                    break;
+                                }
+                            }
+                        });
+                AlertDialog alert = builder.create();
+                alert.show();
+
+                return true;
+            }
+        });
+    }
+
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+        Log.i(TAG, "onCreateView");
+        View inflatedView = inflater.inflate(R.layout.frag_call_element, container, false);
+
+        mAccountSelectionSpinner = (AccountSelectionSpinner) inflatedView.findViewById(R.id.account_selection_button);
+        mAccountList.addManagementUI(mAccountSelectionSpinner);
+        mAccountSelectionSpinner.setAccountList(mAccountList);
+
+        isReady = true;
+        if (service != null) {
+            onServiceSipBinded(service);
+        }
+        return inflatedView;
+    }
+
+    public void onListItemClick(ListView l, View v, int position, long id) {
+        // Insert desired behavior here.
+        SipCall call = (SipCall) mAdapter.getItem(position);
+        Log.i(TAG, "Call Clicked: " + call.getCallId());
+
+        call.launchCallActivity(getActivity());
+
+        sflphoneHome.onSelectedCallAction(call);
+    }
+
+    @Override
+    public Loader<Cursor> onCreateLoader(int id, Bundle args) {
+
+        Log.i(TAG, "onCreateLoader");
+        // return new CursorLoader(getActivity(), CommonDataKinds.Phone.CONTENT_URI, null,null,null, null);
+
+        // This is called when a new Loader needs to be created. This
+        // sample only has one Loader, so we don't care about the ID.
+        // First, pick the base URI to use depending on whether we are
+        // currently filtering.
+        Uri baseUri;
+
+        if (mCurFilter != null) {
+            baseUri = Uri.withAppendedPath(Contacts.CONTENT_FILTER_URI, Uri.encode(mCurFilter));
+        } else {
+            baseUri = Contacts.CONTENT_URI;
+        }
+
+        // Now create and return a CursorLoader that will take care of
+        // creating a Cursor for the data being displayed.
+        String select = "((" + Contacts.DISPLAY_NAME + " NOTNULL) AND (" + Contacts.HAS_PHONE_NUMBER + "=1) AND (" + Contacts.DISPLAY_NAME
+                + " != '' ))";
+        // String select = "((" + Contacts.DISPLAY_NAME + " NOTNULL) AND (" + Contacts.DISPLAY_NAME + " != '' ))";
+
+        return new CursorLoader(getActivity(), baseUri, CONTACTS_SUMMARY_PROJECTION, select, null, Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC");
+    }
+
+    @Override
+    public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
+        Log.i(TAG, "onLoadFinished");
+        // Swap the new cursor in. (The framework will take care of closing the
+        // old cursor once we return.)
+        // mAdapter.swapCursor(data);
+
+        // The list should now be shown.
+        /*
+         * if (isResumed()) { setListShown(true); } else { setListShownNoAnimation(true); }
+         */
+    }
+
+    @Override
+    public void onLoaderReset(Loader<Cursor> loader) {
+        // This is called when the last Cursor provided to onLoadFinished()
+        // above is about to be closed. We need to make sure we are no
+        // longer using it.
+        // mAdapter.swapCursor(null);
+    }
+
+    /**
+     * Called by activity to pass a reference to sipservice to Fragment.
+     * 
+     * @param isip
+     */
+    public void onServiceSipBinded(ISipService isip) {
+
+        if (isReady) {
+            service = isip;
+            ArrayList<String> accountList;
+            try {
+                accountList = (ArrayList<String>) service.getAccountList();
+                mAccountSelectionSpinner.populate(service, accountList);
+            } catch (RemoteException e) {
+                Log.i(TAG, e.toString());
+            }
+        }
+
+    }
+
+}
diff --git a/src/com/savoirfairelinux/sflphone/client/ContactListFragment.java b/src/com/savoirfairelinux/sflphone/fragments/ContactListFragment.java
similarity index 92%
rename from src/com/savoirfairelinux/sflphone/client/ContactListFragment.java
rename to src/com/savoirfairelinux/sflphone/fragments/ContactListFragment.java
index 83037f4811a5ee33bb649434c6c4a5f91bf1116d..18e8043df65d8ad62b3ed943aaa1cda41ee518b5 100644
--- a/src/com/savoirfairelinux/sflphone/client/ContactListFragment.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/ContactListFragment.java
@@ -28,13 +28,18 @@
  *  shall include the source code for the parts of OpenSSL used as well
  *  as that of the covered work.
  */
-package com.savoirfairelinux.sflphone.client;
+package com.savoirfairelinux.sflphone.fragments;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 import android.app.Activity;
+import android.app.AlertDialog;
 import android.app.ListFragment;
 import android.app.LoaderManager;
-import android.app.AlertDialog;
-import android.app.AlertDialog.Builder;
 import android.content.ContentResolver;
 import android.content.ContentUris;
 import android.content.Context;
@@ -46,41 +51,38 @@ import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.net.Uri;
 import android.os.Bundle;
-import android.os.RemoteException;
-import android.provider.*;
+import android.provider.BaseColumns;
+import android.provider.ContactsContract;
 import android.provider.ContactsContract.CommonDataKinds;
 import android.provider.ContactsContract.CommonDataKinds.Phone;
 import android.provider.ContactsContract.CommonDataKinds.SipAddress;
 import android.provider.ContactsContract.Contacts;
+import android.support.v4.view.MenuItemCompat;
 import android.text.TextUtils;
+import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.Menu;
-import android.view.MenuItem;
 import android.view.MenuInflater;
+import android.view.MenuItem;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.Button;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemLongClickListener;
+import android.widget.AdapterView.OnItemSelectedListener;
 import android.widget.CursorAdapter;
 import android.widget.ImageView;
 import android.widget.ListView;
-import android.widget.TextView;
-import android.widget.Toast;
 import android.widget.SearchView;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemLongClickListener;
-import android.widget.AdapterView.OnItemSelectedListener;
 import android.widget.SearchView.OnQueryTextListener;
-import android.util.Log;
-import java.io.InputStream;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.List;
-import java.util.ArrayList;
+import android.widget.TextView;
 
 import com.savoirfairelinux.sflphone.R;
+import com.savoirfairelinux.sflphone.account.AccountSelectionSpinner;
+import com.savoirfairelinux.sflphone.client.SFLPhoneHomeActivity;
+import com.savoirfairelinux.sflphone.client.SFLphoneApplication;
+import com.savoirfairelinux.sflphone.client.receiver.AccountListReceiver;
+import com.savoirfairelinux.sflphone.model.SipCall;
 import com.savoirfairelinux.sflphone.service.ISipService;
-import com.savoirfairelinux.sflphone.utils.AccountList;
-import com.savoirfairelinux.sflphone.utils.AccountSelectionButton;
 
 public class ContactListFragment extends ListFragment implements OnQueryTextListener, LoaderManager.LoaderCallbacks<Cursor>
 {
@@ -88,11 +90,10 @@ public class ContactListFragment extends ListFragment implements OnQueryTextList
     ContactElementAdapter mAdapter;
     Activity mContext;
     String mCurFilter;
-    private SFLPhoneHome sflphoneHome;
+    private SFLPhoneHomeActivity sflphoneHome;
     private SFLphoneApplication sflphoneApplication;
     private ISipService service;
-    private AccountSelectionButton mAccountSelectionButton;
-    private AccountList mAccountList;
+    private AccountListReceiver mAccountList;
 
     // These are the Contacts rows that we will retrieve.
     static final String[] CONTACTS_SUMMARY_PROJECTION = new String[] { Contacts._ID, Contacts.DISPLAY_NAME,
@@ -103,7 +104,7 @@ public class ContactListFragment extends ListFragment implements OnQueryTextList
     @Override
     public void onAttach(Activity activity) {
         super.onAttach(activity);
-        sflphoneHome = (SFLPhoneHome) activity;
+        sflphoneHome = (SFLPhoneHomeActivity) activity;
         sflphoneApplication = (SFLphoneApplication) sflphoneHome.getApplication();
         service = sflphoneApplication.getSipService();
         mAccountList = sflphoneApplication.getAccountList();
@@ -176,7 +177,7 @@ public class ContactListFragment extends ListFragment implements OnQueryTextList
         public View newView(Context context, Cursor cursor, ViewGroup parent)
         {
             LayoutInflater inflater = LayoutInflater.from(context);
-            View v = inflater.inflate(R.layout.call_element, parent, false);
+            View v = inflater.inflate(R.layout.item_contact, parent, false);
             bindView(v, context, cursor);
             return v;
         }
@@ -280,13 +281,7 @@ public class ContactListFragment extends ListFragment implements OnQueryTextList
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
     {
-        View inflatedView = inflater.inflate(R.layout.call_element_list, container, false);
-
-        // Button accountSelectionButton = (Button) inflatedView.findViewById(R.id.account_selection_button);
-        mAccountSelectionButton = (AccountSelectionButton) inflatedView.findViewById(R.id.account_selection_button);
-        mAccountList.addManagementUI(mAccountSelectionButton);
-        mAccountSelectionButton.setAccountList(mAccountList);
-
+        View inflatedView = inflater.inflate(R.layout.frag_contact_list, container, false);
         return inflatedView;
     }
 
@@ -296,7 +291,8 @@ public class ContactListFragment extends ListFragment implements OnQueryTextList
         // Place an action bar item for searching
         MenuItem item = menu.add("Search");
         item.setIcon(R.drawable.ic_menu_search);
-        item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
+        
+        item.setShowAsAction(MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
         SearchView sv = new SearchView(getActivity());
         sv.setOnQueryTextListener(this);
         item.setActionView(sv);
diff --git a/src/com/savoirfairelinux/sflphone/fragments/HistoryFragment.java b/src/com/savoirfairelinux/sflphone/fragments/HistoryFragment.java
new file mode 100644
index 0000000000000000000000000000000000000000..23d98f5a86a794942d260e0536d67d63ab6c7232
--- /dev/null
+++ b/src/com/savoirfairelinux/sflphone/fragments/HistoryFragment.java
@@ -0,0 +1,23 @@
+package com.savoirfairelinux.sflphone.fragments;
+
+import android.app.Fragment;
+import android.os.Bundle;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+public class HistoryFragment extends Fragment {
+
+    public static final String ARG_SECTION_NUMBER = "section_number";
+
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
+        TextView textView = new TextView(getActivity());
+        textView.setGravity(Gravity.CENTER);
+        Bundle args = getArguments();
+        textView.setText("ARG_SECTION_NUMBER=" + Integer.toString(args.getInt(ARG_SECTION_NUMBER)));
+        return textView;
+    }
+}
diff --git a/src/com/savoirfairelinux/sflphone/client/CallContact.java b/src/com/savoirfairelinux/sflphone/model/CallContact.java
similarity index 97%
rename from src/com/savoirfairelinux/sflphone/client/CallContact.java
rename to src/com/savoirfairelinux/sflphone/model/CallContact.java
index d56632eaf5ebd0d858e7fba21cf880d78352009e..fd3ea342bbb0c46ddd8d13a5046af7fcbf1959a7 100644
--- a/src/com/savoirfairelinux/sflphone/client/CallContact.java
+++ b/src/com/savoirfairelinux/sflphone/model/CallContact.java
@@ -28,7 +28,7 @@
  *  shall include the source code for the parts of OpenSSL used as well
  *  as that of the covered work.
  */
-package com.savoirfairelinux.sflphone.client;
+package com.savoirfairelinux.sflphone.model;
 
 public class CallContact
 {
diff --git a/src/com/savoirfairelinux/sflphone/client/ContactManager.java b/src/com/savoirfairelinux/sflphone/model/ContactManager.java
similarity index 99%
rename from src/com/savoirfairelinux/sflphone/client/ContactManager.java
rename to src/com/savoirfairelinux/sflphone/model/ContactManager.java
index 13bfe188c18cd6fba7fa3286d77aa01d2325f1fc..861b0ad2ecdc07b344272f60433bf51538ae96b9 100644
--- a/src/com/savoirfairelinux/sflphone/client/ContactManager.java
+++ b/src/com/savoirfairelinux/sflphone/model/ContactManager.java
@@ -28,7 +28,7 @@
  *  shall include the source code for the parts of OpenSSL used as well
  *  as that of the covered work.
  */
-package com.savoirfairelinux.sflphone.client;
+package com.savoirfairelinux.sflphone.model;
 
 import android.content.ContentResolver;
 import android.content.Context;
@@ -38,6 +38,7 @@ import android.provider.ContactsContract.Contacts;
 import android.util.Log;
 import java.util.ArrayList;
 
+
 public class ContactManager
 {
     int mCount;
diff --git a/src/com/savoirfairelinux/sflphone/client/Numpad.java b/src/com/savoirfairelinux/sflphone/model/Numpad.java
similarity index 97%
rename from src/com/savoirfairelinux/sflphone/client/Numpad.java
rename to src/com/savoirfairelinux/sflphone/model/Numpad.java
index e8a570ac85fc5d30cf9f983720773c88e857acd7..707e3b4c12e5c70c42aeb884ed4ea6ee1b9ab7e7 100644
--- a/src/com/savoirfairelinux/sflphone/client/Numpad.java
+++ b/src/com/savoirfairelinux/sflphone/model/Numpad.java
@@ -1,4 +1,4 @@
-package com.savoirfairelinux.sflphone.client;
+package com.savoirfairelinux.sflphone.model;
 
 import android.content.Context;
 import android.text.Editable;
diff --git a/src/com/savoirfairelinux/sflphone/client/SipCall.java b/src/com/savoirfairelinux/sflphone/model/SipCall.java
similarity index 96%
rename from src/com/savoirfairelinux/sflphone/client/SipCall.java
rename to src/com/savoirfairelinux/sflphone/model/SipCall.java
index 25fec632da6b55bb34c0d5ef6cdf21755021e914..679d2dfe3aa45bb7f3748f1e46c7bb377e211ca7 100644
--- a/src/com/savoirfairelinux/sflphone/client/SipCall.java
+++ b/src/com/savoirfairelinux/sflphone/model/SipCall.java
@@ -28,29 +28,32 @@
  *  shall include the source code for the parts of OpenSSL used as well
  *  as that of the covered work.
  */
-package com.savoirfairelinux.sflphone.client;
+package com.savoirfairelinux.sflphone.model;
+
+import java.util.ArrayList;
 
 import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
-import android.os.Parcelable;
 import android.os.Parcel;
+import android.os.Parcelable;
 import android.os.RemoteException;
 import android.util.Log;
 import android.view.View;
-import java.util.ArrayList;
 
-import com.savoirfairelinux.sflphone.service.ISipService;
+import com.savoirfairelinux.sflphone.adapters.CallElementAdapter.CallElementView;
 import com.savoirfairelinux.sflphone.client.CallActivity;
-import com.savoirfairelinux.sflphone.client.CallElementList.CallElementView;
+import com.savoirfairelinux.sflphone.client.SFLPhoneHomeActivity;
+import com.savoirfairelinux.sflphone.fragments.CallElementListFragment;
+import com.savoirfairelinux.sflphone.service.ISipService;
 
 public class SipCall
 {
     final static String TAG = "SipCall";
     public CallInfo mCallInfo;
     // Update UI on actions (answer, hangup)
-    static private CallElementList mCallElementList = null;
-    static private SFLPhoneHome mHome = null;
+    static private CallElementListFragment mCallElementList = null;
+    static private SFLPhoneHomeActivity mHome = null;
     private View mRowView = null;
 
     public static final int CALL_TYPE_UNDETERMINED = 0;
@@ -148,12 +151,12 @@ public class SipCall
         mCallInfo = info; 
     }
 
-    public static void setCallElementList(CallElementList list)
+    public static void setCallElementList(CallElementListFragment list)
     {
         mCallElementList = list;
     }
 
-    public static void setSFLPhoneHomeContext(SFLPhoneHome home)
+    public static void setSFLPhoneHomeContext(SFLPhoneHomeActivity home)
     {
         mHome = home;
     }
diff --git a/src/com/savoirfairelinux/sflphone/service/ConfigurationManagerCallback.java b/src/com/savoirfairelinux/sflphone/service/ConfigurationManagerCallback.java
index ab9fbbfe91574c586f72e27d36c6a2560c8a85bd..e0d4e58d08402dcb7438dac6f38e7bf10eaf0415 100644
--- a/src/com/savoirfairelinux/sflphone/service/ConfigurationManagerCallback.java
+++ b/src/com/savoirfairelinux/sflphone/service/ConfigurationManagerCallback.java
@@ -32,7 +32,8 @@ public class ConfigurationManagerCallback extends ConfigurationCallback {
     private Context mContext; 
 
     static public final String SIGNAL_NAME = "signal-name";
-    static public final String ACCOUNTS_CHANGED = "accounts-changed"; 
+    static public final String ACCOUNTS_LOADED = "accounts-loaded";
+    static public final String ACCOUNTS_CHANGED = "accounts-changed";
     static public final String ACCOUNT_STATE_CHANGED = "account-state-changed";
 
     public ConfigurationManagerCallback(Context context) {
diff --git a/src/com/savoirfairelinux/sflphone/service/SipService.java b/src/com/savoirfairelinux/sflphone/service/SipService.java
index 0a156e79cf39b0823319f52cf48cc2a31b84d13b..e0600065a809a8abc2b957f5cc4592bcd7d5e0f4 100644
--- a/src/com/savoirfairelinux/sflphone/service/SipService.java
+++ b/src/com/savoirfairelinux/sflphone/service/SipService.java
@@ -37,9 +37,9 @@ import android.util.Log;
 import android.widget.Toast;
 
 import com.savoirfairelinux.sflphone.service.ManagerImpl;
+import com.savoirfairelinux.sflphone.account.AccountDetailsHandler;
 import com.savoirfairelinux.sflphone.client.SFLphoneApplication;
 import com.savoirfairelinux.sflphone.service.ISipService;
-import com.savoirfairelinux.sflphone.utils.AccountDetailsHandler;
 
 import java.util.Map;
 import java.util.HashMap;
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountSelectionButton.java b/src/com/savoirfairelinux/sflphone/utils/AccountSelectionButton.java
deleted file mode 100644
index ad18e8bf6bf29aeb382215e9c19d39d754d5ea56..0000000000000000000000000000000000000000
--- a/src/com/savoirfairelinux/sflphone/utils/AccountSelectionButton.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- *  Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
- *
- *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
- *
- *  This program 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.
- *
- *  This program 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 this program; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-package com.savoirfairelinux.sflphone.utils;
-
-import android.content.Context;
-import android.os.RemoteException;
-import android.util.Log;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.Button;
-
-import com.savoirfairelinux.sflphone.client.AccountSelectionDialog;
-import com.savoirfairelinux.sflphone.service.ISipService;
-
-import java.util.ArrayList;
-
-public class AccountSelectionButton extends Button implements AccountManagementUI
-{
-    private static final String TAG = "AccountSelectionButton";
-    private Context mContext;
-    private ArrayList<String> mList = new ArrayList<String>();
-    private AccountList mAccountList = null;
-
-    public AccountSelectionButton(Context context) {
-        super(context);
-        mContext = context;
-        init();
-    }
-
-    public AccountSelectionButton(Context context, AttributeSet attrs) {
-        super(context, attrs);
-        mContext = context;
-        init();
-    }
-
-    public AccountSelectionButton(Context context, AttributeSet attrs, int defStyle) {
-        super(context, attrs, defStyle);
-        mContext = context;
-        init();
-    }
-
-    private void init() {
-        final AccountSelectionButton b = this;
-
-        setOnClickListener(new View.OnClickListener() {
-            public void onClick(View v) {
-                AccountSelectionDialog accountSelectionDialog = new AccountSelectionDialog(mContext, mList, b);
-                accountSelectionDialog.show();
-            }
-        });
-    }
-
-    public void setAccountList(AccountList accountList) {
-        mAccountList = accountList;
-    }
-
-    public void accountSelectedNotifyAccountList(String accountID) {
-        if(mAccountList != null) {
-            mAccountList.accountSelected(accountID, this);
-        }
-    }
-
-    public void setSelectedAccount(String accountID) {
-        setText(accountID);
-    }
-
-    public void accountAdded(ArrayList<String> newList) {
-        Log.i(TAG, "Account added");
-        mList = newList;
-
-        if(newList.size() == 1) {
-            setText(newList.get(0));
-        }
-    }
-
-    public void accountRemoved() {
-
-    }
-
-    public void accountUpdated() {
-
-    }
-}