* #31377: action hooks on ACTION_UP instead of DOWN
diff --git a/src/org/sflphone/model/Bubble.java b/src/org/sflphone/model/Bubble.java
index 1f8c405..ad534dd 100644
--- a/src/org/sflphone/model/Bubble.java
+++ b/src/org/sflphone/model/Bubble.java
@@ -40,6 +40,7 @@
     protected Bitmap saved_photo;
 
     public interface actions {
+        int OUT_OF_BOUNDS = -1;
         int NOTHING = 0;
         int HOLD = 1;
         int RECORD = 2;
@@ -224,7 +225,7 @@
 
         public abstract void generateBitmap();
 
-        public RectF getBounds() {
+        public RectF getDrawerBounds() {
             return bounds;
         }
 
diff --git a/src/org/sflphone/model/BubbleContact.java b/src/org/sflphone/model/BubbleContact.java
index 1650a93..2bbbd2e 100644
--- a/src/org/sflphone/model/BubbleContact.java
+++ b/src/org/sflphone/model/BubbleContact.java
@@ -79,6 +79,7 @@
 
         int direction;
         RectF boundsHoldButton, boundsMsgButton, boundsTransferButton, boundsHangUpButton;
+        private String TAG = ActionDrawer.class.getSimpleName();
 
         public ActionDrawer(int w, int h, int dir) {
             super(w, h);
@@ -88,29 +89,39 @@
         @Override
         public int getAction(float x, float y) {
 
-            float relativeX = x - getBounds().left;
-            float relativeY = y - getBounds().top;
+            float relativeX = x - getDrawerBounds().left;
+            float relativeY = y - getDrawerBounds().top;
+            
+            
+            int result = actions.NOTHING;
+            
+            if(!getDrawerBounds().contains(x, y) && !getBounds().contains(x, y)){
+                return actions.OUT_OF_BOUNDS;
+            }
 
             if (boundsHoldButton.contains(relativeX, relativeY)) {
                 Log.i("Bubble", "Holding");
-                return actions.HOLD;
+                result =  actions.HOLD;
             }
 
             if (boundsMsgButton.contains(relativeX, relativeY)) {
                 Log.i("Bubble", "Msg");
-                return actions.MESSAGE;
+                result =  actions.MESSAGE;
             }
 
             if (boundsHangUpButton.contains(relativeX, relativeY)) {
                 Log.i("Bubble", "hangUp");
-                return actions.HANGUP;
+                result =  actions.HANGUP;
             }
 
             if (boundsTransferButton.contains(relativeX, relativeY)) {
                 Log.i("Bubble", "Transfer");
-                return actions.TRANSFER;
+                result = actions.TRANSFER;
             }
-            return 0;
+            
+            
+            
+            return result;
 
         }
 
@@ -309,7 +320,7 @@
     }
 
     public RectF getDrawerBounds() {
-        return act.getBounds();
+        return act.getDrawerBounds();
     }
 
     @Override
diff --git a/src/org/sflphone/model/BubbleUser.java b/src/org/sflphone/model/BubbleUser.java
index d38a116..df58458 100644
--- a/src/org/sflphone/model/BubbleUser.java
+++ b/src/org/sflphone/model/BubbleUser.java
@@ -1,6 +1,7 @@
 package org.sflphone.model;
 
 import org.sflphone.R;
+import org.sflphone.model.Bubble.actions;
 
 import android.content.Context;
 import android.graphics.Bitmap;
@@ -147,20 +148,12 @@
         @Override
         public int getAction(float x, float y) {
 
-            float relativeX = x - getBounds().left;
-            float relativeY = y - getBounds().top;
+            float relativeX = x - getDrawerBounds().left;
+            float relativeY = y - getDrawerBounds().top;
 
-            Log.i("Bubble", "relativeX:" + relativeX);
-            Log.i("Bubble", "relativeY:" + relativeY);
-
-            Log.i("Bubble", "pos.x:" + pos.x);
-            Log.i("Bubble", "pos.y:" + pos.y);
-            //
-            // Log.i("Bubble", getBounds().toShortString());
-            //
-            Log.i("boundsHoldButton", boundsHoldButton.toShortString());
-            Log.i("boundsMicButton", boundsMicButton.toShortString());
-            Log.i("boundsHangUpButton", boundsHangUpButton.toShortString());
+            if(!getDrawerBounds().contains(x, y) && !getBounds().contains(x, y)){
+                return actions.OUT_OF_BOUNDS;
+            }
 
             if (boundsHoldButton.contains(relativeX, relativeY)) {
                 Log.i("Bubble", "Holding");
diff --git a/src/org/sflphone/model/BubblesView.java b/src/org/sflphone/model/BubblesView.java
index d9c61d6..df85f60 100644
--- a/src/org/sflphone/model/BubblesView.java
+++ b/src/org/sflphone/model/BubblesView.java
@@ -56,6 +56,7 @@
 import android.view.SurfaceView;

 import android.view.View;

 import android.view.View.OnTouchListener;

+import android.widget.Toast;

 

 public class BubblesView extends SurfaceView implements SurfaceHolder.Callback, OnTouchListener {

     private static final String TAG = BubblesView.class.getSimpleName();

@@ -337,6 +338,68 @@
                 thread.setPaused(false);

             }

 

+            Bubble expand = getExpandedBubble();

+            if (expand != null) {

+                

+                switch (expand.getDrawer().getAction(event.getX(), event.getY())) {

+                case Bubble.actions.OUT_OF_BOUNDS:

+                    expand.retract();

+                    break;

+                case Bubble.actions.HOLD:

+

+                    try {

+                        if (expand.getHoldStatus()) {

+

+                            if (expand.isConference())

+                                callback.mCallbacks.getService().unholdConference(expand.getCallID());

+                            else

+                                callback.mCallbacks.getService().unhold(expand.getCallID());

+                        } else {

+                            if (expand.isConference())

+                                callback.mCallbacks.getService().holdConference(expand.getCallID());

+                            else

+                                callback.mCallbacks.getService().hold(expand.getCallID());

+

+                        }

+                    } catch (Exception e) {

+                        e.printStackTrace();

+                    }

+

+                    return true;

+                case Bubble.actions.RECORD:

+                    try {

+                        callback.mCallbacks.getService().toggleRecordingCall(expand.getCallID());

+                    } catch (RemoteException e1) {

+                        e1.printStackTrace();

+                    }

+                    return true;

+                case Bubble.actions.MESSAGE:

+                    // TODO

+                    return true;

+

+                case Bubble.actions.HANGUP:

+                    try {

+                        if (expand.isConference())

+                            callback.mCallbacks.getService().hangUpConference(expand.getCallID());

+                        else

+                            callback.mCallbacks.getService().hangUp(expand.getCallID());

+                    } catch (RemoteException e) {

+                        e.printStackTrace();

+                    }

+                    return true;

+

+                case Bubble.actions.TRANSFER:

+                    callback.makeTransfer((BubbleContact) expand);

+                    return true;

+                case Bubble.actions.NOTHING:

+                    break;

+                }

+                

+                

+            }

+

+            

+

             List<Bubble> bubbles = model.getBubbles();

             final int n_bubbles = bubbles.size();

             for (int i = 0; i < n_bubbles; i++) {

@@ -407,65 +470,7 @@
         public boolean onDown(MotionEvent event) {

             List<Bubble> bubbles = model.getBubbles();

             final int n_bubbles = bubbles.size();

-            Bubble expand = getExpandedBubble();

-            Log.d("Main", "onDown");

-            if (expand != null) {

-                Log.d("Main", "getAction");

-                switch (expand.getDrawer().getAction(event.getX(), event.getY())) {

-                case Bubble.actions.NOTHING:

-                    expand.retract();

-                    break;

-                case Bubble.actions.HOLD:

 

-                    try {

-                        if (expand.getHoldStatus()) {

-

-                            if (expand.isConference())

-                                callback.mCallbacks.getService().unholdConference(expand.getCallID());

-                            else

-                                callback.mCallbacks.getService().unhold(expand.getCallID());

-                        } else {

-                            if (expand.isConference())

-                                callback.mCallbacks.getService().holdConference(expand.getCallID());

-                            else

-                                callback.mCallbacks.getService().hold(expand.getCallID());

-

-                        }

-                    } catch (Exception e) {

-                        e.printStackTrace();

-                    }

-

-                    break;

-                case Bubble.actions.RECORD:

-                    try {

-                        callback.mCallbacks.getService().toggleRecordingCall(expand.getCallID());

-                    } catch (RemoteException e1) {

-                        e1.printStackTrace();

-                    }

-                    break;

-                case Bubble.actions.MESSAGE:

-                    // TODO

-                    break;

-

-                case Bubble.actions.HANGUP:

-                    try {

-                        if (expand.isConference())

-                            callback.mCallbacks.getService().hangUpConference(expand.getCallID());

-                        else

-                            callback.mCallbacks.getService().hangUp(expand.getCallID());

-                    } catch (RemoteException e) {

-                        e.printStackTrace();

-                    }

-                    break;

-

-                case Bubble.actions.TRANSFER:

-                    callback.makeTransfer((BubbleContact) expand);

-                    break;

-                }

-                return true;

-            }

-

-            // Log.d("Main", "onDown");

             for (int i = 0; i < n_bubbles; i++) {

                 Bubble b = bubbles.get(i);

                 if (b.intersects(event.getX(), event.getY()) && !b.expanded) {