blob: 8e2f0d3c4c8f1e9079f822ee7939ca6954651f6e [file] [log] [blame]
Alexandre Lisiona8b78722013-12-13 10:18:33 -05001/*
Alexandre Lisionc1024c02014-01-06 11:12:53 -05002 * Copyright (C) 2004-2014 Savoir-Faire Linux Inc.
Alexandre Lisiona8b78722013-12-13 10:18:33 -05003 *
4 * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 * Additional permission under GNU GPL version 3 section 7:
21 *
22 * If you modify this program, or any covered work, by linking or
23 * combining it with the OpenSSL project's OpenSSL library (or a
24 * modified version of that library), containing parts covered by the
25 * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
26 * grants you additional permission to convey the resulting work.
27 * Corresponding Source for a non-source form of such a combination
28 * shall include the source code for the parts of OpenSSL used as well
29 * as that of the covered work.
30 */
31
Alexandre Lision40954dc2013-10-09 15:24:03 -040032package org.sflphone.model;
33
34import org.sflphone.R;
35
36import android.content.Context;
37import android.graphics.Bitmap;
38import android.graphics.Bitmap.Config;
39import android.graphics.BitmapFactory;
40import android.graphics.Canvas;
41import android.graphics.Paint;
Alexandre Lision40954dc2013-10-09 15:24:03 -040042import android.graphics.RectF;
43import android.util.Log;
Alexandre Lisiond9c3f7f2013-10-30 15:20:55 -040044import android.view.MotionEvent;
Alexandre Lision40954dc2013-10-09 15:24:03 -040045
46public class BubbleContact extends Bubble {
47
48 public SipCall associated_call;
Alexandre Lisionee2494d2013-10-09 17:14:00 -040049 Bitmap buttonMsg, buttonUnhold, buttonHold, buttonTransfer, buttonHangUp;
Alexandre Lision40954dc2013-10-09 15:24:03 -040050
Alexandre Lision68855472013-10-10 16:20:46 -040051 public interface drawerPosition {
52 int UNDEFINED = -1;
53 int TOP = 0;
54 int RIGHT = 1;
55 int BOTTOM = 2;
56 int LEFT = 3;
57 }
58
Alexandre Lision40954dc2013-10-09 15:24:03 -040059 public BubbleContact(Context context, SipCall call, float x, float y, float size) {
60 super(context, call.getContact(), x, y, size);
61 associated_call = call;
Alexandre Lisiond5ee3962013-11-08 15:37:28 -050062
Alexandre Lision40954dc2013-10-09 15:24:03 -040063 buttonMsg = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_action_chat);
64 buttonHold = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_action_pause_over_video);
Alexandre Lisionee2494d2013-10-09 17:14:00 -040065 buttonUnhold = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_action_play_over_video);
Alexandre Lision40954dc2013-10-09 15:24:03 -040066 buttonTransfer = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_action_forward);
67 buttonHangUp = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_action_end_call);
Alexandre Lisiond5ee3962013-11-08 15:37:28 -050068
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -040069 setDrawer(new ActionDrawer(0, 0, drawerPosition.UNDEFINED));
Alexandre Lision40954dc2013-10-09 15:24:03 -040070
71 }
72
73 @Override
74 public void expand(int width, int height) {
75
76 expanded = true;
77 generateBitmap();
78 if (pos.x < width / 3) {
79
Alexandre Lision68855472013-10-10 16:20:46 -040080 // Left
81 act = new ActionDrawer(width * 2 / 3, (int) (getRadius() * 1.5f), drawerPosition.LEFT);
82 act.adjustBounds(pos.x, pos.y);
Alexandre Lisiond9c3f7f2013-10-30 15:20:55 -040083 act.generateBitmap(actions.NOTHING);
Alexandre Lision40954dc2013-10-09 15:24:03 -040084
Alexandre Lision40954dc2013-10-09 15:24:03 -040085 } else if (pos.x > 2 * width / 3) {
Alexandre Lision68855472013-10-10 16:20:46 -040086 // Right
87 act = new ActionDrawer(width * 2 / 3, (int) (getRadius() * 1.5f), drawerPosition.RIGHT);
88 act.adjustBounds(pos.x, pos.y);
Alexandre Lisiond9c3f7f2013-10-30 15:20:55 -040089 act.generateBitmap(actions.NOTHING);
Alexandre Lision40954dc2013-10-09 15:24:03 -040090
91 } else {
92 // Middle of the screen
93 if (pos.y < height / 3) {
94 // Middle Top
95
Alexandre Lision68855472013-10-10 16:20:46 -040096 act = new ActionDrawer((int) (getRadius() * 1.5f), height / 2, drawerPosition.TOP);
97 act.adjustBounds(pos.x, pos.y);
Alexandre Lisiond9c3f7f2013-10-30 15:20:55 -040098 act.generateBitmap(actions.NOTHING);
Alexandre Lision40954dc2013-10-09 15:24:03 -040099
100 } else if (pos.y > 2 * height / 3) {
101 // Middle Bottom
102
Alexandre Lision68855472013-10-10 16:20:46 -0400103 act = new ActionDrawer((int) (getRadius() * 1.5f), height / 2, drawerPosition.BOTTOM);
104 act.adjustBounds(pos.x, pos.y);
Alexandre Lisiond9c3f7f2013-10-30 15:20:55 -0400105 act.generateBitmap(actions.NOTHING);
Alexandre Lision40954dc2013-10-09 15:24:03 -0400106
Alexandre Lision40954dc2013-10-09 15:24:03 -0400107 }
108 }
109
110 }
111
Alexandre Lisionee2494d2013-10-09 17:14:00 -0400112 protected class ActionDrawer extends Bubble.ActionDrawer {
Alexandre Lision40954dc2013-10-09 15:24:03 -0400113
Alexandre Lision68855472013-10-10 16:20:46 -0400114 int direction;
Alexandre Lision40954dc2013-10-09 15:24:03 -0400115 RectF boundsHoldButton, boundsMsgButton, boundsTransferButton, boundsHangUpButton;
Alexandre Lisiona8b78722013-12-13 10:18:33 -0500116 @SuppressWarnings("unused")
Alexandre Lision5cd659e2013-10-29 13:18:23 -0400117 private String TAG = ActionDrawer.class.getSimpleName();
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400118
119 int wHang, hHang;
120 int wHold, hHold;
121 int wMsg, hMsg;
122 int wTrans, hTrans;
Alexandre Lisiond5ee3962013-11-08 15:37:28 -0500123 private RectF boundsTransferIcon,boundsMsgIcon, boundsHangIcon, boundsHoldIcon;
124
125 private int LINE_PADDING = 25;
126
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400127
128 Paint pButtons = new Paint();
Alexandre Lision40954dc2013-10-09 15:24:03 -0400129
Alexandre Lision68855472013-10-10 16:20:46 -0400130 public ActionDrawer(int w, int h, int dir) {
Alexandre Lision40954dc2013-10-09 15:24:03 -0400131 super(w, h);
Alexandre Lision68855472013-10-10 16:20:46 -0400132 direction = dir;
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400133
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400134 wHang = buttonHangUp.getWidth();
135 hHang = buttonHangUp.getHeight();
136
137 wMsg = buttonMsg.getWidth();
138 hMsg = buttonMsg.getHeight();
139
140 wHold = buttonHold.getWidth();
141 hHold = buttonHold.getHeight();
142
143 wTrans = buttonTransfer.getWidth();
144 hTrans = buttonTransfer.getHeight();
Alexandre Lision40954dc2013-10-09 15:24:03 -0400145 }
Alexandre Lisionee2494d2013-10-09 17:14:00 -0400146
Alexandre Lision40954dc2013-10-09 15:24:03 -0400147 @Override
148 public int getAction(float x, float y) {
149
Alexandre Lision5cd659e2013-10-29 13:18:23 -0400150 float relativeX = x - getDrawerBounds().left;
151 float relativeY = y - getDrawerBounds().top;
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400152
Alexandre Lision5cd659e2013-10-29 13:18:23 -0400153 int result = actions.NOTHING;
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400154
155 if (!getDrawerBounds().contains(x, y) && !getBounds().contains(x, y)) {
Alexandre Lision5cd659e2013-10-29 13:18:23 -0400156 return actions.OUT_OF_BOUNDS;
157 }
Alexandre Lision40954dc2013-10-09 15:24:03 -0400158
159 if (boundsHoldButton.contains(relativeX, relativeY)) {
160 Log.i("Bubble", "Holding");
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400161 result = actions.HOLD;
Alexandre Lision40954dc2013-10-09 15:24:03 -0400162 }
163
164 if (boundsMsgButton.contains(relativeX, relativeY)) {
165 Log.i("Bubble", "Msg");
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400166 result = actions.MESSAGE;
Alexandre Lision40954dc2013-10-09 15:24:03 -0400167 }
168
169 if (boundsHangUpButton.contains(relativeX, relativeY)) {
170 Log.i("Bubble", "hangUp");
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400171 result = actions.HANGUP;
Alexandre Lision40954dc2013-10-09 15:24:03 -0400172 }
173
174 if (boundsTransferButton.contains(relativeX, relativeY)) {
175 Log.i("Bubble", "Transfer");
Alexandre Lision5cd659e2013-10-29 13:18:23 -0400176 result = actions.TRANSFER;
Alexandre Lision40954dc2013-10-09 15:24:03 -0400177 }
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400178
Alexandre Lision5cd659e2013-10-29 13:18:23 -0400179 return result;
Alexandre Lision40954dc2013-10-09 15:24:03 -0400180
181 }
182
Alexandre Lisiond9c3f7f2013-10-30 15:20:55 -0400183 public void generateBitmap(int action) {
Alexandre Lision40954dc2013-10-09 15:24:03 -0400184
185 img = Bitmap.createBitmap(mWidth, mHeight, Config.ARGB_8888);
Alexandre Lision40954dc2013-10-09 15:24:03 -0400186 Canvas c = new Canvas(img);
Alexandre Lisiond5ee3962013-11-08 15:37:28 -0500187 c.drawRect(new RectF(0, 0, mWidth, mHeight), mBackgroundPaint);
Alexandre Lision68855472013-10-10 16:20:46 -0400188 float rHeight, rWidth;
Alexandre Lision40954dc2013-10-09 15:24:03 -0400189
Alexandre Lision68855472013-10-10 16:20:46 -0400190 switch (direction) {
191 case drawerPosition.TOP:
192 rHeight = bounds.height() - getRadius();
Alexandre Lision40954dc2013-10-09 15:24:03 -0400193 boundsHoldButton = new RectF(0, getRadius(), mWidth, getRadius() + rHeight / 4);
194 boundsMsgButton = new RectF(0, getRadius() + rHeight / 4, mWidth, getRadius() + 2 * rHeight / 4);
195 boundsTransferButton = new RectF(0, getRadius() + 2 * rHeight / 4, mWidth, getRadius() + 3 * rHeight / 4);
196 boundsHangUpButton = new RectF(0, getRadius() + 3 * rHeight / 4, mWidth, getRadius() + rHeight);
197
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400198 calculateIconBounds();
199 draw(c, action);
Alexandre Lisiond5ee3962013-11-08 15:37:28 -0500200
201 c.drawLine(LINE_PADDING, boundsHoldButton.bottom, mWidth - LINE_PADDING, boundsHoldButton.bottom, mLines);
202 c.drawLine(LINE_PADDING, boundsMsgButton.bottom, mWidth - LINE_PADDING, boundsMsgButton.bottom, mLines);
203 c.drawLine(LINE_PADDING, boundsTransferButton.bottom, mWidth - LINE_PADDING, boundsTransferButton.bottom, mLines);
204
Alexandre Lision68855472013-10-10 16:20:46 -0400205 break;
206 case drawerPosition.BOTTOM:
207 rHeight = bounds.height() - getRadius();
Alexandre Lisiond5ee3962013-11-08 15:37:28 -0500208 boundsHangUpButton = new RectF(0, 0, mWidth, rHeight / 4);
209 boundsTransferButton = new RectF(0, rHeight / 4, mWidth, 2 * rHeight / 4);
210 boundsMsgButton = new RectF(0, 2 * rHeight / 4, mWidth, 3 * rHeight / 4);
211 boundsHoldButton = new RectF(0, 3 * rHeight / 4, mWidth, rHeight);
Alexandre Lision68855472013-10-10 16:20:46 -0400212
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400213 calculateIconBounds();
214 draw(c, action);
Alexandre Lisiond5ee3962013-11-08 15:37:28 -0500215
216 c.drawLine(LINE_PADDING, boundsHangUpButton.bottom, mWidth - LINE_PADDING, boundsHangUpButton.bottom, mLines);
217 c.drawLine(LINE_PADDING, boundsTransferButton.bottom, mWidth - LINE_PADDING, boundsTransferButton.bottom, mLines);
218 c.drawLine(LINE_PADDING, boundsMsgButton.bottom, mWidth - LINE_PADDING,boundsMsgButton.bottom, mLines);
219
Alexandre Lision68855472013-10-10 16:20:46 -0400220 break;
221 case drawerPosition.RIGHT:
222 rWidth = bounds.width() - getRadius();
223 boundsHoldButton = new RectF(0, 0, rWidth / 4, mHeight);
224 boundsMsgButton = new RectF(rWidth / 4, 0, 2 * rWidth / 4, mHeight);
225 boundsTransferButton = new RectF(2 * rWidth / 4, 0, 3 * rWidth / 4, mHeight);
226 boundsHangUpButton = new RectF(3 * rWidth / 4, 0, rWidth, mHeight);
227
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400228 calculateIconBounds();
229 draw(c, action);
Alexandre Lisiond5ee3962013-11-08 15:37:28 -0500230
231 c.drawLine(boundsHoldButton.right, LINE_PADDING, boundsHoldButton.right, mHeight - LINE_PADDING, mLines);
232 c.drawLine(boundsMsgButton.right, LINE_PADDING, boundsMsgButton.right, mHeight - LINE_PADDING, mLines);
233 c.drawLine(boundsTransferButton.right, LINE_PADDING, boundsTransferButton.right, mHeight - LINE_PADDING, mLines);
234
Alexandre Lision68855472013-10-10 16:20:46 -0400235 break;
236 case drawerPosition.LEFT:
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400237
Alexandre Lision68855472013-10-10 16:20:46 -0400238 rWidth = bounds.width() - getRadius();
Alexandre Lisiond5ee3962013-11-08 15:37:28 -0500239 boundsHangUpButton = new RectF(getRadius(), 0, getRadius() + rWidth / 4, mHeight);
240 boundsTransferButton = new RectF(getRadius() + rWidth / 4, 0, getRadius() + 2 * rWidth / 4, mHeight);
241 boundsMsgButton = new RectF(getRadius() + 2 * rWidth / 4, 0, getRadius() + 3 * rWidth / 4, mHeight);
242 boundsHoldButton = new RectF(getRadius() + 3 * rWidth / 4, 0, getRadius() + rWidth, mHeight);
Alexandre Lision68855472013-10-10 16:20:46 -0400243
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400244 calculateIconBounds();
245 draw(c, action);
Alexandre Lision68855472013-10-10 16:20:46 -0400246 break;
Alexandre Lision40954dc2013-10-09 15:24:03 -0400247 }
248
249 }
250
Alexandre Lisiond5ee3962013-11-08 15:37:28 -0500251
252
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400253 private void draw(Canvas c, int action) {
254 if (action == actions.HANGUP) {
Alexandre Lisiond5ee3962013-11-08 15:37:28 -0500255 c.drawRect(boundsHangUpButton, mSelector);
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400256 }
257 c.drawBitmap(buttonHangUp, null, boundsHangIcon, pButtons);
258
259 if (action == actions.HOLD) {
Alexandre Lisiond5ee3962013-11-08 15:37:28 -0500260 c.drawRect(boundsHoldButton, mSelector);
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400261 }
262 if (associated_call.isOnHold()) {
263 c.drawBitmap(buttonUnhold, null, boundsHoldIcon, pButtons);
264 } else {
265 c.drawBitmap(buttonHold, null, boundsHoldIcon, pButtons);
266 }
267 if (action == actions.MESSAGE) {
Alexandre Lisiond5ee3962013-11-08 15:37:28 -0500268 c.drawRect(boundsMsgButton, mSelector);
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400269 }
270 c.drawBitmap(buttonMsg, null, boundsMsgIcon, pButtons);
271
272 if (action == actions.TRANSFER) {
Alexandre Lisiond5ee3962013-11-08 15:37:28 -0500273 c.drawRect(boundsTransferButton, mSelector);
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400274 }
275 c.drawBitmap(buttonTransfer, null, boundsTransferIcon, pButtons);
276 }
277
278 private void calculateIconBounds() {
279 boundsHoldIcon = new RectF((int) boundsHoldButton.centerX() - wHold / 2, (int) boundsHoldButton.centerY() - hHold / 2,
280 (int) boundsHoldButton.centerX() + wHold / 2, (int) boundsHoldButton.centerY() + hHold / 2);
281 boundsHangIcon = new RectF((int) boundsHangUpButton.centerX() - wHang / 2, (int) boundsHangUpButton.centerY() - hHang / 2,
282 (int) boundsHangUpButton.centerX() + wHang / 2, (int) boundsHangUpButton.centerY() + hHang / 2);
283 boundsMsgIcon = new RectF((int) boundsMsgButton.centerX() - wMsg / 2, (int) boundsMsgButton.centerY() - hMsg / 2,
284 (int) boundsMsgButton.centerX() + wMsg / 2, (int) boundsMsgButton.centerY() + hMsg / 2);
285 boundsTransferIcon = new RectF((int) boundsTransferButton.centerX() - wTrans / 2, (int) boundsTransferButton.centerY() - hTrans / 2,
286 (int) boundsTransferButton.centerX() + wTrans / 2, (int) boundsTransferButton.centerY() + hTrans / 2);
287 }
288
Alexandre Lision68855472013-10-10 16:20:46 -0400289 public void adjustBounds(float x, float y) {
290 switch (direction) {
291 case drawerPosition.TOP:
292 setBounds(x - getRadius(), y, x + getRadius(), y + getHeight());
293 break;
294 case drawerPosition.BOTTOM:
295 setBounds(x - getRadius(), y - getHeight(), x + getRadius(), y);
296 break;
297 case drawerPosition.RIGHT:
298 setBounds(x - getWidth(), y - getRadius(), x, y + +getRadius());
299 break;
300 case drawerPosition.LEFT:
301 setBounds(x, y - getRadius(), x + getWidth(), y + getRadius());
302 break;
303 }
304
305 }
306
307 @Override
308 public void setBounds(float left, float top, float right, float bottom) {
309 int margin = (int) (0.5f * getRadius()) / 2;
310 switch (direction) {
311 case drawerPosition.TOP:
312 case drawerPosition.BOTTOM:
313 super.setBounds(left + margin, top, right - margin, bottom);
314 break;
315 case drawerPosition.RIGHT:
316 case drawerPosition.LEFT:
317 super.setBounds(left, top + margin, right, bottom - margin);
318 break;
319 }
320
321 }
Alexandre Lision40954dc2013-10-09 15:24:03 -0400322 }
323
324 public Bitmap getDrawerBitmap() {
325 return act.getBitmap();
326 }
327
328 public RectF getDrawerBounds() {
Alexandre Lision5cd659e2013-10-29 13:18:23 -0400329 return act.getDrawerBounds();
Alexandre Lision40954dc2013-10-09 15:24:03 -0400330 }
331
332 @Override
333 public void set(float x, float y, float s) {
334 scale = s;
335 pos.x = x;
336 pos.y = y;
337 if (!expanded) {
338 bounds.set(pos.x - getRadius(), pos.y - getRadius(), pos.x + getRadius(), pos.y + getRadius());
339 } else {
340 bounds.set(pos.x - getRadius(), pos.y - getRadius(), pos.x + getRadius(), pos.y + getRadius());
Alexandre Lision68855472013-10-10 16:20:46 -0400341 act.adjustBounds(pos.x, pos.y);
Alexandre Lision40954dc2013-10-09 15:24:03 -0400342 }
343 }
344
345 @Override
346 public int getRadius() {
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400347 if (expanded)
Alexandre Lisiona9485b82013-10-25 10:00:57 -0400348 return (int) (radius * density);
Alexandre Lision40954dc2013-10-09 15:24:03 -0400349 return (int) (radius * scale * density);
350 }
351
Alexandre Lision40954dc2013-10-09 15:24:03 -0400352 @Override
353 public boolean getHoldStatus() {
354 if (associated_call.isOnHold())
355 return true;
356 else
357 return false;
358 }
359
360 @Override
361 public boolean getRecordStatus() {
362 if (associated_call.isRecording())
363 return true;
364 else
365 return false;
366 }
367
Alexandre Lision40954dc2013-10-09 15:24:03 -0400368 public SipCall getCall() {
369 return associated_call;
370 }
371
Alexandre Lisionee2494d2013-10-09 17:14:00 -0400372 public void setCall(SipCall call) {
373 associated_call = call;
Alexandre Lision68855472013-10-10 16:20:46 -0400374 if (expanded) {
Alexandre Lisiond9c3f7f2013-10-30 15:20:55 -0400375 act.generateBitmap(actions.NOTHING);
Alexandre Lisionee2494d2013-10-09 17:14:00 -0400376 }
Alexandre Lision68855472013-10-10 16:20:46 -0400377
Alexandre Lisionee2494d2013-10-09 17:14:00 -0400378 }
379
380 @Override
Alexandre Lision68855472013-10-10 16:20:46 -0400381 public String getName() {
382 return associated_call.getContact().getmDisplayName();
383 }
384
385 @Override
386 public boolean callIDEquals(String call) {
387 return associated_call.getCallId().contentEquals(call);
388 }
389
390 @Override
391 public String getCallID() {
392 return associated_call.getCallId();
Alexandre Lisionee2494d2013-10-09 17:14:00 -0400393 }
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400394
Alexandre Lisiond9c3f7f2013-10-30 15:20:55 -0400395 @Override
396 public boolean onDown(MotionEvent event) {
Alexandre Lision8fdcf2b2013-10-30 16:06:51 -0400397 if (expanded) {
398 act.generateBitmap(act.getAction(event.getX(), event.getY()));
399 return false;
400 }
401 if (intersects(event.getX(), event.getY())) {
Alexandre Lisiond9c3f7f2013-10-30 15:20:55 -0400402 dragged = true;
403 last_drag = System.nanoTime();
404 setPos(event.getX(), event.getY());
405 target_scale = .8f;
406 return true;
407 }
408 return false;
409 }
Alexandre Lisionee2494d2013-10-09 17:14:00 -0400410
Alexandre Lision40954dc2013-10-09 15:24:03 -0400411}