From 6ae652dea52de7aa816801750bf01af2f8bed081 Mon Sep 17 00:00:00 2001
From: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
Date: Thu, 26 Sep 2013 16:39:20 -0400
Subject: [PATCH] * #30525: bility to make attended transfer during call

---
 .../sflphone/fragments/CallFragment.java        | 16 ++++++++++------
 .../sflphone/model/BubblesView.java             |  1 -
 .../sflphone/model/SipCall.java                 |  5 +++++
 .../sflphone/service/ISipService.aidl           |  1 +
 .../sflphone/service/SipService.java            | 17 +++++++++++++++++
 5 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/src/com/savoirfairelinux/sflphone/fragments/CallFragment.java b/src/com/savoirfairelinux/sflphone/fragments/CallFragment.java
index 4486828b6..33981f540 100644
--- a/src/com/savoirfairelinux/sflphone/fragments/CallFragment.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/CallFragment.java
@@ -466,13 +466,17 @@ public class CallFragment extends Fragment implements Callback, SensorEventListe
     public void makeTransfer(Bubble contact) {
         FragmentManager fm = getFragmentManager();
         TransferDFragment editName = new TransferDFragment();
-
         Bundle b = new Bundle();
-        b.putParcelableArrayList("calls", new ArrayList<Conference>());
-        b.putParcelable("call_selected", contact.associated_call);
-        editName.setArguments(b);
-        editName.setTargetFragment(this, REQUEST_TRANSFER);
-        editName.show(fm, "");
+        try {
+            b.putParcelableArrayList("calls", (ArrayList<Conference>)mCallbacks.getService().getConcurrentCalls());
+            b.putParcelable("call_selected", contact.associated_call);
+            editName.setArguments(b);
+            editName.setTargetFragment(this, REQUEST_TRANSFER);
+            editName.show(fm, "");
+        } catch (RemoteException e) {
+            Log.e(TAG, e.toString());
+        }
+
     }
 
     @Override
diff --git a/src/com/savoirfairelinux/sflphone/model/BubblesView.java b/src/com/savoirfairelinux/sflphone/model/BubblesView.java
index 2a03ce8e5..6184d2387 100644
--- a/src/com/savoirfairelinux/sflphone/model/BubblesView.java
+++ b/src/com/savoirfairelinux/sflphone/model/BubblesView.java
@@ -466,7 +466,6 @@ public class BubblesView extends SurfaceView implements SurfaceHolder.Callback,
                         break;
                     case 3:
                         callback.makeTransfer(expand);
-                        Toast.makeText(getContext(), "Not implemented here", Toast.LENGTH_SHORT).show();
                         break;
                     }
                 }
diff --git a/src/com/savoirfairelinux/sflphone/model/SipCall.java b/src/com/savoirfairelinux/sflphone/model/SipCall.java
index ec2fddb0a..7fa44db39 100644
--- a/src/com/savoirfairelinux/sflphone/model/SipCall.java
+++ b/src/com/savoirfairelinux/sflphone/model/SipCall.java
@@ -427,4 +427,9 @@ public class SipCall implements Parcelable {
         return mCallState == state.CALL_STATE_HOLD;
     }
 
+
+    public boolean isCurrent() {
+        return mCallState == state.CALL_STATE_CURRENT;
+    }
+
 }
diff --git a/src/com/savoirfairelinux/sflphone/service/ISipService.aidl b/src/com/savoirfairelinux/sflphone/service/ISipService.aidl
index 75cfcdb6b..54834f55c 100644
--- a/src/com/savoirfairelinux/sflphone/service/ISipService.aidl
+++ b/src/com/savoirfairelinux/sflphone/service/ISipService.aidl
@@ -67,6 +67,7 @@ interface ISipService {
     String getConferenceDetails(in String callID);
     
     Conference getCurrentCall();
+    List getConcurrentCalls();
     
     
     /*   */
diff --git a/src/com/savoirfairelinux/sflphone/service/SipService.java b/src/com/savoirfairelinux/sflphone/service/SipService.java
index eccd684a1..1ec06b340 100644
--- a/src/com/savoirfairelinux/sflphone/service/SipService.java
+++ b/src/com/savoirfairelinux/sflphone/service/SipService.java
@@ -1160,5 +1160,22 @@ public class SipService extends Service {
             });
         }
 
+        @Override
+        public List getConcurrentCalls() throws RemoteException {
+            ArrayList<Conference> toReturn = new ArrayList<Conference>();
+            
+            for(SipCall sip : current_calls.values()){
+                if(!sip.isCurrent()){
+                    Conference tmp = new Conference("-1");
+                    tmp.getParticipants().add(sip);
+                    toReturn.add(tmp);
+                }
+            }
+            
+            Log.i(TAG,"toReturn SIZE "+ toReturn.size());
+            
+            return toReturn;
+        }
+
     };
 }
-- 
GitLab