* #24601 working (not clean)
Modified action bar menu items to display properly
diff --git a/src/com/savoirfairelinux/sflphone/adapters/StarredContactsAdapter.java b/src/com/savoirfairelinux/sflphone/adapters/StarredContactsAdapter.java
index fcb1df5..db18074 100644
--- a/src/com/savoirfairelinux/sflphone/adapters/StarredContactsAdapter.java
+++ b/src/com/savoirfairelinux/sflphone/adapters/StarredContactsAdapter.java
@@ -45,7 +45,7 @@
     }
 
     @Override
-    public Object getItem(int index) {
+    public CallContact getItem(int index) {
         return dataset.get(index);
     }
 
diff --git a/src/com/savoirfairelinux/sflphone/client/CallActivity.java b/src/com/savoirfairelinux/sflphone/client/CallActivity.java
index 15f28fd..69dee2b 100644
--- a/src/com/savoirfairelinux/sflphone/client/CallActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/CallActivity.java
@@ -42,6 +42,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.ServiceConnection;
+import android.drm.DrmStore.Action;
 import android.graphics.Bitmap;
 import android.graphics.PointF;
 import android.os.Bundle;
@@ -154,38 +155,40 @@
 		//		mCall = new SipCall(info);
 		//
 		Intent intent = new Intent(this, SipService.class);
-		bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
+		
 		//setCallStateDisplay(mCall.getCallStateString());
 
-		String action = b.getString("action");
-		if(action.equals("call")) {
+		pendingAction = b.getString("action");
+		if(pendingAction.equals("call")) {
 			CallContact contact = b.getParcelable("CallContact");
+			
+			Log.i(TAG,"Calling "+ contact.getmDisplayName());
+			callContact(contact);
+//			SipCall.CallInfo info = new SipCall.CallInfo();
+//			Random random = new Random();
+//			String callID = Integer.toString(random.nextInt());
+//			Phone phone = contact.getSipPhone();
 
-			SipCall.CallInfo info = new SipCall.CallInfo();
-			Random random = new Random();
-			String callID = Integer.toString(random.nextInt());
-			Phone phone = contact.getSipPhone();
+//			info.mCallID = callID;
+//			info.mAccountID = ""+contact.getId();
+//			info.mDisplayName = contact.getmDisplayName();
+//			info.mPhone = phone==null?null:phone.toString();
+//			info.mEmail = contact.getmEmail();
+//			info.mCallType = SipCall.CALL_TYPE_OUTGOING;
 
-			info.mCallID = callID;
-			info.mAccountID = ""+contact.getId();
-			info.mDisplayName = contact.getmDisplayName();
-			info.mPhone = phone==null?null:phone.toString();
-			info.mEmail = contact.getmEmail();
-			info.mCallType = SipCall.CALL_TYPE_OUTGOING;
-
-			mCall = CallListReceiver.getCallInstance(info);
+//			mCall = CallListReceiver.getCallInstance(info);
+			
+			
 			//mCallbacks.onCallSelected(call);
 
-			pendingAction = action;
-
 			/*	try {
 				service.placeCall(info.mAccountID, info.mCallID, info.mPhone);
 			} catch (RemoteException e) {
 				Log.e(TAG, "Cannot call service method", e);
 			}*/
-
-			callContact(contact);
-		} else if(action.equals("incoming")) {
+			bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
+			
+		} else if(pendingAction.equals("incoming")) {
 
 		}
 
@@ -217,6 +220,7 @@
 		}));
 
 		model.listBubbles.add(contact_bubble);
+		contacts.put(contact_bubble, contact);
 	}
 
 	private void callIncoming() {
@@ -255,6 +259,23 @@
 			service = ISipService.Stub.asInterface(binder);
 			try {
 				service.registerClient(callback);
+				if(pendingAction.contentEquals("call")){
+				    
+				    Log.i(TAG, "Placing call");
+				    Random random = new Random();
+			        String callID = Integer.toString(random.nextInt());
+			        SipCall.CallInfo info = new SipCall.CallInfo();
+			        info.mCallID = callID;
+			        info.mAccountID = service.getAccountList().get(1).toString();
+			        info.mDisplayName = "Cool Guy!";
+			        info.mPhone = contacts.get(contacts.keySet().iterator().next()).getPhones().get(0).getNumber();
+			        info.mEmail = "coolGuy@coolGuy.com";
+			        info.mCallType = SipCall.CALL_TYPE_OUTGOING;
+			        
+			        mCall = CallListReceiver.getCallInstance(info);
+
+			        service.placeCall(info.mAccountID, info.mCallID, info.mPhone);
+				}
 			} catch (RemoteException e) {
 				Log.e(TAG, e.toString());
 			}
diff --git a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java
index 1c2df45..46059ae 100644
--- a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java
@@ -45,8 +45,6 @@
 import android.support.v13.app.FragmentStatePagerAdapter;
 import android.support.v4.view.ViewPager;
 import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
 import android.widget.ImageButton;
 import android.widget.Toast;
 
@@ -62,13 +60,15 @@
 public class SFLPhoneHomeActivity extends Activity implements ActionBar.TabListener, CallElementListFragment.Callbacks, HistoryFragment.Callbacks {
 	SectionsPagerAdapter mSectionsPagerAdapter = null;
 	static final String TAG = "SFLPhoneHome";
-	private static final int REQUEST_CODE_PREFERENCES = 1;
+	
 	ImageButton buttonCall, buttonHangup;
 	private ContactListFragment mDialingFragment = null;
 	private CallElementListFragment mCallElementList = null;
 	private HistoryFragment mHistorySectionFragment = null;
 	private boolean mBound = false;
 	private ISipService service;
+	
+	private static final int REQUEST_CODE_PREFERENCES = 1;
 
 	private static final int ACTION_BAR_TAB_CONTACT = 0;
 	private static final int ACTION_BAR_TAB_CALL = 1;
@@ -314,22 +314,22 @@
 		}
 	};
 
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item) {
-		Log.i(TAG, "onOptionsItemSelected " + item.getItemId());
-		switch(item.getItemId()){
-		case R.id.menu_settings :
-			Intent launchPreferencesIntent = new Intent().setClass(this, SFLPhonePreferenceActivity.class);
-			startActivityForResult(launchPreferencesIntent, REQUEST_CODE_PREFERENCES);
-			break;
-		case R.id.menu_custom_draw:
-			Intent launchNewInterfaceIntent = new Intent().setClass(this, BubblesViewActivity.class);
-			startActivityForResult(launchNewInterfaceIntent, 0);
-			break;
-		}
-
-		return super.onOptionsItemSelected(item);
-	}
+//	@Override
+//	public boolean onOptionsItemSelected(MenuItem item) {
+//		Log.i(TAG, "onOptionsItemSelected " + item.getItemId());
+//		switch(item.getItemId()){
+//		case R.id.menu_settings :
+//			Intent launchPreferencesIntent = new Intent().setClass(this, SFLPhonePreferenceActivity.class);
+//			startActivityForResult(launchPreferencesIntent, REQUEST_CODE_PREFERENCES);
+//			break;
+//		case R.id.menu_custom_draw:
+//			Intent launchNewInterfaceIntent = new Intent().setClass(this, BubblesViewActivity.class);
+//			startActivityForResult(launchNewInterfaceIntent, 0);
+//			break;
+//		}
+//
+//		return super.onOptionsItemSelected(item);
+//	}
 
 	@Override
 	public void onActivityResult(int requestCode, int resultCode, Intent data) {
@@ -340,11 +340,11 @@
 		}
 	}
 
