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..ed3877ea829d98bb8ae8c025cc92155be72d2206 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" >
diff --git a/README b/README
index 7499cc7f90a9e190742d2823761e93063704e1f5..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
-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 fca278d5e4e222766ba186dfe4d37d3395404c6b..ed3877ea829d98bb8ae8c025cc92155be72d2206 100644
--- a/bin/AndroidManifest.xml
+++ b/bin/AndroidManifest.xml
@@ -1,14 +1,99 @@
+<!--
+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.
+-->
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.savoirfairelinux.sflphone_daemon"
+    package="com.savoirfairelinux.sflphone"
     android:versionCode="1"
-    android:versionName="1.0">
+    android:versionName="1.0" >
 
-    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" />
+    <uses-sdk
+        android:minSdkVersion="13"
+        android:targetSdkVersion="15" />
 
-    <application android:label="@string/app_name"
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.READ_CONTACTS" />
+    <uses-permission android:name="android.permission.READ_PROFILE" />
+    <uses-permission android:name="android.permission.CALL_PHONE" />
+    <uses-permission android:name="android.permission.CALL_PRIVILEGED" />
+    <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
+    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+    <uses-permission android:name="android.permission.RECORD_AUDIO" />
+
+    <application
+        android:name=".client.SFLphoneApplication"
+        android:debuggable="true"
         android:icon="@drawable/ic_launcher"
-        android:theme="@style/AppTheme">
+        android:label="@string/app_name"
+        android:theme="@style/AppTheme" >
+        <activity
+            android:name=".client.SFLPhoneHomeActivity"
+            android:label="@string/title_activity_sflphone_home"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppTheme" >
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+        <activity
+            android:name=".client.SFLPhonePreferenceActivity"
+            android:screenOrientation="portrait" >
+            <meta-data
+                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"/>
+        <activity android:name=".client.CallActivity"
+                  android:label="@string/app_name"
+                  android:screenOrientation="portrait"/>
+        <receiver
+            android:name=".client.receiver.NewOutgoingCallReceiver"
+            android:exported="true" >
+            <intent-filter>
+                <action android:name="android.intent.action.NEW_OUTGOING_CALL" />
 
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+        </receiver>
+        <service
+            android:name=".service.SipService">
+            <intent-filter>
+                <action android:name=".service.SipService" />
+            </intent-filter>
+        </service>
     </application>
 
 </manifest>
diff --git a/jni/sflphone b/jni/sflphone
index c0a81a7da156e66a2ff20080ae674e240858388b..c84e6953bafa3268de3f71f0a334d726ee563e41 160000
--- a/jni/sflphone
+++ b/jni/sflphone
@@ -1 +1 @@
-Subproject commit c0a81a7da156e66a2ff20080ae674e240858388b
+Subproject commit c84e6953bafa3268de3f71f0a334d726ee563e41
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 6facb3865b17ada4d8cff8ff99772aff158ff9e9..6c0d4a5c093dbb9930a89dbeff4a3b95e389af1a 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/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/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/src/com/savoirfairelinux/sflphone/utils/AccountDetail.java b/src/com/savoirfairelinux/sflphone/account/AccountDetail.java
similarity index 97%
rename from src/com/savoirfairelinux/sflphone/utils/AccountDetail.java
rename to src/com/savoirfairelinux/sflphone/account/AccountDetail.java
index 4992356e3d48ceadc93ce4b43fdd28c738536a1d..50a6257f5ce2f9cfdf31683656a8455320a87e4b 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;
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 98%
rename from src/com/savoirfairelinux/sflphone/utils/AccountDetailBasic.java
rename to src/com/savoirfairelinux/sflphone/account/AccountDetailBasic.java
index cb07474fc7735c37cd536d349df8685d5af7e467..03a1354c6db4e4cc7d0da5304abbe0dbf73da2d4 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;
 
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..3e71d728b90f2d476dca5baf7c8e62fa7cbb8ee7 100644
--- a/src/com/savoirfairelinux/sflphone/utils/AccountDetailsHandler.java
+++ b/src/com/savoirfairelinux/sflphone/account/AccountDetailsHandler.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 android.util.Log;
 
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountList.java b/src/com/savoirfairelinux/sflphone/account/AccountListReceiver.java
similarity index 96%
rename from src/com/savoirfairelinux/sflphone/utils/AccountList.java
rename to src/com/savoirfairelinux/sflphone/account/AccountListReceiver.java
index 3a8c791be4bd96b4f3ea396d0fc1da8e11c40224..d78db6f17e679b633999d10b901a57ec1933d944 100644
--- a/src/com/savoirfairelinux/sflphone/utils/AccountList.java
+++ b/src/com/savoirfairelinux/sflphone/account/AccountListReceiver.java
@@ -29,7 +29,7 @@
  *  as that of the covered work.
  */
 
