diff --git a/src/com/savoirfairelinux/sflphone/client/ContactListFragment.java b/src/com/savoirfairelinux/sflphone/client/ContactListFragment.java index 6d198a9d5e03fca2ad7dbb5a1cfa613768607565..cc4b9e980595c3cf50b922cc315f35e82db5051d 100644 --- a/src/com/savoirfairelinux/sflphone/client/ContactListFragment.java +++ b/src/com/savoirfairelinux/sflphone/client/ContactListFragment.java @@ -72,6 +72,7 @@ import com.savoirfairelinux.sflphone.R; public class ContactListFragment extends ListFragment implements OnQueryTextListener, LoaderManager.LoaderCallbacks<Cursor> { + final String TAG = "ConatctListFragment"; ContactElementAdapter mAdapter; String mCurFilter; @@ -210,16 +211,16 @@ public class ContactListFragment extends ListFragment implements OnQueryTextList public void onListItemClick(ListView l, View v, int position, long id) { // Insert desired behavior here. - String displayName = (String) ((TextView) v.findViewById(R.id.display_name)).getText(); - String phoneNumber = (String) ((TextView) v.findViewById(R.id.phones)).getText(); - Log.i("ContactListFragment", "Contact clicked: " + displayName + ", Phone number: " + phoneNumber); -/* - SipCall call = SipCall.getCallInstance(contact); - Log.i("ConatctListFragment", "OK"); - Log.i("ContactListFragment", "Number of calls " + SipCall.getNbCalls()); - - mManager.callmanagerJNI.placeCall("IP2IP", "CALL1234", "192.168.40.35"); -*/ + SipCall.CallInfo callInfo = new SipCall.CallInfo(); + callInfo.mDisplayName = (String) ((TextView) v.findViewById(R.id.display_name)).getText(); + callInfo.mPhone = (String) ((TextView) v.findViewById(R.id.phones)).getText(); + Log.i(TAG, "Contact clicked: " + callInfo.mDisplayName + ", Phone number: " + callInfo.mPhone); + + SipCall call = SipCall.getCallInstance(callInfo); + Log.i(TAG, "Number of calls " + SipCall.getNbCalls()); + + call.placeCall(); + // mManager.callmanagerJNI.placeCall("IP2IP", "CALL1234", "192.168.40.35"); } @Override diff --git a/src/com/savoirfairelinux/sflphone/client/SipCall.java b/src/com/savoirfairelinux/sflphone/client/SipCall.java index cab3bfa8018875ce2b07f2093068dc82bc5a1228..f2efc71817ee098aa8ea5793b7be9383d3d085bb 100644 --- a/src/com/savoirfairelinux/sflphone/client/SipCall.java +++ b/src/com/savoirfairelinux/sflphone/client/SipCall.java @@ -37,37 +37,47 @@ public class SipCall { final static String TAG = "SipCall"; static ArrayList<SipCall> CallList = new ArrayList<SipCall>(); - CallContact mContact; + CallElementList mCallElementList; + public CallInfo mCallInfo; + + public static class CallInfo + { + public String mDisplayName = ""; + public String mPhone = ""; + public String mEmail = ""; + } public SipCall() { - mContact = null; CallList.add(this); + mCallInfo = new CallInfo(); } - public SipCall(CallContact contact) + public SipCall(CallInfo info) { - mContact = contact; CallList.add(this); + mCallInfo = info; } protected void finalize() throws Throwable { - CallList.remove(this); + CallList.remove(this); } - public static SipCall getCallInstance(CallContact contact) + public static SipCall getCallInstance(CallInfo info) { if(CallList.isEmpty()) - return new SipCall(contact); + return new SipCall(info); for(SipCall sipcall : CallList) { - if(sipcall.mContact.getDisplayName().equals(contact.getDisplayName())) { - return sipcall; + if(sipcall.mCallInfo.mDisplayName.equals(info.mDisplayName)) { + if(sipcall.mCallInfo.mPhone.equals(info.mPhone)) { + return sipcall; + } } } - return new SipCall(contact); + return new SipCall(info); } public static int getNbCalls() @@ -77,7 +87,7 @@ public class SipCall public void placeCall() { - + } public void answer()