-	@Override
-	public boolean onCreateOptionsMenu(Menu menu) {
-		getMenuInflater().inflate(R.menu.activity_sflphone_home, menu);
-		return true;
-	}
+//	@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) {
diff --git a/src/com/savoirfairelinux/sflphone/fragments/CallElementListFragment.java b/src/com/savoirfairelinux/sflphone/fragments/CallElementListFragment.java
index a39d5d9..fcf4eda 100644
--- a/src/com/savoirfairelinux/sflphone/fragments/CallElementListFragment.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/CallElementListFragment.java
@@ -51,6 +51,9 @@
 import android.provider.ContactsContract.Contacts;
 import android.util.Log;
 import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.view.ViewGroup;
@@ -69,8 +72,10 @@
 import com.savoirfairelinux.sflphone.R;
 import com.savoirfairelinux.sflphone.account.AccountSelectionSpinner;
 import com.savoirfairelinux.sflphone.adapters.CallElementAdapter;
+import com.savoirfairelinux.sflphone.client.BubblesViewActivity;
 import com.savoirfairelinux.sflphone.client.CallActivity;
 import com.savoirfairelinux.sflphone.client.SFLPhoneHomeActivity;
+import com.savoirfairelinux.sflphone.client.SFLPhonePreferenceActivity;
 import com.savoirfairelinux.sflphone.client.SFLphoneApplication;
 import com.savoirfairelinux.sflphone.client.receiver.CallListReceiver;
 import com.savoirfairelinux.sflphone.model.SipCall;
@@ -80,371 +85,393 @@
  * Main list of Call Elements. We don't manage contacts ourself so they are
  */
 public class CallElementListFragment extends ListFragment implements LoaderManager.LoaderCallbacks<Cursor> {
-	private static final String TAG = CallElementListFragment.class.getSimpleName();
-	private CallElementAdapter mAdapter;
-	private String mCurFilter;
-	private SFLPhoneHomeActivity sflphoneHome;
-	private ISipService service;
-	ImageButton buttonCall;
-	Button attendedTransfer, conference;
-	EditText phoneField;
-	private AccountSelectionSpinner mAccountSelectionSpinner;
-	//    private AccountListReceiver mAccountList;
-	private boolean isReady = false;
+    private static final String TAG = CallElementListFragment.class.getSimpleName();
+    private CallElementAdapter mAdapter;
+    private String mCurFilter;
+    private SFLPhoneHomeActivity sflphoneHome;
+    private ISipService service;
+    ImageButton buttonCall;
+    Button attendedTransfer, conference;
+    EditText phoneField;
+    private AccountSelectionSpinner mAccountSelectionSpinner;
+    // private AccountListReceiver mAccountList;
+    private boolean isReady = false;
 
-	static final String[] CONTACTS_SUMMARY_PROJECTION = new String[] { Contacts._ID, Contacts.DISPLAY_NAME, Contacts.PHOTO_ID, Contacts.LOOKUP_KEY };
-	static final String[] CONTACTS_PHONES_PROJECTION = new String[] { Phone.NUMBER, Phone.TYPE };
-	static final String[] CONTACTS_SIP_PROJECTION = new String[] { SipAddress.SIP_ADDRESS, SipAddress.TYPE };
+    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 };
 
-	private Callbacks mCallbacks = sDummyCallbacks;
-	private ToggleButton switchHold;
-	/**
-	 * A dummy implementation of the {@link Callbacks} interface that does nothing. Used only when this fragment is not attached to an activity.
-	 */
-	private static Callbacks sDummyCallbacks = new Callbacks() {
-		@Override
-		public void onCallSelected(SipCall c) {
-		}
+    private Callbacks mCallbacks = sDummyCallbacks;
+    private ToggleButton switchHold;
+    /**
+     * A dummy implementation of the {@link Callbacks} interface that does nothing. Used only when this fragment is not attached to an activity.
+     */
+    private static Callbacks sDummyCallbacks = new Callbacks() {
+        @Override
+        public void onCallSelected(SipCall c) {
+        }
 
-		@Override
-		public ISipService getService() {
-			// TODO Auto-generated method stub
-			return null;
-		}
-	};
+        @Override
+        public ISipService getService() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+    };
 
-	/**
-	 * The Activity calling this fragment has to implement this interface
-	 * 
-	 */
-	public interface Callbacks {
-		public void onCallSelected(SipCall c);
+    /**
+     * The Activity calling this fragment has to implement this interface
+     * 
+     */
+    public interface Callbacks {
+        public void onCallSelected(SipCall c);
 
-		public ISipService getService();
+        public ISipService getService();
 
-	}
+    }
 
-	@Override
-	public void onAttach(Activity activity) {
-		super.onAttach(activity);
-		sflphoneHome = (SFLPhoneHomeActivity) activity;
-		service = ((SFLphoneApplication) sflphoneHome.getApplication()).getSipService();
-		if (!(activity instanceof Callbacks)) {
-			throw new IllegalStateException("Activity must implement fragment's callbacks.");
-		}
+    @Override
+    public void onAttach(Activity activity) {
+        super.onAttach(activity);
+        sflphoneHome = (SFLPhoneHomeActivity) activity;
+        service = ((SFLphoneApplication) sflphoneHome.getApplication()).getSipService();
+        if (!(activity instanceof Callbacks)) {
+            throw new IllegalStateException("Activity must implement fragment's callbacks.");
+        }
 
-		mCallbacks = (Callbacks) activity;
-	}
+        mCallbacks = (Callbacks) activity;
+    }
 
-	@Override
-	public void onDetach() {
-		super.onDetach();
-		mCallbacks = sDummyCallbacks;
-	}
+    @Override
+    public void onDetach() {
+        super.onDetach();
+        mCallbacks = sDummyCallbacks;
+    }
 
-	public String getSelectedAccount() {
-		return mAccountSelectionSpinner.getAccount();
-	}
+    public String getSelectedAccount() {
+        return mAccountSelectionSpinner.getAccount();
+    }
 
-	/**
-	 * Runnable that fill information in a contact card asynchroniously.
-	 */
-	/*
-	 * public static class InfosLoader implements Runnable { private View view; private long cid; private ContentResolver cr;
-	 * 
-	 * public InfosLoader(Context context, View element, long contact_id) { cid = contact_id; cr = context.getContentResolver(); view = element; }
-	 * 
-	 * public static Bitmap loadContactPhoto(ContentResolver cr, long id) { Uri uri =
-	 * ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, id); InputStream input =
-	 * ContactsContract.Contacts.openContactPhotoInputStream(cr, uri); if (input == null) { return null; } return BitmapFactory.decodeStream(input); }
-	 * 
-	 * @Override public void run() { final Bitmap photo_bmp = loadContactPhoto(cr, cid);
-	 * 
-	 * Cursor phones = cr.query(CommonDataKinds.Phone.CONTENT_URI, CONTACTS_PHONES_PROJECTION, CommonDataKinds.Phone.CONTACT_ID + " = ?", new String[]
-	 * { Long.toString(cid) }, null);
-	 * 
-	 * final List<String> numbers = new ArrayList<String>(); while (phones.moveToNext()) { String number =
-	 * phones.getString(phones.getColumnIndex(CommonDataKinds.Phone.NUMBER)); // int type =
-	 * phones.getInt(phones.getColumnIndex(CommonDataKinds.Phone.TYPE)); numbers.add(number); } phones.close(); // TODO: same for SIP adresses.
-	 * 
-	 * final Bitmap bmp = photo_bmp; view.post(new Runnable() {
-	 * 
-	 * @Override public void run() { } }); } }
-	 */
+    /**
+     * Runnable that fill information in a contact card asynchroniously.
+     */
+    /*
+     * public static class InfosLoader implements Runnable { private View view; private long cid; private ContentResolver cr;
+     * 
+     * public InfosLoader(Context context, View element, long contact_id) { cid = contact_id; cr = context.getContentResolver(); view = element; }
+     * 
+     * public static Bitmap loadContactPhoto(ContentResolver cr, long id) { Uri uri =
+     * ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, id); InputStream input =
+     * ContactsContract.Contacts.openContactPhotoInputStream(cr, uri); if (input == null) { return null; } return BitmapFactory.decodeStream(input); }
+     * 
+     * @Override public void run() { final Bitmap photo_bmp = loadContactPhoto(cr, cid);
+     * 
+     * Cursor phones = cr.query(CommonDataKinds.Phone.CONTENT_URI, CONTACTS_PHONES_PROJECTION, CommonDataKinds.Phone.CONTACT_ID + " = ?", new String[]
+     * { Long.toString(cid) }, null);
+     * 
+     * final List<String> numbers = new ArrayList<String>(); while (phones.moveToNext()) { String number =
+     * phones.getString(phones.getColumnIndex(CommonDataKinds.Phone.NUMBER)); // int type =
+     * phones.getInt(phones.getColumnIndex(CommonDataKinds.Phone.TYPE)); numbers.add(number); } phones.close(); // TODO: same for SIP adresses.
+     * 
+     * final Bitmap bmp = photo_bmp; view.post(new Runnable() {
+     * 
+     * @Override public void run() { } }); } }
+     */
 