-package com.savoirfairelinux.sflphone.utils;
+package com.savoirfairelinux.sflphone.account;
 
 import android.content.BroadcastReceiver;
 import android.content.Intent;
@@ -42,7 +42,7 @@ import java.util.ArrayList;
 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 +54,7 @@ public class AccountList extends BroadcastReceiver
 
     public static final String DEFAULT_ACCOUNT_ID = "IP2IP";
 
-    public AccountList() {
+    public AccountListReceiver() {
     }
 
     public void setSipService(ISipService service) {
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..6401d5b67c0603924c5c83998f0ce3dd10a57644 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.account.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/utils/AccountSelectionButton.java b/src/com/savoirfairelinux/sflphone/account/AccountSelectionSpinner.java
similarity index 51%
rename from src/com/savoirfairelinux/sflphone/utils/AccountSelectionButton.java
rename to src/com/savoirfairelinux/sflphone/account/AccountSelectionSpinner.java
index ad18e8bf6bf29aeb382215e9c19d39d754d5ea56..ef23f3592b7c5782dd748a62241192c73bbeaa36 100644
--- a/src/com/savoirfairelinux/sflphone/utils/AccountSelectionButton.java
+++ b/src/com/savoirfairelinux/sflphone/account/AccountSelectionSpinner.java
@@ -28,84 +28,106 @@
  *  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 android.content.Context;
-import android.os.RemoteException;
-import android.util.Log;
 import android.util.AttributeSet;
+import android.util.Log;
 import android.view.View;
-import android.widget.Button;
-
-import com.savoirfairelinux.sflphone.client.AccountSelectionDialog;
-import com.savoirfairelinux.sflphone.service.ISipService;
-
-import java.util.ArrayList;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Spinner;
+import android.widget.TextView;
 
-public class AccountSelectionButton extends Button implements AccountManagementUI
-{
+public class AccountSelectionSpinner extends Spinner implements AccountManagementUI {
     private static final String TAG = "AccountSelectionButton";
     private Context mContext;
     private ArrayList<String> mList = new ArrayList<String>();
-    private AccountList mAccountList = null;
+    private AccountListReceiver mAccountList = null;
+    ArrayAdapter mListAdapter;
 
-    public AccountSelectionButton(Context context) {
+    public AccountSelectionSpinner(Context context) {
         super(context);
         mContext = context;
-        init();
+
     }
 
-    public AccountSelectionButton(Context context, AttributeSet attrs) {
+    public AccountSelectionSpinner(Context context, AttributeSet attrs) {
         super(context, attrs);
         mContext = context;
-        init();
+
+
     }
 
-    public AccountSelectionButton(Context context, AttributeSet attrs, int defStyle) {
+    public AccountSelectionSpinner(Context context, AttributeSet attrs, int defStyle) {
         super(context, attrs, defStyle);
         mContext = context;
-        init();
+        mListAdapter = new ArrayAdapter(mContext, android.R.layout.simple_expandable_list_item_1, mList.toArray());
+
+        setOnItemSelectedListener(onClick);
+        setAdapter(mListAdapter);
     }
 
-    private void init() {
-        final AccountSelectionButton b = this;
+    private AdapterView.OnItemSelectedListener onClick = new AdapterView.OnItemSelectedListener() {
 
-        setOnClickListener(new View.OnClickListener() {
-            public void onClick(View v) {
-                AccountSelectionDialog accountSelectionDialog = new AccountSelectionDialog(mContext, mList, b);
-                accountSelectionDialog.show();
-            }
-        });
-    }
+        @Override
+        public void onItemSelected(AdapterView<?> arg0, View view, int arg2, long arg3) {
+            // public void onClick(DialogInterface dialog, int which) {
 
-    public void setAccountList(AccountList accountList) {
+            Log.i(TAG, "Selected Account: " + ((TextView) view).getText());
+            // mButton.setText(((TextView)view).getText());
+            accountSelectedNotifyAccountList(((TextView) view).getText().toString());
+            // setSelection(cursor.getPosition(),true);
+
+        }
+
+        @Override
+        public void onNothingSelected(AdapterView<?> arg0) {
+            // TODO Auto-generated method stub
+
+        }
+
+    };
+
+
+    public void setAccountList(AccountListReceiver accountList) {
+        Log.i(TAG,"setAccountList");
         mAccountList = accountList;
+        
     }
 
     public void accountSelectedNotifyAccountList(String accountID) {
-        if(mAccountList != null) {
+        Log.i(TAG, "->accountSelectedNotifyAccountList");
+        if (mAccountList != null) {
             mAccountList.accountSelected(accountID, this);
         }
     }
 
     public void setSelectedAccount(String accountID) {
-        setText(accountID);
+        Log.i(TAG,"Account Selected");
+        // setText(accountID);
     }
 
     public void accountAdded(ArrayList<String> newList) {
-        Log.i(TAG, "Account added");
-        mList = newList;
-
-        if(newList.size() == 1) {
-            setText(newList.get(0));
-        }
+        mListAdapter = new ArrayAdapter(mContext, android.R.layout.simple_expandable_list_item_1, newList.toArray());
+
+        setOnItemSelectedListener(onClick);
+        setAdapter(mListAdapter);
+        // Log.i(TAG, "Account added");
+        // mList = newList;
+        //
+        // if(newList.size() == 1) {
+        // setText(newList.get(0));
+        // }
     }
 
     public void accountRemoved() {
-
+        Log.i(TAG,"Account Removed");
     }
 
     public void accountUpdated() {
-
+        Log.i(TAG,"Account Updated");
     }
 }
diff --git a/src/com/savoirfairelinux/sflphone/client/AccountCreationActivity.java b/src/com/savoirfairelinux/sflphone/client/AccountCreationActivity.java
index 010e7f8dc55acff8471637a69185dc757d44dda0..93de02e83f518fe8e477b630bb1803af5e6a1188 100644
--- a/src/com/savoirfairelinux/sflphone/client/AccountCreationActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/AccountCreationActivity.java
@@ -31,6 +31,9 @@
 
 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;
@@ -42,30 +45,23 @@ import android.content.ServiceConnection;
 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.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.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.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;
+import com.savoirfairelinux.sflphone.service.SipService;
 
 public class AccountCreationActivity extends PreferenceActivity
 {
diff --git a/src/com/savoirfairelinux/sflphone/client/AccountPreferenceActivity.java b/src/com/savoirfairelinux/sflphone/client/AccountPreferenceActivity.java
index 5c105e0953bf4a22528fffab8fd22f2dd6b9b231..72c8efd07f0780794f1bd6f960375c0d21594ae9 100644
--- a/src/com/savoirfairelinux/sflphone/client/AccountPreferenceActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/AccountPreferenceActivity.java
@@ -52,12 +52,12 @@ import android.view.Menu;
 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 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.account.AccountDetailsHandler;
 
 import java.util.HashMap;
 import java.util.ArrayList;
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/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..26eb7b3c9b0b11eb82e9bdd8dfe7f74398cb5375
--- /dev/null
+++ b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java
@@ -0,0 +1,571 @@
+/*
+ *  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.Gravity;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.view.animation.AlphaAnimation;
+import android.view.animation.Animation;
+import android.view.animation.LinearInterpolator;
+import android.widget.EditText;
+import android.widget.ImageButton;
+import android.widget.TextView;
+
+import com.savoirfairelinux.sflphone.R;
+import com.savoirfairelinux.sflphone.account.AccountListReceiver;
+import com.savoirfairelinux.sflphone.client.receiver.CallList;
+import com.savoirfairelinux.sflphone.fragments.ButtonSectionFragment;
+import com.savoirfairelinux.sflphone.fragments.CallElementListFragment;
+import com.savoirfairelinux.sflphone.fragments.ContactListFragment;
+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 HistorySectionFragment mHistorySectionFragment = null;
+	private ButtonSectionFragment mButtonSectionFragment = null;
+	private boolean mBound = false;
+	private ISipService service;
+	public AccountListReceiver 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 = (CallElementListFragment) 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 CallElementListFragment();
+			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);
+
+		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;
+		}
+		// 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 CallElementListFragment();
+				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 = CallElementListFragment.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/SFLPhonePreferenceActivity.java b/src/com/savoirfairelinux/sflphone/client/SFLPhonePreferenceActivity.java
index 57f1e2c54cdf5596607c1a0c8623085e10db3fa6..17bed3e8a738cd64468c29740ed3f2496662f138 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,17 +43,15 @@ 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.PrefManagementFragment;
 import com.savoirfairelinux.sflphone.service.ISipService;
+import com.savoirfairelinux.sflphone.service.SipService;
 
 public class SFLPhonePreferenceActivity extends Activity implements ActionBar.TabListener
 {
diff --git a/src/com/savoirfairelinux/sflphone/client/SFLphoneApplication.java b/src/com/savoirfairelinux/sflphone/client/SFLphoneApplication.java
index 13739475aee9ade53965ca610ac091a5f893a47c..f7ef9c9ab150ffebc54af7e38befbf420a6c589f 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.account.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/CallList.java b/src/com/savoirfairelinux/sflphone/client/receiver/CallList.java
similarity index 94%
rename from src/com/savoirfairelinux/sflphone/utils/CallList.java
rename to src/com/savoirfairelinux/sflphone/client/receiver/CallList.java
index 1bf60e0e037314aedabeb1952970cf4477b93d1b..bfec63a180cf8614b650b658b6046d29e5975ac6 100644
--- a/src/com/savoirfairelinux/sflphone/utils/CallList.java
+++ b/src/com/savoirfairelinux/sflphone/client/receiver/CallList.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
 {
     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 CallList(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 91%
rename from src/com/savoirfairelinux/sflphone/client/AccountManagementFragment.java
rename to src/com/savoirfairelinux/sflphone/fragments/AccountManagementFragment.java
index 52fabeddc47d843495b2c23a14ac57a5d9451309..6568ade1bf57ade2f2ac0aede4dc28903bd2a4a4 100644
--- a/src/com/savoirfairelinux/sflphone/client/AccountManagementFragment.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/AccountManagementFragment.java
@@ -29,41 +29,38 @@
  *  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.Iterator;
+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.AccountCreationActivity;
 import com.savoirfairelinux.sflphone.client.AccountPreferenceActivity;
+import com.savoirfairelinux.sflphone.client.SFLPhonePreferenceActivity;
+import com.savoirfairelinux.sflphone.client.SFLphoneApplication;
+import com.savoirfairelinux.sflphone.service.ISipService;
 
 public class AccountManagementFragment extends PreferenceFragment
 {
@@ -271,7 +268,7 @@ public class AccountManagementFragment extends PreferenceFragment
     {
         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); 
         }
@@ -282,11 +279,11 @@ public class AccountManagementFragment extends PreferenceFragment
         return accountList;
     }
 
-    private HashMap getAccountDetails(String accountID)
+    private HashMap<String, String> getAccountDetails(String accountID)
     {
-        HashMap accountDetails = null;
+        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);
         }
@@ -339,6 +336,12 @@ public class AccountManagementFragment extends PreferenceFragment
 
     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);
 
@@ -346,7 +349,8 @@ public class AccountManagementFragment extends PreferenceFragment
         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);
         
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/client/CallElementList.java b/src/com/savoirfairelinux/sflphone/fragments/CallElementListFragment.java
similarity index 56%
rename from src/com/savoirfairelinux/sflphone/client/CallElementList.java
rename to src/com/savoirfairelinux/sflphone/fragments/CallElementListFragment.java
index bc115339fa3669da0639b5b1f348be5f86e9240d..ae5fc4a041f63f1a6a5dc278f68f71abe2b31425 100644
--- a/src/com/savoirfairelinux/sflphone/client/CallElementList.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/CallElementListFragment.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.fragments;
 
 import java.io.InputStream;
 import java.util.ArrayList;
@@ -37,10 +37,9 @@ 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;
@@ -52,77 +51,81 @@ 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;
 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.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
 import android.widget.AdapterView.OnItemLongClickListener;
-import android.widget.AdapterView.OnItemSelectedListener;
-import android.widget.*;
-import java.util.List;
-import java.util.ArrayList;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.TextView;
 
 import com.savoirfairelinux.sflphone.R;
+import com.savoirfairelinux.sflphone.account.AccountListReceiver;
+import com.savoirfairelinux.sflphone.account.AccountSelectionSpinner;
+import com.savoirfairelinux.sflphone.client.SFLPhoneHomeActivity;
+import com.savoirfairelinux.sflphone.client.SFLphoneApplication;
+import com.savoirfairelinux.sflphone.model.ContactManager;
+import com.savoirfairelinux.sflphone.model.SipCall;
 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
+ * Main list of Call Elements. We don't manage contacts ourself so they are
  */
-public class CallElementList extends ListFragment implements LoaderManager.LoaderCallbacks<Cursor>
-{
+public class CallElementListFragment 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 SFLPhoneHomeActivity sflphoneHome;
     private SFLphoneApplication sflphoneApplication;
     private ISipService service;
-    private AccountSelectionButton mAccountSelectionButton;
-    private AccountList mAccountList;
+    private AccountSelectionSpinner mAccountSelectionButton;
+    private AccountListReceiver mAccountList;
 
-    static final String[] CONTACTS_SUMMARY_PROJECTION = new String[] { Contacts._ID, Contacts.DISPLAY_NAME,
-                                                                       Contacts.PHOTO_ID, Contacts.LOOKUP_KEY };
+    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;
+        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 mAccountSelectionButton.getText().toString();
+        return "CIOUCOU";
     }
 
     /**
      * Runnable that fill information in a contact card asynchroniously.
      */
-    public static class InfosLoader implements Runnable
-    {
+    public static class InfosLoader implements Runnable {
         private View view;
         private long cid;
         private ContentResolver cr;
 
-        public InfosLoader(Context context, View element, long contact_id)
-        {
+        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) {
+        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) {
@@ -130,85 +133,67 @@ public class CallElementList extends ListFragment implements LoaderManager.Loade
             }
             return BitmapFactory.decodeStream(input);
         }
-		
+
         @Override
-        public void run()
-        {
-             final Bitmap photo_bmp = loadContactPhoto(cr, cid);
+        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);
+            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));
+                // 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()
-            {
+            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 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.
+     * 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
-    {
+    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);
+        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)
-        {
+        public View getView(int position, View convertView, ViewGroup parent) {
             View rowView = convertView;
             CallElementView entryView = null;
 
-            if(rowView == 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);
+                rowView = inflater.inflate(R.layout.item_contact, null);
 
                 // Hold the view objects in an object
                 // so they don't need to be re-fetched
@@ -239,60 +224,53 @@ public class CallElementList extends ListFragment implements LoaderManager.Loade
         }
     };
 
-    public static class CallElementView
-    {
+    public static class CallElementView {
         protected ImageButton toggleButton;
         protected Button button;
         protected ImageView photo;
         protected TextView displayName;
         protected TextView phones;
-        protected TextView state;
+        public TextView state;
     }
 
-    public CallElementList()
-    {
+    public CallElementListFragment() {
         super();
     }
 
-    public void setAccountList(AccountList accountList) {
+    public void setAccountList(AccountListReceiver accountList) {
         mAccountList = accountList;
     }
 
-    public void addCall(SipCall c)
-    {
+    public void addCall(SipCall c) {
         Log.i(TAG, "Adding call " + c.mCallInfo.mDisplayName);
         mAdapter.add(c);
     }
 
-    public void removeCall(SipCall c)
-    {
+    public void removeCall(SipCall c) {
         Log.i(TAG, "Removing call " + c.mCallInfo.mDisplayName);
         mAdapter.remove(c);
     }
-        
 
     @Override
-    public void onActivityCreated(Bundle savedInstanceState)
-    {
+    public void onActivityCreated(Bundle savedInstanceState) {
         super.onActivityCreated(savedInstanceState);
 
-        // Give some text to display if there is no data.  In a real
+        // Give some text to display if there is no data. In a real
         // application this would come from a resource.
-        //setEmptyText("No phone numbers");
+        // 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);
+        // setListShown(false);
 
-        // Prepare the loader.  Either re-connect with an existing one,
+        // Prepare the loader. Either re-connect with an existing one,
         // or start a new one.
         // getLoaderManager().initLoader(0, null, this)
 
@@ -302,35 +280,34 @@ public class CallElementList extends ListFragment implements LoaderManager.Loade
             @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 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; 
-                              }
-                          }
-                });
+                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();
 
@@ -341,17 +318,16 @@ public class CallElementList extends ListFragment implements LoaderManager.Loade
 
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
-        View inflatedView = inflater.inflate(R.layout.call_element_list, container, false);
+        View inflatedView = inflater.inflate(R.layout.frag_call_element, container, false);
 
-        mAccountSelectionButton = (AccountSelectionButton) inflatedView.findViewById(R.id.account_selection_button);
+        mAccountSelectionButton = (AccountSelectionSpinner) 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)
-    {
+
+    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());
@@ -361,64 +337,49 @@ public class CallElementList extends ListFragment implements LoaderManager.Loade
         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);
-	}
+    @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/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..a968d367d70ffbbd403ba065daa7cb81b5089a31 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.AccountListReceiver;
+import com.savoirfairelinux.sflphone.account.AccountSelectionSpinner;
+import com.savoirfairelinux.sflphone.client.SFLPhoneHomeActivity;
+import com.savoirfairelinux.sflphone.client.SFLphoneApplication;
+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/client/PrefManagementFragment.java b/src/com/savoirfairelinux/sflphone/fragments/PrefManagementFragment.java
similarity index 99%
rename from src/com/savoirfairelinux/sflphone/client/PrefManagementFragment.java
rename to src/com/savoirfairelinux/sflphone/fragments/PrefManagementFragment.java
index d1f8697cc8490664806eab0f5a5c3bc5d64caab0..bc2916ad2a335cbee076309c2fca5ed26b1f2d37 100644
--- a/src/com/savoirfairelinux/sflphone/client/PrefManagementFragment.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/PrefManagementFragment.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;
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 95%
rename from src/com/savoirfairelinux/sflphone/client/SipCall.java
rename to src/com/savoirfairelinux/sflphone/model/SipCall.java
index 25fec632da6b55bb34c0d5ef6cdf21755021e914..0466cdf7d8ed713cd7fe65db506206ae7a3b7d37 100644
--- a/src/com/savoirfairelinux/sflphone/client/SipCall.java
+++ b/src/com/savoirfairelinux/sflphone/model/SipCall.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.Context;
 import android.content.Intent;
@@ -42,15 +42,17 @@ import java.util.ArrayList;
 
 import com.savoirfairelinux.sflphone.service.ISipService;
 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.fragments.CallElementListFragment.CallElementView;
 
 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 +150,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/ConfigurationManagerJNI.java b/src/com/savoirfairelinux/sflphone/service/ConfigurationManagerJNI.java
index 6e38495bfbb96c4bc4735b6f28e4be6ef7391954..6106216a5f5d8fac0d0019ebc9bc26b7c58a0217 100644
--- a/src/com/savoirfairelinux/sflphone/service/ConfigurationManagerJNI.java
+++ b/src/com/savoirfairelinux/sflphone/service/ConfigurationManagerJNI.java
@@ -219,30 +219,6 @@ public class ConfigurationManagerJNI {
     return SFLPhoneserviceJNI.ConfigurationManagerJNI_getAudioManager(swigCPtr, this);
   }
 
-  public void setMailNotify() {
-    SFLPhoneserviceJNI.ConfigurationManagerJNI_setMailNotify(swigCPtr, this);
-  }
-
-  public SWIGTYPE_p_int32_t getMailNotify() {
-    return new SWIGTYPE_p_int32_t(SFLPhoneserviceJNI.ConfigurationManagerJNI_getMailNotify(swigCPtr, this), true);
-  }
-
-  public SWIGTYPE_p_std__mapT_std__string_int32_t_t getAddressbookSettings() {
-    return new SWIGTYPE_p_std__mapT_std__string_int32_t_t(SFLPhoneserviceJNI.ConfigurationManagerJNI_getAddressbookSettings(swigCPtr, this), true);
-  }
-
-  public void setAddressbookSettings(SWIGTYPE_p_std__mapT_std__string_int32_t_t settings) {
-    SFLPhoneserviceJNI.ConfigurationManagerJNI_setAddressbookSettings(swigCPtr, this, SWIGTYPE_p_std__mapT_std__string_int32_t_t.getCPtr(settings));
-  }
-
-  public StringVect getAddressbookList() {
-    return new StringVect(SFLPhoneserviceJNI.ConfigurationManagerJNI_getAddressbookList(swigCPtr, this), true);
-  }
-
-  public void setAddressbookList(StringVect list) {
-    SFLPhoneserviceJNI.ConfigurationManagerJNI_setAddressbookList(swigCPtr, this, StringVect.getCPtr(list), list);
-  }
-
   public StringMap getHookSettings() {
     return new StringMap(SFLPhoneserviceJNI.ConfigurationManagerJNI_getHookSettings(swigCPtr, this), true);
   }
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;