-	public CallElementListFragment() {
-		super();
-	}
+    public CallElementListFragment() {
+        super();
+    }
 
-	public void addCall(SipCall c) {
-		Log.i(TAG, "Adding call " + c.mCallInfo.mDisplayName);
-		mAdapter.add(c);
-	}
+    public void addCall(SipCall c) {
+        Log.i(TAG, "Adding call " + c.mCallInfo.mDisplayName);
+        mAdapter.add(c);
+    }
 
-	// public void removeCall(SipCall c) {
-	// Log.i(TAG, "Removing call " + c.mCallInfo.mDisplayName);
-	// mAdapter.remove(c);
-	// }
+    // public void removeCall(SipCall c) {
+    // Log.i(TAG, "Removing call " + c.mCallInfo.mDisplayName);
+    // mAdapter.remove(c);
+    // }
 
-	@Override
-	public void onActivityCreated(Bundle savedInstanceState) {
-		super.onActivityCreated(savedInstanceState);
+    @Override
+    public void onActivityCreated(Bundle savedInstanceState) {
+        super.onActivityCreated(savedInstanceState);
 
-		// Give some text to display if there is no data. In a real
-		// application this would come from a resource.
-		// setEmptyText("No phone numbers");
+        // Give some text to display if there is no data. In a real
+        // application this would come from a resource.
+        // setEmptyText("No phone numbers");
 
-		// We have a menu item to show in action bar.
-		setHasOptionsMenu(true);
+        // 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<SipCall> calls = new ArrayList<SipCall>();
-		mAdapter = new CallElementAdapter(getActivity(), calls);
-		setListAdapter(mAdapter);
+        // Create an empty adapter we will use to display the loaded data.
+        ArrayList<SipCall> calls = new ArrayList<SipCall>();
+        mAdapter = new CallElementAdapter(getActivity(), calls);
+        setListAdapter(mAdapter);
 
-		// Start out with a progress indicator.
-		// setListShown(false);
+        // Start out with a progress indicator.
+        // setListShown(false);
 
-		// Prepare the loader. Either re-connect with an existing one,
-		// or start a new one.
-		// getLoaderManager().initLoader(0, null, this)
+        // Prepare the loader. Either re-connect with an existing one,
+        // or start a new one.
+        // getLoaderManager().initLoader(0, null, this)
 
-		final Context context = getActivity();
-		ListView lv = getListView();
-		lv.setOnItemLongClickListener(new OnItemLongClickListener() {
-			@Override
-			public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) {
-				Log.i(TAG, "On Long Click");
-				final CharSequence[] items = { "Hang up Call", "Send Message", "Add to Conference" };
-				final SipCall call = 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() {
-					@Override
-					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();
+        final Context context = getActivity();
+        ListView lv = getListView();
+        lv.setOnItemLongClickListener(new OnItemLongClickListener() {
+            @Override
+            public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) {
+                Log.i(TAG, "On Long Click");
+                final CharSequence[] items = { "Hang up Call", "Send Message", "Add to Conference" };
+                final SipCall call = 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() {
+                            @Override
+                            public void onClick(DialogInterface dialog, int item) {
+                                Log.i(TAG, "Selected " + items[item]);
+                                switch (item) {
+                                case 0:
+                                    call.notifyServiceHangup(service);
+                                    break;
+                                case 1:
+                                    call.sendTextMessage();
+                                    // Need to hangup this call immediately since no way to do it after this action
+                                    call.notifyServiceHangup(service);
+                                    break;
+                                case 2:
+                                    call.addToConference();
+                                    // Need to hangup this call immediately since no way to do it after this action
+                                    call.notifyServiceHangup(service);
+                                    break;
+                                default:
+                                    break;
+                                }
+                            }
+                        });
+                AlertDialog alert = builder.create();
+                alert.show();
 
-				return true;
-			}
-		});
+                return true;
+            }
+        });
 
-		lv.setOnItemClickListener(new OnItemClickListener() {
+        lv.setOnItemClickListener(new OnItemClickListener() {
 
-			@Override
-			public void onItemClick(AdapterView<?> arg0, View v, int pos, long arg3) {
-				mCallbacks.onCallSelected(mAdapter.getItem(pos));
+            @Override
+            public void onItemClick(AdapterView<?> arg0, View v, int pos, long arg3) {
+                mCallbacks.onCallSelected(mAdapter.getItem(pos));
 
-			}
+            }
 
-		});
-	}
+        });
+    }
 
-	private void launchCallActivity(SipCall call) {
-		Log.i(TAG, "Launch Call Activity");
-		Bundle bundle = new Bundle();
-		bundle.putParcelable("CallInfo", call.mCallInfo);
-		Intent intent = new Intent().setClass(getActivity(), CallActivity.class);
-		intent.putExtras(bundle);
-		getActivity().startActivity(intent);
-	}
+    private void launchCallActivity(SipCall call) {
+        Log.i(TAG, "Launch Call Activity");
+        Bundle bundle = new Bundle();
+        bundle.putParcelable("CallInfo", call.mCallInfo);
+        Intent intent = new Intent().setClass(getActivity(), CallActivity.class);
+        intent.putExtras(bundle);
+        getActivity().startActivity(intent);
+    }
 
-	@Override
-	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
-		Log.i(TAG, "onCreateView");
-		View inflatedView = inflater.inflate(R.layout.frag_call_element, container, false);
+    @Override
+    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+        inflater.inflate(R.menu.call_element_menu, menu);
 
-		mAccountSelectionSpinner = (AccountSelectionSpinner) inflatedView.findViewById(R.id.account_selection_button);
-		phoneField = (EditText) inflatedView.findViewById(R.id.phoneNumberTextEntry);
-		buttonCall = (ImageButton) inflatedView.findViewById(R.id.buttonCall);
+    }
 
-		buttonCall.setOnClickListener(new OnClickListener() {
-			@Override
-			public void onClick(View v) {
-				processingNewCallAction();
-			}
-		});
+    private static final int REQUEST_CODE_PREFERENCES = 1;
 
-		attendedTransfer = (Button) inflatedView.findViewById(R.id.button_attended);
-		attendedTransfer.setOnClickListener(new OnClickListener() {
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        Log.i(TAG, "onOptionsItemSelected " + item.getItemId());
+        switch (item.getItemId()) {
+        case R.id.menu_settings:
+            Intent launchPreferencesIntent = new Intent().setClass(getActivity(), SFLPhonePreferenceActivity.class);
+            startActivityForResult(launchPreferencesIntent, REQUEST_CODE_PREFERENCES);
+            break;
+        }
 
-			@Override
-			public void onClick(View v) {
-				if (mAdapter.getCount() == 2) {
-					try {
-						service.attendedTransfer(mAdapter.getItem(0).getCallId(), mAdapter.getItem(1).getCallId());
-						mAdapter.clear();
-					} catch (RemoteException e) {
-						Log.e(TAG, e.toString());
-					}
-				} else {
-					Toast.makeText(getActivity(), "You need two calls one on Hold the other current to bind them", Toast.LENGTH_LONG).show();
-				}
+        return super.onOptionsItemSelected(item);
+    }
 
-			}
-		});
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+        Log.i(TAG, "onCreateView");
+        View inflatedView = inflater.inflate(R.layout.frag_call_element, container, false);
 
-		conference = (Button) inflatedView.findViewById(R.id.button_conf);
-		conference.setOnClickListener(new OnClickListener() {
+        mAccountSelectionSpinner = (AccountSelectionSpinner) inflatedView.findViewById(R.id.account_selection_button);
+        phoneField = (EditText) inflatedView.findViewById(R.id.phoneNumberTextEntry);
+        buttonCall = (ImageButton) inflatedView.findViewById(R.id.buttonCall);
 
-			@Override
-			public void onClick(View v) {
-				if (mAdapter.getCount() == 2) {
-					try {
-						service.joinParticipant(mAdapter.getItem(0).getCallId(), mAdapter.getItem(1).getCallId());
-					} catch (RemoteException e) {
-						Log.e(TAG, e.toString());
-					}
-				} else {
-					Toast.makeText(getActivity(), "You need two calls one on Hold the other current to create a conference", Toast.LENGTH_LONG).show();
-				}
-			}
-		});
+        buttonCall.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                processingNewCallAction();
+            }
+        });
 
-		switchHold = (ToggleButton) inflatedView.findViewById(R.id.switch_hold);
-		switchHold.setOnCheckedChangeListener(new OnCheckedChangeListener() {
+        attendedTransfer = (Button) inflatedView.findViewById(R.id.button_attended);
+        attendedTransfer.setOnClickListener(new OnClickListener() {
 
-			@Override
-			public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
-				try {
-					ArrayList<String> confList = (ArrayList<String>) service.getConferenceList();
-					if(!confList.isEmpty()){
-						if(isChecked){
-							service.holdConference(confList.get(0));
-						} else {
-							service.unholdConference(confList.get(0));
-						}
-					}
-				} catch (RemoteException e) {
-					Log.e(TAG, e.toString());
-				}
+            @Override
+            public void onClick(View v) {
+                if (mAdapter.getCount() == 2) {
+                    try {
+                        service.attendedTransfer(mAdapter.getItem(0).getCallId(), mAdapter.getItem(1).getCallId());
+                        mAdapter.clear();
+                    } catch (RemoteException e) {
+                        Log.e(TAG, e.toString());
+                    }
+                } else {
+                    Toast.makeText(getActivity(), "You need two calls one on Hold the other current to bind them", Toast.LENGTH_LONG).show();
+                }
 
-			}
-		});
+            }
+        });
 
-		isReady = true;
-		if (mCallbacks.getService() != null) {
+        conference = (Button) inflatedView.findViewById(R.id.button_conf);
+        conference.setOnClickListener(new OnClickListener() {
 
-			onServiceSipBinded(mCallbacks.getService());
-		}
-		return inflatedView;
-	}
+            @Override
+            public void onClick(View v) {
+                if (mAdapter.getCount() == 2) {
+                    try {
+                        service.joinParticipant(mAdapter.getItem(0).getCallId(), mAdapter.getItem(1).getCallId());
+                    } catch (RemoteException e) {
+                        Log.e(TAG, e.toString());
+                    }
+                } else {
+                    Toast.makeText(getActivity(), "You need two calls one on Hold the other current to create a conference", Toast.LENGTH_LONG)
+                            .show();
+                }
+            }
+        });
 
-	public void processingNewCallAction() {
-		// String accountID = mAccountList.currentAccountID;
-		String accountID = mAccountSelectionSpinner.getAccount();
+        switchHold = (ToggleButton) inflatedView.findViewById(R.id.switch_hold);
+        switchHold.setOnCheckedChangeListener(new OnCheckedChangeListener() {
 
-		String to = phoneField.getText().toString();
+            @Override
+            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                try {
+                    ArrayList<String> confList = (ArrayList<String>) service.getConferenceList();
+                    if (!confList.isEmpty()) {
+                        if (isChecked) {
+                            service.holdConference(confList.get(0));
+                        } else {
+                            service.unholdConference(confList.get(0));
+                        }
+                    }
+                } catch (RemoteException e) {
+                    Log.e(TAG, e.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;
+        isReady = true;
+        if (mCallbacks.getService() != null) {
 
-		SipCall call = CallListReceiver.getCallInstance(info);
-		mCallbacks.onCallSelected(call);
+            onServiceSipBinded(mCallbacks.getService());
+        }
+        return inflatedView;
+    }
 
-		try {
-			service.placeCall(info.mAccountID, info.mCallID, info.mPhone);
-		} catch (RemoteException e) {
-			Log.e(TAG, "Cannot call service method", e);
-		}
-		addCall(call);
-	}
+    public void processingNewCallAction() {
+        // String accountID = mAccountList.currentAccountID;
+        String accountID = mAccountSelectionSpinner.getAccount();
 
-	@Override
-	public Loader<Cursor> onCreateLoader(int id, Bundle args) {
+        String to = phoneField.getText().toString();
 
-		Log.i(TAG, "onCreateLoader");
-		Uri baseUri;
+        Random random = new Random();
+        String callID = Integer.toString(random.nextInt());
+        SipCall.CallInfo info = new SipCall.CallInfo();
 
-		if (mCurFilter != null) {
-			baseUri = Uri.withAppendedPath(Contacts.CONTENT_FILTER_URI, Uri.encode(mCurFilter));
-		} else {
-			baseUri = Contacts.CONTENT_URI;
-		}
+        info.mCallID = callID;
+        info.mAccountID = accountID;
+        info.mDisplayName = "Cool Guy!";
+        info.mPhone = to;
+        info.mEmail = "coolGuy@coolGuy.com";
+        info.mCallType = SipCall.CALL_TYPE_OUTGOING;
 
-		// 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 + " != '' ))";
+        SipCall call = CallListReceiver.getCallInstance(info);
+        mCallbacks.onCallSelected(call);
 
-		return new CursorLoader(getActivity(), baseUri, CONTACTS_SUMMARY_PROJECTION, select, null, Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC");
-	}
+        try {
+            service.placeCall(info.mAccountID, info.mCallID, info.mPhone);
+        } catch (RemoteException e) {
+            Log.e(TAG, "Cannot call service method", e);
+        }
+        addCall(call);
+    }
 
-	@Override
-	public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
-		Log.i(TAG, "onLoadFinished");
-		// Swap the new cursor in. (The framework will take care of closing the
-		// old cursor once we return.)
-		// mAdapter.swapCursor(data);
+    @Override
+    public Loader<Cursor> onCreateLoader(int id, Bundle args) {
 
-		// The list should now be shown.
-		/*
-		 * if (isResumed()) { setListShown(true); } else { setListShownNoAnimation(true); }
-		 */
-	}
+        Log.i(TAG, "onCreateLoader");
+        Uri baseUri;
 
-	@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);
-	}
+        if (mCurFilter != null) {
+            baseUri = Uri.withAppendedPath(Contacts.CONTENT_FILTER_URI, Uri.encode(mCurFilter));
+        } else {
+            baseUri = Contacts.CONTENT_URI;
+        }
 
-	/**
-	 * Called by activity to pass a reference to sipservice to Fragment.
-	 * 
-	 * @param isip
-	 */
-	public void onServiceSipBinded(ISipService isip) {
+        // 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 + " != '' ))";
 
-		if (isReady) {
-			service = isip;
-			ArrayList<String> accountList;
-			try {
-				accountList = (ArrayList<String>) mCallbacks.getService().getAccountList();
-				mAccountSelectionSpinner.populate(mCallbacks.getService(), accountList);
-			} catch (RemoteException e) {
-				Log.i(TAG, e.toString());
-			}
-		}
+        return new CursorLoader(getActivity(), baseUri, CONTACTS_SUMMARY_PROJECTION, select, null, Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC");
+    }
 
-	}
+    @Override
+    public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
+        Log.i(TAG, "onLoadFinished");
+        // Swap the new cursor in. (The framework will take care of closing the
+        // old cursor once we return.)
+        // mAdapter.swapCursor(data);
 
-	public void updateCall(String iD, String newState) {
-		mAdapter.update(iD, newState);
+        // The list should now be shown.
+        /*
+         * if (isResumed()) { setListShown(true); } else { setListShownNoAnimation(true); }
+         */
+    }
 
-	}
+    @Override
+    public void onLoaderReset(Loader<Cursor> loader) {
+        // This is called when the last Cursor provided to onLoadFinished()
+        // above is about to be closed. We need to make sure we are no
+        // longer using it.
+        // mAdapter.swapCursor(null);
+    }
+
+    /**
+     * Called by activity to pass a reference to sipservice to Fragment.
+     * 
+     * @param isip
+     */
+    public void onServiceSipBinded(ISipService isip) {
+
+        if (isReady) {
+            service = isip;
+            ArrayList<String> accountList;
+            try {
+                accountList = (ArrayList<String>) mCallbacks.getService().getAccountList();
+                mAccountSelectionSpinner.populate(mCallbacks.getService(), accountList);
+            } catch (RemoteException e) {
+                Log.i(TAG, e.toString());
+            }
+        }
+
+    }
+
+    public void updateCall(String iD, String newState) {
+        mAdapter.update(iD, newState);
+
+    }
 
 }
diff --git a/src/com/savoirfairelinux/sflphone/fragments/ContactListFragment.java b/src/com/savoirfairelinux/sflphone/fragments/ContactListFragment.java
index c196453..2f6eed6 100644
--- a/src/com/savoirfairelinux/sflphone/fragments/ContactListFragment.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/ContactListFragment.java
@@ -41,7 +41,6 @@
 import android.net.Uri;
 import android.os.Bundle;
 import android.provider.ContactsContract.Contacts;
-import android.support.v4.view.MenuItemCompat;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.DragEvent;
@@ -66,230 +65,195 @@
 import com.savoirfairelinux.sflphone.client.CallActivity;
 import com.savoirfairelinux.sflphone.loaders.ContactsLoader;
 import com.savoirfairelinux.sflphone.model.CallContact;
-import com.savoirfairelinux.sflphone.service.ISipService;
+import com.savoirfairelinux.sflphone.model.SipCall;
 import com.savoirfairelinux.sflphone.views.TACGridView;
 
 public class ContactListFragment extends Fragment implements OnQueryTextListener, LoaderManager.LoaderCallbacks<Bundle> {
-	final String TAG = "ContactListFragment";
-	ContactsAdapter mListAdapter;
-	StarredContactsAdapter mGridAdapter;
+    final String TAG = "ContactListFragment";
+    ContactsAdapter mListAdapter;
+    StarredContactsAdapter mGridAdapter;
 
-	String mCurFilter;
-	private ISipService service;
+    String mCurFilter;
 
-	public static final int CONTACT_LOADER = 555;
+    public static final int CONTACT_LOADER = 555;
 
-	@Override
-	public void onCreate(Bundle savedInBundle) {
-		super.onCreate(savedInBundle);
-		mListAdapter = new ContactsAdapter(getActivity());
-		mGridAdapter = new StarredContactsAdapter(getActivity());
-	}
+    @Override
+    public void onCreate(Bundle savedInBundle) {
+        super.onCreate(savedInBundle);
+        mListAdapter = new ContactsAdapter(getActivity());
+        mGridAdapter = new StarredContactsAdapter(getActivity());
+    }
 
-	@Override
-	public void onAttach(Activity activity) {
-		super.onAttach(activity);
-	}
+    @Override
+    public void onAttach(Activity activity) {
+        super.onAttach(activity);
+    }
 
-	@Override
-	public void onActivityCreated(Bundle savedInstanceState) {
-		super.onActivityCreated(savedInstanceState);
+    @Override
+    public void onActivityCreated(Bundle savedInstanceState) {
+        super.onActivityCreated(savedInstanceState);
 
-		// In order to onCreateOptionsMenu be called
-		setHasOptionsMenu(true);
-		getLoaderManager().initLoader(CONTACT_LOADER, null, this);
+        // In order to onCreateOptionsMenu be called
+        setHasOptionsMenu(true);
+        getLoaderManager().initLoader(CONTACT_LOADER, null, this);
 
-	}
+    }
 
-	ListView list;
+    ListView list;
 
-	@Override
-	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
-		View inflatedView = inflater.inflate(R.layout.frag_contact_list, container, false);
-		list = (ListView) inflatedView.findViewById(R.id.contacts_list);
+    private OnItemLongClickListener mItemLongClickListener = new OnItemLongClickListener() {
+        @Override
+        public boolean onItemLongClick(AdapterView<?> av, View view, int pos, long id) {
+            DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view.findViewById(R.id.photo));
+            view.startDrag(null, shadowBuilder, view, 0);
+            view.setVisibility(View.INVISIBLE);
+            return true;
+        }
 
-		list.setOnDragListener(dragListener);
+    };
 
-		list.setOnItemClickListener(new OnItemClickListener() {
+    private void launchCallActivity(CallContact c) {
+        Log.i(TAG, "Launch Call Activity");
+        Bundle bundle = new Bundle();
+        bundle.putString("action", "call");
+        bundle.putParcelable("CallContact", c);
+        Intent intent = new Intent().setClass(getActivity(), CallActivity.class);
+        intent.putExtras(bundle);
+        getActivity().startActivity(intent);
+    }
 
-			@Override
-			public void onItemClick(AdapterView<?> arg0, View view, int pos, long arg3) {
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+        View inflatedView = inflater.inflate(R.layout.frag_contact_list, container, false);
+        list = (ListView) inflatedView.findViewById(R.id.contacts_list);
 
-				Log.i(TAG, "Launch Call Activity");
-				Bundle bundle = new Bundle();
-				bundle.putString("action", "call");
-				bundle.putParcelable("CallContact", mListAdapter.getItem(pos));
-				Intent intent = new Intent().setClass(getActivity(), CallActivity.class);
-				intent.putExtras(bundle);
-				getActivity().startActivity(intent);
+        list.setOnDragListener(dragListener);
+        list.setOnItemClickListener(new OnItemClickListener() {
 
-			}
-		});
+            @Override
+            public void onItemClick(AdapterView<?> arg0, View v, int pos, long arg3) {
+                launchCallActivity(mListAdapter.getItem(pos));
+                
+            }
+        });
+        list.setOnItemLongClickListener(mItemLongClickListener);
 
-		list.setOnItemLongClickListener(new OnItemLongClickListener() {
-			@Override
-			public boolean onItemLongClick(AdapterView<?> av, View view, int pos, long id) {
-				DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view.findViewById(R.id.photo));
-				view.startDrag(null, shadowBuilder, view, 0);
-				view.setVisibility(View.INVISIBLE);
-				// Log.i(TAG, "On Long Click");
-				// final CharSequence[] items = { "Make Call", "Send Message", "Add to Conference" };
-				// final SipCall.CallInfo info = new SipCall.CallInfo();
-				// info.mDisplayName = (String) ((TextView) v.findViewById(R.id.display_name)).getText();
-				// info.mPhone = (String) ((TextView) v.findViewById(R.id.phones)).getText();
-				// // TODO getCallInstnace should be implemented in SipCallList
-				// // final SipCall call = SipCall.getCallInstance(info);
-				// final SipCall call = new SipCall(info);
-				//
-				// AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
-				// 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.placeCallUpdateUi();
-				// 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();
+        View header = inflater.inflate(R.layout.frag_contact_list_header, null);
+        list.addHeaderView(header, null, false);
+        TACGridView grid = (TACGridView) header.findViewById(R.id.favorites_grid);
 
-				return true;
-			}
-		});
+        list.setAdapter(mListAdapter);
+        grid.setAdapter(mGridAdapter);
+        grid.setExpanded(true);
+        
+        
+        grid.setOnDragListener(dragListener);
+        grid.setOnItemClickListener(new OnItemClickListener() {
 
-		View header = inflater.inflate(R.layout.frag_contact_list_header, null);
-		list.addHeaderView(header, null, false);
-		TACGridView grid = (TACGridView) header.findViewById(R.id.favorites_grid);
+            @Override
+            public void onItemClick(AdapterView<?> arg0, View v, int pos, long arg3) {
+                launchCallActivity(mGridAdapter.getItem(pos));
+                
+            }
+        });
+        grid.setOnItemLongClickListener(mItemLongClickListener);
 
-		list.setAdapter(mListAdapter);
-		grid.setAdapter(mGridAdapter);
-		grid.setExpanded(true);
-		grid.setOnDragListener(dragListener);
+        return inflatedView;
+    }
 
-		grid.setOnItemLongClickListener(new OnItemLongClickListener() {
+    OnDragListener dragListener = new OnDragListener() {
 
-			@Override
-			public boolean onItemLongClick(AdapterView<?> arg0, View view, int arg2, long arg3) {
-				DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view.findViewById(R.id.photo));
-				view.startDrag(null, shadowBuilder, view, 0);
-				view.setVisibility(View.INVISIBLE);
-				return true;
-			}
-		});
+        @Override
+        public boolean onDrag(View v, DragEvent event) {
+            switch (event.getAction()) {
+            case DragEvent.ACTION_DRAG_STARTED:
+                // Do nothing
+                break;
+            case DragEvent.ACTION_DRAG_ENTERED:
+                break;
+            case DragEvent.ACTION_DRAG_EXITED:
+                v.setBackgroundDrawable(null);
+                break;
+            case DragEvent.ACTION_DROP:
+                View view = (View) event.getLocalState();
+                break;
+            case DragEvent.ACTION_DRAG_ENDED:
+                View view1 = (View) event.getLocalState();
+                view1.setVisibility(View.VISIBLE);
+            default:
+                break;
+            }
+            return true;
+        }
 
-		return inflatedView;
-	}
+    };
 
-	OnDragListener dragListener = new OnDragListener() {
+    @Override
+    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+        // Place an action bar item for searching
+        inflater.inflate(R.menu.contact_list_menu, menu);
+        MenuItem item = menu.findItem(R.id.menu_search);
+        SearchView sv = new SearchView(getActivity());
+        sv.setOnQueryTextListener(this);
+        item.setActionView(sv);
+    }
 
-		@Override
-		public boolean onDrag(View v, DragEvent event) {
-			switch (event.getAction()) {
-			case DragEvent.ACTION_DRAG_STARTED:
-				// Do nothing
-				break;
-			case DragEvent.ACTION_DRAG_ENTERED:
-				break;
-			case DragEvent.ACTION_DRAG_EXITED:
-				v.setBackgroundDrawable(null);
-				break;
-			case DragEvent.ACTION_DROP:
-				View view = (View) event.getLocalState();
-				break;
-			case DragEvent.ACTION_DRAG_ENDED:
-				View view1 = (View) event.getLocalState();
-				view1.setVisibility(View.VISIBLE);
-			default:
-				break;
-			}
-			return true;
-		}
+    @Override
+    public boolean onQueryTextChange(String newText) {
+        // Called when the action bar search text has changed. Update
+        // the search filter, and restart the loader to do a new query
+        // with this filter.
+        String newFilter = !TextUtils.isEmpty(newText) ? newText : null;
+        // Don't do anything if the filter hasn't actually changed.
+        // Prefents restarting the loader when restoring state.
+        if (mCurFilter == null && newFilter == null) {
+            return true;
+        }
+        if (mCurFilter != null && mCurFilter.equals(newFilter)) {
+            return true;
+        }
+        mCurFilter = newFilter;
+        getLoaderManager().restartLoader(CONTACT_LOADER, null, this);
+        return true;
+    }
 
-	};
+    @Override
+    public boolean onQueryTextSubmit(String query) {
+        // Return false to let the SearchView perform the default action
+        return false;
+    }
 
-	@Override
-	public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
-		// Place an action bar item for searching
-		MenuItem item = menu.add("Search");
-		item.setIcon(R.drawable.ic_menu_search);
+    @Override
+    public Loader<Bundle> onCreateLoader(int id, Bundle args) {
+        Uri baseUri;
 
-		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);
-	}
+        if (mCurFilter != null) {
+            baseUri = Uri.withAppendedPath(Contacts.CONTENT_FILTER_URI, Uri.encode(mCurFilter));
+        } else {
+            baseUri = Contacts.CONTENT_URI;
+        }
+        ContactsLoader l = new ContactsLoader(getActivity(), baseUri);
+        l.forceLoad();
+        return l;
+    }
 
-	@Override
-	public boolean onQueryTextChange(String newText) {
-		// Called when the action bar search text has changed. Update
-		// the search filter, and restart the loader to do a new query
-		// with this filter.
-		String newFilter = !TextUtils.isEmpty(newText) ? newText : null;
-		// Don't do anything if the filter hasn't actually changed.
-		// Prefents restarting the loader when restoring state.
-		if (mCurFilter == null && newFilter == null) {
-			return true;
-		}
-		if (mCurFilter != null && mCurFilter.equals(newFilter)) {
-			return true;
-		}
-		mCurFilter = newFilter;
-		getLoaderManager().restartLoader(CONTACT_LOADER, null, this);
-		return true;
-	}
+    @Override
+    public void onLoadFinished(Loader<Bundle> loader, Bundle data) {
 
-	@Override
-	public boolean onQueryTextSubmit(String query) {
-		// Return false to let the SearchView perform the default action
-		return false;
-	}
+        mListAdapter.removeAll();
+        mGridAdapter.removeAll();
+        ArrayList<CallContact> tmp = data.getParcelableArrayList("Contacts");
+        ArrayList<CallContact> tmp2 = data.getParcelableArrayList("Starred");
 
-	@Override
-	public Loader<Bundle> onCreateLoader(int id, Bundle args) {
-		Uri baseUri;
+        Log.w(TAG, "Contact stareed " + tmp2.size());
+        mListAdapter.addAll(tmp);
+        mGridAdapter.addAll(tmp2);
 
-		if (mCurFilter != null) {
-			baseUri = Uri.withAppendedPath(Contacts.CONTENT_FILTER_URI, Uri.encode(mCurFilter));
-		} else {
-			baseUri = Contacts.CONTENT_URI;
-		}
-		ContactsLoader l = new ContactsLoader(getActivity(), baseUri);
-		l.forceLoad();
-		return l;
-	}
+    }
 
-	@Override
-	public void onLoadFinished(Loader<Bundle> loader, Bundle data) {
-
-		mListAdapter.removeAll();
-		mGridAdapter.removeAll();
-		ArrayList<CallContact> tmp = data.getParcelableArrayList("Contacts");
-		ArrayList<CallContact> tmp2 = data.getParcelableArrayList("Starred");
-
-		Log.w(TAG, "Contact stareed " + tmp2.size());
-		mListAdapter.addAll(tmp);
-		mGridAdapter.addAll(tmp2);
-
-	}
-
-	@Override
-	public void onLoaderReset(Loader<Bundle> loader) {
-		// Thi is called when the last Cursor provided to onLoadFinished
-		// mListAdapter.swapCursor(null);
-	}
+    @Override
+    public void onLoaderReset(Loader<Bundle> loader) {
+        // Thi is called when the last Cursor provided to onLoadFinished
+        // mListAdapter.swapCursor(null);
+    }
 }
diff --git a/src/com/savoirfairelinux/sflphone/loaders/ContactsLoader.java b/src/com/savoirfairelinux/sflphone/loaders/ContactsLoader.java
index a56f78c..495ebc6 100644
--- a/src/com/savoirfairelinux/sflphone/loaders/ContactsLoader.java
+++ b/src/com/savoirfairelinux/sflphone/loaders/ContactsLoader.java
@@ -47,23 +47,23 @@
         while (result.moveToNext()) {
             builder.startNewContact(result.getLong(iID), result.getString(iName), result.getLong(iPhoto));
             
-//            Cursor cPhones = getContext().getContentResolver().query(Phone.CONTENT_URI, CONTACTS_PHONES_PROJECTION,
-//                    Phone.CONTACT_ID + " =" + result.getLong(iID), null, null);
+            Cursor cPhones = getContext().getContentResolver().query(Phone.CONTENT_URI, CONTACTS_PHONES_PROJECTION,
+                    Phone.CONTACT_ID + " =" + result.getLong(iID), null, null);
 
-//            while (cPhones.moveToNext()) {
-//                builder.addPhoneNumber(cPhones.getString(cPhones.getColumnIndex(Phone.NUMBER)), cPhones.getInt(cPhones.getColumnIndex(Phone.TYPE)));
-//                Log.i(TAG,"Phone:"+cPhones.getString(cPhones.getColumnIndex(Phone.NUMBER)));
-//            }
-//            cPhones.close();
-//
-//            Cursor cSip = getContext().getContentResolver().query(Phone.CONTENT_URI, CONTACTS_SIP_PROJECTION,
-//                    Phone.CONTACT_ID + "=" + result.getLong(iID), null, null);
-//
-//            while (cSip.moveToNext()) {
-//                builder.addSipNumber(cSip.getString(cSip.getColumnIndex(SipAddress.SIP_ADDRESS)), cSip.getInt(cSip.getColumnIndex(SipAddress.TYPE)));
-//                Log.i(TAG,"Phone:"+cSip.getString(cSip.getColumnIndex(SipAddress.SIP_ADDRESS)));
-//            }
-//            cSip.close();
+            while (cPhones.moveToNext()) {
+                builder.addPhoneNumber(cPhones.getString(cPhones.getColumnIndex(Phone.NUMBER)), cPhones.getInt(cPhones.getColumnIndex(Phone.TYPE)));
+                Log.i(TAG,"Phone:"+cPhones.getString(cPhones.getColumnIndex(Phone.NUMBER)));
+            }
+            cPhones.close();
+
+            Cursor cSip = getContext().getContentResolver().query(Phone.CONTENT_URI, CONTACTS_SIP_PROJECTION,
+                    Phone.CONTACT_ID + "=" + result.getLong(iID), null, null);
+
+            while (cSip.moveToNext()) {
+                builder.addSipNumber(cSip.getString(cSip.getColumnIndex(SipAddress.SIP_ADDRESS)), cSip.getInt(cSip.getColumnIndex(SipAddress.TYPE)));
+                Log.i(TAG,"Phone:"+cSip.getString(cSip.getColumnIndex(SipAddress.SIP_ADDRESS)));
+            }
+            cSip.close();
 
             contacts.add(builder.build());
             if (result.getInt(iStarred) == 1) {
diff --git a/src/com/savoirfairelinux/sflphone/model/BubbleModel.java b/src/com/savoirfairelinux/sflphone/model/BubbleModel.java
index e94304e..5e785ae 100644
--- a/src/com/savoirfairelinux/sflphone/model/BubbleModel.java
+++ b/src/com/savoirfairelinux/sflphone/model/BubbleModel.java
@@ -68,7 +68,7 @@
 				double edt = -Math.expm1(-BUBBLE_RETURN_TIME_LAMBDA*dt);
 				double dx = (attractor_pos.x - bx) * edt;
 				double dy = (attractor_pos.y - by) * edt;
-				Log.w(TAG, "update dx="+dt+" dy="+dy);
+//				Log.w(TAG, "update dx="+dt+" dy="+dy);
 				b.setPos((float)(bx+dx), (float)(by+dy));
 
 				if(attractor != null && attractor_dist < ATTRACTOR_DIST_SUCK*ATTRACTOR_DIST_SUCK) {
diff --git a/src/com/savoirfairelinux/sflphone/model/CallContact.java b/src/com/savoirfairelinux/sflphone/model/CallContact.java
index 0472bbb..c658b8a 100644
--- a/src/com/savoirfairelinux/sflphone/model/CallContact.java
+++ b/src/com/savoirfairelinux/sflphone/model/CallContact.java
@@ -30,210 +30,234 @@
  */
 package com.savoirfairelinux.sflphone.model;
 
+import java.lang.reflect.Array;
 import java.util.ArrayList;
+import java.util.Arrays;
 
 import android.os.Parcel;
 import android.os.Parcelable;
+import android.provider.Contacts.Phones;
 
 public class CallContact implements Parcelable {
 
-	private long id;
-	private String mDisplayName;
-	private long photo_id;
-	ArrayList<Phone> phones, sip_phones;
-	String mEmail;
+    private long id;
+    private String mDisplayName;
+    private long photo_id;
+    private ArrayList<Phone> phones, sip_phones;
+    private String mEmail;
 
-	private CallContact(long cID, String displayName, long photoID, ArrayList<Phone> p, ArrayList<Phone> sip, String mail) {
-		id = cID;
-		mDisplayName = displayName;
-		phones = p;
-		sip_phones = sip;
-		mEmail = mail;
-		photo_id = photoID;
-	}
+    private CallContact(long cID, String displayName, long photoID, ArrayList<Phone> p, ArrayList<Phone> sip, String mail) {
+        id = cID;
+        mDisplayName = displayName;
+        phones = p;
+        sip_phones = sip;
+        mEmail = mail;
+        photo_id = photoID;
+    }
 
-	public CallContact(Parcel in) {
-		readFromParcel(in);
-	}
+    public CallContact(Parcel in) {
+        readFromParcel(in);
+    }
 
-	public long getId() {
-		return id;
-	}
+    public long getId() {
+        return id;
+    }
 
-	public String getmDisplayName() {
-		return mDisplayName;
-	}
+    public String getmDisplayName() {
+        return mDisplayName;
+    }
 
-	public void setmDisplayName(String mDisplayName) {
-		this.mDisplayName = mDisplayName;
-	}
+    public void setmDisplayName(String mDisplayName) {
+        this.mDisplayName = mDisplayName;
+    }
 
-	public long getPhoto_id() {
-		return photo_id;
-	}
+    public long getPhoto_id() {
+        return photo_id;
+    }
 
-	public void setPhoto_id(long photo_id) {
-		this.photo_id = photo_id;
-	}
+    public void setPhoto_id(long photo_id) {
+        this.photo_id = photo_id;
+    }
 
-	public ArrayList<Phone> getPhones() {
-		return phones;
-	}
+    public ArrayList<Phone> getPhones() {
+        return phones;
+    }
 
-	public void setPhones(ArrayList<Phone> phones) {
-		this.phones = phones;
-	}
+    public void setPhones(ArrayList<Phone> phones) {
+        this.phones = phones;
+    }
 
-	public ArrayList<Phone> getSip_phones() {
-		return sip_phones;
-	}
+    public ArrayList<Phone> getSip_phones() {
+        return sip_phones;
+    }
 
-	public void setSip_phones(ArrayList<Phone> sip_phones) {
-		this.sip_phones = sip_phones;
-	}
+    public void setSip_phones(ArrayList<Phone> sip_phones) {
+        this.sip_phones = sip_phones;
+    }
 
-	public Phone getSipPhone() {
-		if(sip_phones.size() > 0) {
-			return sip_phones.get(0);
-		}
-		if(phones.size() > 0) {
-			return phones.get(0);
-		}
-		return null;
-	}
+    public Phone getSipPhone() {
+        if (sip_phones.size() > 0) {
+            return sip_phones.get(0);
+        }
+        if (phones.size() > 0) {
+            return phones.get(0);
+        }
+        return null;
+    }
 
-	public String getmEmail() {
-		return mEmail;
-	}
+    public String getmEmail() {
+        return mEmail;
+    }
 
-	public void setmEmail(String mEmail) {
-		this.mEmail = mEmail;
-	}
+    public void setmEmail(String mEmail) {
+        this.mEmail = mEmail;
+    }
 
-	@Override
-	public String toString() {
-		return mDisplayName;
-	}
+    @Override
+    public String toString() {
+        return mDisplayName;
+    }
 
-	public static class ContactBuilder {
+    public static class ContactBuilder {
 
-		long contactID;
-		String contactName;
-		long contactPhoto;
-		ArrayList<Phone> phones;
-		ArrayList<Phone> sip;
-		String contactMail;
-		boolean hasPhoto;
+        long contactID;
+        String contactName;
+        long contactPhoto;
+        ArrayList<Phone> phones;
+        ArrayList<Phone> sip;
+        String contactMail;
+        boolean hasPhoto;
 
-		public ContactBuilder startNewContact(long id, String displayName, long photo_id) {
-			contactID = id;
-			contactName = displayName;
-			contactPhoto = photo_id;
-			phones = new ArrayList<Phone>();
-			sip = new ArrayList<Phone>();
-			return this;
-		}
+        public ContactBuilder startNewContact(long id, String displayName, long photo_id) {
+            contactID = id;
+            contactName = displayName;
+            contactPhoto = photo_id;
+            phones = new ArrayList<Phone>();
+            sip = new ArrayList<Phone>();
+            return this;
+        }
 
-		public ContactBuilder addPhoneNumber(String num, int type) {
-			phones.add(new Phone(num, type));
-			return this;
-		}
+        public ContactBuilder addPhoneNumber(String num, int type) {
+            phones.add(new Phone(num, type));
+            return this;
+        }
 
-		public ContactBuilder addSipNumber(String num, int type){
-			sip.add(new Phone(num, type));
-			return this;
-		}
+        public ContactBuilder addSipNumber(String num, int type) {
+            sip.add(new Phone(num, type));
+            return this;
+        }
 
-		public CallContact build() {
-			return new CallContact(contactID, contactName, contactPhoto, phones, sip, contactMail);
-		}
+        public CallContact build() {
+            return new CallContact(contactID, contactName, contactPhoto, phones, sip, contactMail);
+        }
 
-		public static ContactBuilder getInstance() {
-			return new ContactBuilder();
-		}
+        public static ContactBuilder getInstance() {
+            return new ContactBuilder();
+        }
 
+    }
 
-	}
+    @Override
+    public int describeContents() {
+        return 0;
+    }
 
-	@Override
-	public int describeContents() {
-		return 0;
-	}
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeLong(id);
+        dest.writeString(mDisplayName);
+        dest.writeLong(photo_id);
+        dest.writeTypedList(phones);
 
-	@Override
-	public void writeToParcel(Parcel dest, int flags) {
-		dest.writeLong(id);
-		Phone[] tmp = new Phone[phones.size()];
-		phones.toArray(tmp);
-		dest.writeParcelableArray(tmp, flags);
-		dest.writeLong(photo_id);
+        dest.writeTypedList(sip_phones);
+        
+        dest.writeString(mEmail);
+        
 
-	}
+    }
 
-	private void readFromParcel(Parcel in) {
+    private void readFromParcel(Parcel in) {
 
-		id = in.readLong();
-		mDisplayName = in.readString();
-		photo_id = in.readLong();
-		phones = in.readArrayList(Phone.class.getClassLoader());
-		sip_phones = in.readArrayList(Phone.class.getClassLoader());
-		mEmail = in.readString();
-	}
+        id = in.readLong();
+        mDisplayName = in.readString();
+        photo_id = in.readLong();
+        phones = new ArrayList<CallContact.Phone>();
+        sip_phones = new ArrayList<CallContact.Phone>();
+        in.readTypedList(phones, Phone.CREATOR);
+        in.readTypedList(sip_phones, Phone.CREATOR);
+        mEmail = in.readString();
+    }
 
-	public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
-		@Override
-		public CallContact createFromParcel(Parcel in) {
-			return new CallContact(in);
-		}
+    public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
+        @Override
+        public CallContact createFromParcel(Parcel in) {
+            return new CallContact(in);
+        }
 
-		@Override
-		public CallContact[] newArray(int size) {
-			return new CallContact[size];
-		}
-	};
+        @Override
+        public CallContact[] newArray(int size) {
+            return new CallContact[size];
+        }
+    };
 
-	public static class Phone implements Parcelable {
+    public static class Phone implements Parcelable {
 
-		int type;
-		String number;
+        int type;
+        String number;
 
-		public Phone(String num, int ty) {
-			type = ty;
-			number = num;
-		}
+        public Phone(String num, int ty) {
+            type = ty;
+            number = num;
+        }
 
-		public Phone(Parcel in) {
-			readFromParcel(in);
-		}
+        public Phone(Parcel in) {
+            readFromParcel(in);
+        }
 
-		@Override
-		public int describeContents() {
-			return 0;
-		}
+        @Override
+        public int describeContents() {
+            return 0;
+        }
 
-		@Override
-		public void writeToParcel(Parcel dest, int arg1) {
-			dest.writeInt(type);
-			dest.writeString(number);
-		}
+        @Override
+        public void writeToParcel(Parcel dest, int arg1) {
+            dest.writeInt(type);
+            dest.writeString(number);
+        }
 
-		private void readFromParcel(Parcel in) {
-			type = in.readInt();
-			number = in.readString();
-		}
+        private void readFromParcel(Parcel in) {
+            type = in.readInt();
+            number = in.readString();
+        }
 
-		public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
-			@Override
-			public Phone createFromParcel(Parcel in) {
-				return new Phone(in);
-			}
+        public static final Parcelable.Creator<Phone> CREATOR = new Parcelable.Creator() {
+            @Override
+            public Phone createFromParcel(Parcel in) {
+                return new Phone(in);
+            }
 
-			@Override
-			public Phone[] newArray(int size) {
-				return new Phone[size];
-			}
-		};
+            @Override
+            public Phone[] newArray(int size) {
+                return new Phone[size];
+            }
+        };
 
-	}
+        public int getType() {
+            return type;
+        }
+
+        public void setType(int type) {
+            this.type = type;
+        }
+
+        public String getNumber() {
+            return number;
+        }
+
+        public void setNumber(String number) {
+            this.number = number;
+        }
+
+    }
 
 }
diff --git a/src/com/savoirfairelinux/sflphone/service/SipService.java b/src/com/savoirfairelinux/sflphone/service/SipService.java
index 3534dc7..2f49975 100644
--- a/src/com/savoirfairelinux/sflphone/service/SipService.java
+++ b/src/com/savoirfairelinux/sflphone/service/SipService.java
@@ -237,6 +237,7 @@
             System.loadLibrary("samplerate");
             System.loadLibrary("codec_ulaw");
             System.loadLibrary("codec_alaw");
+            System.loadLibrary("codec_g722");
             System.loadLibrary("speexresampler");
             System.loadLibrary("sflphone");
             isPjSipStackStarted = true;